'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var Vue = _interopDefault(require('vue')); var vueTemplateCompiler = require('vue-template-compiler'); var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var semver = createCommonjsModule(function (module, exports) { exports = module.exports = SemVer; // The debug function is excluded entirely from the minified version. /* nomin */ var debug; /* nomin */ if (typeof process === 'object' && /* nomin */ process.env && /* nomin */ process.env.NODE_DEBUG && /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) /* nomin */ { debug = function() { /* nomin */ var args = Array.prototype.slice.call(arguments, 0); /* nomin */ args.unshift('SEMVER'); /* nomin */ console.log.apply(console, args); /* nomin */ }; } /* nomin */ else /* nomin */ { debug = function() {}; } // Note: this is the semver.org version of the spec that it implements // Not necessarily the package version of this code. exports.SEMVER_SPEC_VERSION = '2.0.0'; var MAX_LENGTH = 256; var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16; // The actual regexps go on exports.re var re = exports.re = []; var src = exports.src = []; var R = 0; // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. // ## Numeric Identifier // A single `0`, or a non-zero digit followed by zero or more digits. var NUMERICIDENTIFIER = R++; src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; var NUMERICIDENTIFIERLOOSE = R++; src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. var NONNUMERICIDENTIFIER = R++; src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; // ## Main Version // Three dot-separated numeric identifiers. var MAINVERSION = R++; src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')'; var MAINVERSIONLOOSE = R++; src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; // ## Pre-release Version Identifier // A numeric identifier, or a non-numeric identifier. var PRERELEASEIDENTIFIER = R++; src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + '|' + src[NONNUMERICIDENTIFIER] + ')'; var PRERELEASEIDENTIFIERLOOSE = R++; src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + '|' + src[NONNUMERICIDENTIFIER] + ')'; // ## Pre-release Version // Hyphen, followed by one or more dot-separated pre-release version // identifiers. var PRERELEASE = R++; src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; var PRERELEASELOOSE = R++; src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; // ## Build Metadata Identifier // Any combination of digits, letters, or hyphens. var BUILDIDENTIFIER = R++; src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata // identifiers. var BUILD = R++; src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; // ## Full Version String // A main version, followed optionally by a pre-release version and // build metadata. // Note that the only major, minor, patch, and pre-release sections of // the version string are capturing groups. The build metadata is not a // capturing group, because it should not ever be used in version // comparison. var FULL = R++; var FULLPLAIN = 'v?' + src[MAINVERSION] + src[PRERELEASE] + '?' + src[BUILD] + '?'; src[FULL] = '^' + FULLPLAIN + '$'; // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty // common in the npm registry. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + src[PRERELEASELOOSE] + '?' + src[BUILD] + '?'; var LOOSE = R++; src[LOOSE] = '^' + LOOSEPLAIN + '$'; var GTLT = R++; src[GTLT] = '((?:<|>)?=?)'; // Something like "2.*" or "1.2.x". // Note that "x.x" is a valid xRange identifer, meaning "any version" // Only the first item is strictly required. var XRANGEIDENTIFIERLOOSE = R++; src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; var XRANGEIDENTIFIER = R++; src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; var XRANGEPLAIN = R++; src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:' + src[PRERELEASE] + ')?' + src[BUILD] + '?' + ')?)?'; var XRANGEPLAINLOOSE = R++; src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[PRERELEASELOOSE] + ')?' + src[BUILD] + '?' + ')?)?'; var XRANGE = R++; src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; var XRANGELOOSE = R++; src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; // Coercion. // Extract anything that could conceivably be a part of a valid semver var COERCE = R++; src[COERCE] = '(?:^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])'; // Tilde ranges. // Meaning is "reasonably at or greater than" var LONETILDE = R++; src[LONETILDE] = '(?:~>?)'; var TILDETRIM = R++; src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); var tildeTrimReplace = '$1~'; var TILDE = R++; src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; var TILDELOOSE = R++; src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; // Caret ranges. // Meaning is "at least and backwards compatible with" var LONECARET = R++; src[LONECARET] = '(?:\\^)'; var CARETTRIM = R++; src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); var caretTrimReplace = '$1^'; var CARET = R++; src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; var CARETLOOSE = R++; src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; // A simple gt/lt/eq thing, or just "" to indicate "any version" var COMPARATORLOOSE = R++; src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; var COMPARATOR = R++; src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; // An expression to strip any whitespace between the gtlt and the thing // it modifies, so that `> 1.2.3` ==> `>1.2.3` var COMPARATORTRIM = R++; src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; // this one has to use the /g flag re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); var comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` // Note that these all use the loose form, because they'll be // checked against either the strict or loose comparator form // later. var HYPHENRANGE = R++; src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAIN] + ')' + '\\s*$'; var HYPHENRANGELOOSE = R++; src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAINLOOSE] + ')' + '\\s*$'; // Star ranges basically just allow anything at all. var STAR = R++; src[STAR] = '(<|>)?=?\\s*\\*'; // Compile to actual regexp objects. // All are flag-free, unless they were created above with a flag. for (var i = 0; i < R; i++) { debug(i, src[i]); if (!re[i]) { re[i] = new RegExp(src[i]); } } exports.parse = parse; function parse(version, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } if (version instanceof SemVer) { return version; } if (typeof version !== 'string') { return null; } if (version.length > MAX_LENGTH) { return null; } var r = options.loose ? re[LOOSE] : re[FULL]; if (!r.test(version)) { return null; } try { return new SemVer(version, options); } catch (er) { return null; } } exports.valid = valid; function valid(version, options) { var v = parse(version, options); return v ? v.version : null; } exports.clean = clean; function clean(version, options) { var s = parse(version.trim().replace(/^[=v]+/, ''), options); return s ? s.version : null; } exports.SemVer = SemVer; function SemVer(version, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } if (version instanceof SemVer) { if (version.loose === options.loose) { return version; } else { version = version.version; } } else if (typeof version !== 'string') { throw new TypeError('Invalid Version: ' + version); } if (version.length > MAX_LENGTH) { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') } if (!(this instanceof SemVer)) { return new SemVer(version, options); } debug('SemVer', version, options); this.options = options; this.loose = !!options.loose; var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]); if (!m) { throw new TypeError('Invalid Version: ' + version); } this.raw = version; // these are actually numbers this.major = +m[1]; this.minor = +m[2]; this.patch = +m[3]; if (this.major > MAX_SAFE_INTEGER || this.major < 0) { throw new TypeError('Invalid major version') } if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { throw new TypeError('Invalid minor version') } if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { throw new TypeError('Invalid patch version') } // numberify any prerelease numeric ids if (!m[4]) { this.prerelease = []; } else { this.prerelease = m[4].split('.').map(function(id) { if (/^[0-9]+$/.test(id)) { var num = +id; if (num >= 0 && num < MAX_SAFE_INTEGER) { return num; } } return id; }); } this.build = m[5] ? m[5].split('.') : []; this.format(); } SemVer.prototype.format = function() { this.version = this.major + '.' + this.minor + '.' + this.patch; if (this.prerelease.length) { this.version += '-' + this.prerelease.join('.'); } return this.version; }; SemVer.prototype.toString = function() { return this.version; }; SemVer.prototype.compare = function(other) { debug('SemVer.compare', this.version, this.options, other); if (!(other instanceof SemVer)) { other = new SemVer(other, this.options); } return this.compareMain(other) || this.comparePre(other); }; SemVer.prototype.compareMain = function(other) { if (!(other instanceof SemVer)) { other = new SemVer(other, this.options); } return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); }; SemVer.prototype.comparePre = function(other) { var this$1 = this; if (!(other instanceof SemVer)) { other = new SemVer(other, this.options); } // NOT having a prerelease is > having one if (this.prerelease.length && !other.prerelease.length) { return -1; } else if (!this.prerelease.length && other.prerelease.length) { return 1; } else if (!this.prerelease.length && !other.prerelease.length) { return 0; } var i = 0; do { var a = this$1.prerelease[i]; var b = other.prerelease[i]; debug('prerelease compare', i, a, b); if (a === undefined && b === undefined) { return 0; } else if (b === undefined) { return 1; } else if (a === undefined) { return -1; } else if (a === b) { continue; } else { return compareIdentifiers(a, b); } } while (++i); }; // preminor will bump the version up to the next minor release, and immediately // down to pre-release. premajor and prepatch work the same way. SemVer.prototype.inc = function(release, identifier) { var this$1 = this; switch (release) { case 'premajor': this.prerelease.length = 0; this.patch = 0; this.minor = 0; this.major++; this.inc('pre', identifier); break; case 'preminor': this.prerelease.length = 0; this.patch = 0; this.minor++; this.inc('pre', identifier); break; case 'prepatch': // If this is already a prerelease, it will bump to the next version // drop any prereleases that might already exist, since they are not // relevant at this point. this.prerelease.length = 0; this.inc('patch', identifier); this.inc('pre', identifier); break; // If the input is a non-prerelease version, this acts the same as // prepatch. case 'prerelease': if (this.prerelease.length === 0) { this.inc('patch', identifier); } this.inc('pre', identifier); break; case 'major': // If this is a pre-major version, bump up to the same major version. // Otherwise increment major. // 1.0.0-5 bumps to 1.0.0 // 1.1.0 bumps to 2.0.0 if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { this.major++; } this.minor = 0; this.patch = 0; this.prerelease = []; break; case 'minor': // If this is a pre-minor version, bump up to the same minor version. // Otherwise increment minor. // 1.2.0-5 bumps to 1.2.0 // 1.2.1 bumps to 1.3.0 if (this.patch !== 0 || this.prerelease.length === 0) { this.minor++; } this.patch = 0; this.prerelease = []; break; case 'patch': // If this is not a pre-release version, it will increment the patch. // If it is a pre-release it will bump up to the same patch version. // 1.2.0-5 patches to 1.2.0 // 1.2.0 patches to 1.2.1 if (this.prerelease.length === 0) { this.patch++; } this.prerelease = []; break; // This probably shouldn't be used publicly. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. case 'pre': if (this.prerelease.length === 0) { this.prerelease = [0]; } else { var i = this.prerelease.length; while (--i >= 0) { if (typeof this$1.prerelease[i] === 'number') { this$1.prerelease[i]++; i = -2; } } if (i === -1) // didn't increment anything { this.prerelease.push(0); } } if (identifier) { // 1.2.0-beta.1 bumps to 1.2.0-beta.2, // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 if (this.prerelease[0] === identifier) { if (isNaN(this.prerelease[1])) { this.prerelease = [identifier, 0]; } } else { this.prerelease = [identifier, 0]; } } break; default: throw new Error('invalid increment argument: ' + release); } this.format(); this.raw = this.version; return this; }; exports.inc = inc; function inc(version, release, loose, identifier) { if (typeof(loose) === 'string') { identifier = loose; loose = undefined; } try { return new SemVer(version, loose).inc(release, identifier).version; } catch (er) { return null; } } exports.diff = diff; function diff(version1, version2) { if (eq(version1, version2)) { return null; } else { var v1 = parse(version1); var v2 = parse(version2); if (v1.prerelease.length || v2.prerelease.length) { for (var key in v1) { if (key === 'major' || key === 'minor' || key === 'patch') { if (v1[key] !== v2[key]) { return 'pre'+key; } } } return 'prerelease'; } for (var key in v1) { if (key === 'major' || key === 'minor' || key === 'patch') { if (v1[key] !== v2[key]) { return key; } } } } } exports.compareIdentifiers = compareIdentifiers; var numeric = /^[0-9]+$/; function compareIdentifiers(a, b) { var anum = numeric.test(a); var bnum = numeric.test(b); if (anum && bnum) { a = +a; b = +b; } return (anum && !bnum) ? -1 : (bnum && !anum) ? 1 : a < b ? -1 : a > b ? 1 : 0; } exports.rcompareIdentifiers = rcompareIdentifiers; function rcompareIdentifiers(a, b) { return compareIdentifiers(b, a); } exports.major = major; function major(a, loose) { return new SemVer(a, loose).major; } exports.minor = minor; function minor(a, loose) { return new SemVer(a, loose).minor; } exports.patch = patch; function patch(a, loose) { return new SemVer(a, loose).patch; } exports.compare = compare; function compare(a, b, loose) { return new SemVer(a, loose).compare(new SemVer(b, loose)); } exports.compareLoose = compareLoose; function compareLoose(a, b) { return compare(a, b, true); } exports.rcompare = rcompare; function rcompare(a, b, loose) { return compare(b, a, loose); } exports.sort = sort; function sort(list, loose) { return list.sort(function(a, b) { return exports.compare(a, b, loose); }); } exports.rsort = rsort; function rsort(list, loose) { return list.sort(function(a, b) { return exports.rcompare(a, b, loose); }); } exports.gt = gt; function gt(a, b, loose) { return compare(a, b, loose) > 0; } exports.lt = lt; function lt(a, b, loose) { return compare(a, b, loose) < 0; } exports.eq = eq; function eq(a, b, loose) { return compare(a, b, loose) === 0; } exports.neq = neq; function neq(a, b, loose) { return compare(a, b, loose) !== 0; } exports.gte = gte; function gte(a, b, loose) { return compare(a, b, loose) >= 0; } exports.lte = lte; function lte(a, b, loose) { return compare(a, b, loose) <= 0; } exports.cmp = cmp; function cmp(a, op, b, loose) { var ret; switch (op) { case '===': if (typeof a === 'object') { a = a.version; } if (typeof b === 'object') { b = b.version; } ret = a === b; break; case '!==': if (typeof a === 'object') { a = a.version; } if (typeof b === 'object') { b = b.version; } ret = a !== b; break; case '': case '=': case '==': ret = eq(a, b, loose); break; case '!=': ret = neq(a, b, loose); break; case '>': ret = gt(a, b, loose); break; case '>=': ret = gte(a, b, loose); break; case '<': ret = lt(a, b, loose); break; case '<=': ret = lte(a, b, loose); break; default: throw new TypeError('Invalid operator: ' + op); } return ret; } exports.Comparator = Comparator; function Comparator(comp, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } if (comp instanceof Comparator) { if (comp.loose === !!options.loose) { return comp; } else { comp = comp.value; } } if (!(this instanceof Comparator)) { return new Comparator(comp, options); } debug('comparator', comp, options); this.options = options; this.loose = !!options.loose; this.parse(comp); if (this.semver === ANY) { this.value = ''; } else { this.value = this.operator + this.semver.version; } debug('comp', this); } var ANY = {}; Comparator.prototype.parse = function(comp) { var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; var m = comp.match(r); if (!m) { throw new TypeError('Invalid comparator: ' + comp); } this.operator = m[1]; if (this.operator === '=') { this.operator = ''; } // if it literally is just '>' or '' then allow anything. if (!m[2]) { this.semver = ANY; } else { this.semver = new SemVer(m[2], this.options.loose); } }; Comparator.prototype.toString = function() { return this.value; }; Comparator.prototype.test = function(version) { debug('Comparator.test', version, this.options.loose); if (this.semver === ANY) { return true; } if (typeof version === 'string') { version = new SemVer(version, this.options); } return cmp(version, this.operator, this.semver, this.options); }; Comparator.prototype.intersects = function(comp, options) { if (!(comp instanceof Comparator)) { throw new TypeError('a Comparator is required'); } if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } var rangeTmp; if (this.operator === '') { rangeTmp = new Range(comp.value, options); return satisfies(this.value, rangeTmp, options); } else if (comp.operator === '') { rangeTmp = new Range(this.value, options); return satisfies(comp.semver, rangeTmp, options); } var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>'); var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<'); var sameSemVer = this.semver.version === comp.semver.version; var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<='); var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && ((this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<')); var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && ((this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>')); return sameDirectionIncreasing || sameDirectionDecreasing || (sameSemVer && differentDirectionsInclusive) || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; }; exports.Range = Range; function Range(range, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } if (range instanceof Range) { if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { return range; } else { return new Range(range.raw, options); } } if (range instanceof Comparator) { return new Range(range.value, options); } if (!(this instanceof Range)) { return new Range(range, options); } this.options = options; this.loose = !!options.loose; this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or || this.raw = range; this.set = range.split(/\s*\|\|\s*/).map(function(range) { return this.parseRange(range.trim()); }, this).filter(function(c) { // throw out any that are not relevant for whatever reason return c.length; }); if (!this.set.length) { throw new TypeError('Invalid SemVer Range: ' + range); } this.format(); } Range.prototype.format = function() { this.range = this.set.map(function(comps) { return comps.join(' ').trim(); }).join('||').trim(); return this.range; }; Range.prototype.toString = function() { return this.range; }; Range.prototype.parseRange = function(range) { var loose = this.options.loose; range = range.trim(); // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; range = range.replace(hr, hyphenReplace); debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); debug('comparator trim', range, re[COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3` range = range.replace(re[TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3` range = range.replace(re[CARETTRIM], caretTrimReplace); // normalize spaces range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and // ready to be split into comparators. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; var set = range.split(' ').map(function(comp) { return parseComparator(comp, this.options); }, this).join(' ').split(/\s+/); if (this.options.loose) { // in loose mode, throw out any that are not valid comparators set = set.filter(function(comp) { return !!comp.match(compRe); }); } set = set.map(function(comp) { return new Comparator(comp, this.options); }, this); return set; }; Range.prototype.intersects = function(range, options) { if (!(range instanceof Range)) { throw new TypeError('a Range is required'); } return this.set.some(function(thisComparators) { return thisComparators.every(function(thisComparator) { return range.set.some(function(rangeComparators) { return rangeComparators.every(function(rangeComparator) { return thisComparator.intersects(rangeComparator, options); }); }); }); }); }; // Mostly just for testing and legacy API reasons exports.toComparators = toComparators; function toComparators(range, options) { return new Range(range, options).set.map(function(comp) { return comp.map(function(c) { return c.value; }).join(' ').trim().split(' '); }); } // comprised of xranges, tildes, stars, and gtlt's at this point. // already replaced the hyphen ranges // turn into a set of JUST comparators. function parseComparator(comp, options) { debug('comp', comp, options); comp = replaceCarets(comp, options); debug('caret', comp); comp = replaceTildes(comp, options); debug('tildes', comp); comp = replaceXRanges(comp, options); debug('xrange', comp); comp = replaceStars(comp, options); debug('stars', comp); return comp; } function isX(id) { return !id || id.toLowerCase() === 'x' || id === '*'; } // ~, ~> --> * (any, kinda silly) // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 function replaceTildes(comp, options) { return comp.trim().split(/\s+/).map(function(comp) { return replaceTilde(comp, options); }).join(' '); } function replaceTilde(comp, options) { if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } var r = options.loose ? re[TILDELOOSE] : re[TILDE]; return comp.replace(r, function(_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr); var ret; if (isX(M)) { ret = ''; } else if (isX(m)) { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; } else if (isX(p)) // ~1.2 == >=1.2.0 <1.3.0 { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; } else if (pr) { debug('replaceTilde pr', pr); if (pr.charAt(0) !== '-') { pr = '-' + pr; } ret = '>=' + M + '.' + m + '.' + p + pr + ' <' + M + '.' + (+m + 1) + '.0'; } else // ~1.2.3 == >=1.2.3 <1.3.0 { ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; } debug('tilde return', ret); return ret; }); } // ^ --> * (any, kinda silly) // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 // ^1.2.3 --> >=1.2.3 <2.0.0 // ^1.2.0 --> >=1.2.0 <2.0.0 function replaceCarets(comp, options) { return comp.trim().split(/\s+/).map(function(comp) { return replaceCaret(comp, options); }).join(' '); } function replaceCaret(comp, options) { debug('caret', comp, options); if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } var r = options.loose ? re[CARETLOOSE] : re[CARET]; return comp.replace(r, function(_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr); var ret; if (isX(M)) { ret = ''; } else if (isX(m)) { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; } else if (isX(p)) { if (M === '0') { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; } else { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; } } else if (pr) { debug('replaceCaret pr', pr); if (pr.charAt(0) !== '-') { pr = '-' + pr; } if (M === '0') { if (m === '0') { ret = '>=' + M + '.' + m + '.' + p + pr + ' <' + M + '.' + m + '.' + (+p + 1); } else { ret = '>=' + M + '.' + m + '.' + p + pr + ' <' + M + '.' + (+m + 1) + '.0'; } } else { ret = '>=' + M + '.' + m + '.' + p + pr + ' <' + (+M + 1) + '.0.0'; } } else { debug('no pr'); if (M === '0') { if (m === '0') { ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1); } else { ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; } } else { ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0'; } } debug('caret return', ret); return ret; }); } function replaceXRanges(comp, options) { debug('replaceXRanges', comp, options); return comp.split(/\s+/).map(function(comp) { return replaceXRange(comp, options); }).join(' '); } function replaceXRange(comp, options) { comp = comp.trim(); if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]; return comp.replace(r, function(ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr); var xM = isX(M); var xm = xM || isX(m); var xp = xm || isX(p); var anyX = xp; if (gtlt === '=' && anyX) { gtlt = ''; } if (xM) { if (gtlt === '>' || gtlt === '<') { // nothing is allowed ret = '<0.0.0'; } else { // nothing is forbidden ret = '*'; } } else if (gtlt && anyX) { // replace X with 0 if (xm) { m = 0; } if (xp) { p = 0; } if (gtlt === '>') { // >1 => >=2.0.0 // >1.2 => >=1.3.0 // >1.2.3 => >= 1.2.4 gtlt = '>='; if (xm) { M = +M + 1; m = 0; p = 0; } else if (xp) { m = +m + 1; p = 0; } } else if (gtlt === '<=') { // <=0.7.x is actually <0.8.0, since any 0.7.x should // pass. Similarly, <=7.x is actually <8.0.0, etc. gtlt = '<'; if (xm) { M = +M + 1; } else { m = +m + 1; } } ret = gtlt + M + '.' + m + '.' + p; } else if (xm) { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; } else if (xp) { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; } debug('xRange return', ret); return ret; }); } // Because * is AND-ed with everything else in the comparator, // and '' means "any version", just remove the *s entirely. function replaceStars(comp, options) { debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets! return comp.trim().replace(re[STAR], ''); } // This function is passed to string.replace(re[HYPHENRANGE]) // M, m, patch, prerelease, build // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do // 1.2 - 3.4 => >=1.2.0 <3.5.0 function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) { if (isX(fM)) { from = ''; } else if (isX(fm)) { from = '>=' + fM + '.0.0'; } else if (isX(fp)) { from = '>=' + fM + '.' + fm + '.0'; } else { from = '>=' + from; } if (isX(tM)) { to = ''; } else if (isX(tm)) { to = '<' + (+tM + 1) + '.0.0'; } else if (isX(tp)) { to = '<' + tM + '.' + (+tm + 1) + '.0'; } else if (tpr) { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; } else { to = '<=' + to; } return (from + ' ' + to).trim(); } // if ANY of the sets match ALL of its comparators, then pass Range.prototype.test = function(version) { var this$1 = this; if (!version) { return false; } if (typeof version === 'string') { version = new SemVer(version, this.options); } for (var i = 0; i < this.set.length; i++) { if (testSet(this$1.set[i], version, this$1.options)) { return true; } } return false; }; function testSet(set, version, options) { for (var i = 0; i < set.length; i++) { if (!set[i].test(version)) { return false; } } if (!options) { options = {}; } if (version.prerelease.length && !options.includePrerelease) { // Find the set of versions that are allowed to have prereleases // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 // That should allow `1.2.3-pr.2` to pass. // However, `1.2.4-alpha.notready` should NOT be allowed, // even though it's within the range set by the comparators. for (var i = 0; i < set.length; i++) { debug(set[i].semver); if (set[i].semver === ANY) { continue; } if (set[i].semver.prerelease.length > 0) { var allowed = set[i].semver; if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { return true; } } } // Version has a -pre, but it's not one of the ones we like. return false; } return true; } exports.satisfies = satisfies; function satisfies(version, range, options) { try { range = new Range(range, options); } catch (er) { return false; } return range.test(version); } exports.maxSatisfying = maxSatisfying; function maxSatisfying(versions, range, options) { var max = null; var maxSV = null; try { var rangeObj = new Range(range, options); } catch (er) { return null; } versions.forEach(function (v) { if (rangeObj.test(v)) { // satisfies(v, range, options) if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) max = v; maxSV = new SemVer(max, options); } } }); return max; } exports.minSatisfying = minSatisfying; function minSatisfying(versions, range, options) { var min = null; var minSV = null; try { var rangeObj = new Range(range, options); } catch (er) { return null; } versions.forEach(function (v) { if (rangeObj.test(v)) { // satisfies(v, range, options) if (!min || minSV.compare(v) === 1) { // compare(min, v, true) min = v; minSV = new SemVer(min, options); } } }); return min; } exports.validRange = validRange; function validRange(range, options) { try { // Return '*' instead of '' so that truthiness works. // This will throw if it's invalid anyway return new Range(range, options).range || '*'; } catch (er) { return null; } } // Determine if version is less than all the versions possible in the range exports.ltr = ltr; function ltr(version, range, options) { return outside(version, range, '<', options); } // Determine if version is greater than all the versions possible in the range. exports.gtr = gtr; function gtr(version, range, options) { return outside(version, range, '>', options); } exports.outside = outside; function outside(version, range, hilo, options) { version = new SemVer(version, options); range = new Range(range, options); var gtfn, ltefn, ltfn, comp, ecomp; switch (hilo) { case '>': gtfn = gt; ltefn = lte; ltfn = lt; comp = '>'; ecomp = '>='; break; case '<': gtfn = lt; ltefn = gte; ltfn = gt; comp = '<'; ecomp = '<='; break; default: throw new TypeError('Must provide a hilo val of "<" or ">"'); } // If it satisifes the range it is not outside if (satisfies(version, range, options)) { return false; } // From now on, variable terms are as if we're in "gtr" mode. // but note that everything is flipped for the "ltr" function. for (var i = 0; i < range.set.length; ++i) { var comparators = range.set[i]; var high = null; var low = null; comparators.forEach(function(comparator) { if (comparator.semver === ANY) { comparator = new Comparator('>=0.0.0'); } high = high || comparator; low = low || comparator; if (gtfn(comparator.semver, high.semver, options)) { high = comparator; } else if (ltfn(comparator.semver, low.semver, options)) { low = comparator; } }); // If the edge version comparator has a operator then our version // isn't outside it if (high.operator === comp || high.operator === ecomp) { return false; } // If the lowest version comparator has an operator and our version // is less than it then it isn't higher than the range if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { return false; } else if (low.operator === ecomp && ltfn(version, low.semver)) { return false; } } return true; } exports.prerelease = prerelease; function prerelease(version, options) { var parsed = parse(version, options); return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; } exports.intersects = intersects; function intersects(r1, r2, options) { r1 = new Range(r1, options); r2 = new Range(r2, options); return r1.intersects(r2) } exports.coerce = coerce; function coerce(version) { if (version instanceof SemVer) { return version; } if (typeof version !== 'string') { return null; } var match = version.match(re[COERCE]); if (match == null) { return null; } return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0')); } }); var semver_1 = semver.SEMVER_SPEC_VERSION; var semver_2 = semver.re; var semver_3 = semver.src; var semver_4 = semver.parse; var semver_5 = semver.valid; var semver_6 = semver.clean; var semver_7 = semver.SemVer; var semver_8 = semver.inc; var semver_9 = semver.diff; var semver_10 = semver.compareIdentifiers; var semver_11 = semver.rcompareIdentifiers; var semver_12 = semver.major; var semver_13 = semver.minor; var semver_14 = semver.patch; var semver_15 = semver.compare; var semver_16 = semver.compareLoose; var semver_17 = semver.rcompare; var semver_18 = semver.sort; var semver_19 = semver.rsort; var semver_20 = semver.gt; var semver_21 = semver.lt; var semver_22 = semver.eq; var semver_23 = semver.neq; var semver_24 = semver.gte; var semver_25 = semver.lte; var semver_26 = semver.cmp; var semver_27 = semver.Comparator; var semver_28 = semver.Range; var semver_29 = semver.toComparators; var semver_30 = semver.satisfies; var semver_31 = semver.maxSatisfying; var semver_32 = semver.minSatisfying; var semver_33 = semver.validRange; var semver_34 = semver.ltr; var semver_35 = semver.gtr; var semver_36 = semver.outside; var semver_37 = semver.prerelease; var semver_38 = semver.intersects; var semver_39 = semver.coerce; // function throwError(msg) { throw new Error(("[vue-test-utils]: " + msg)) } function warn(msg) { console.error(("[vue-test-utils]: " + msg)); } var camelizeRE = /-(\w)/g; var camelize = function (str) { var camelizedStr = str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; } ); return camelizedStr.charAt(0).toLowerCase() + camelizedStr.slice(1) }; /** * Capitalize a string. */ var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.slice(1); }; /** * Hyphenate a camelCase string. */ var hyphenateRE = /\B([A-Z])/g; var hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); }; function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop) } function resolveComponent(id, components) { if (typeof id !== 'string') { return } // check local registration variations first if (hasOwnProperty(components, id)) { return components[id] } var camelizedId = camelize(id); if (hasOwnProperty(components, camelizedId)) { return components[camelizedId] } var PascalCaseId = capitalize(camelizedId); if (hasOwnProperty(components, PascalCaseId)) { return components[PascalCaseId] } // fallback to prototype chain return components[id] || components[camelizedId] || components[PascalCaseId] } var UA = typeof window !== 'undefined' && 'navigator' in window && navigator.userAgent.toLowerCase(); var isPhantomJS = UA && UA.includes && UA.match(/phantomjs/i); var isEdge = UA && UA.indexOf('edge/') > 0; var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; // get the event used to trigger v-model handler that updates bound data function getCheckedEvent() { var version = Vue.version; if (semver.satisfies(version, '2.1.9 - 2.1.10')) { return 'click' } if (semver.satisfies(version, '2.2 - 2.4')) { return isChrome ? 'click' : 'change' } // change is handler for version 2.0 - 2.1.8, and 2.5+ return 'change' } // function isDomSelector(selector) { if (typeof selector !== 'string') { return false } try { if (typeof document === 'undefined') { throwError( "mount must be run in a browser environment like " + "PhantomJS, jsdom or chrome" ); } } catch (error) { throwError( "mount must be run in a browser environment like " + "PhantomJS, jsdom or chrome" ); } try { document.querySelector(selector); return true } catch (error) { return false } } function isVueComponent(c) { if (isConstructor(c)) { return true } if (c === null || typeof c !== 'object') { return false } if (c.extends || c._Ctor) { return true } if (typeof c.template === 'string') { return true } return typeof c.render === 'function' } function componentNeedsCompiling(component) { return ( component && !component.render && (component.template || component.extends || component.extendOptions) && !component.functional ) } function isRefSelector(refOptionsObject) { if ( typeof refOptionsObject !== 'object' || Object.keys(refOptionsObject || {}).length !== 1 ) { return false } return typeof refOptionsObject.ref === 'string' } function isNameSelector(nameOptionsObject) { if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) { return false } return !!nameOptionsObject.name } function isConstructor(c) { return typeof c === 'function' && c.cid } function isDynamicComponent(c) { return typeof c === 'function' && !c.cid } function isComponentOptions(c) { return typeof c === 'object' && (c.template || c.render) } function isFunctionalComponent(c) { if (!isVueComponent(c)) { return false } if (isConstructor(c)) { return c.options.functional } return c.functional } function templateContainsComponent( template, name ) { return [capitalize, camelize, hyphenate].some(function (format) { var re = new RegExp(("<" + (format(name)) + "\\s*(\\s|>|(/>))"), 'g'); return re.test(template) }) } function isPlainObject(c) { return Object.prototype.toString.call(c) === '[object Object]' } function makeMap(str, expectsLowerCase) { var map = Object.create(null); var list = str.split(','); for (var i = 0; i < list.length; i++) { map[list[i]] = true; } return expectsLowerCase ? function(val) { return map[val.toLowerCase()] } : function(val) { return map[val] } } var isHTMLTag = makeMap( 'html,body,base,head,link,meta,style,title,' + 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,' + 'embed,object,param,source,canvas,script,noscript,del,ins,' + 'caption,col,colgroup,table,thead,tbody,td,th,tr,video,' + 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 'output,progress,select,textarea,' + 'details,dialog,menu,menuitem,summary,' + 'content,element,shadow,template,blockquote,iframe,tfoot' ); // this map is intentionally selective, only covering SVG elements that may // contain child elements. var isSVG = makeMap( 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true ); var isReservedTag = function (tag) { return isHTMLTag(tag) || isSVG(tag); }; var NAME_SELECTOR = 'NAME_SELECTOR'; var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR'; var REF_SELECTOR = 'REF_SELECTOR'; var DOM_SELECTOR = 'DOM_SELECTOR'; var INVALID_SELECTOR = 'INVALID_SELECTOR'; var COMPAT_SYNC_MODE = 'COMPAT_SYNC_MODE'; var VUE_VERSION = Number( ((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1])) ); var FUNCTIONAL_OPTIONS = VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions'; var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8') ? 'beforeCreate' : 'beforeMount'; var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5') ? '_c' : '_h'; // function getSelectorType(selector) { if (isDomSelector(selector)) { return DOM_SELECTOR } if (isVueComponent(selector)) { return COMPONENT_SELECTOR } if (isNameSelector(selector)) { return NAME_SELECTOR } if (isRefSelector(selector)) { return REF_SELECTOR } return INVALID_SELECTOR } function getSelector( selector, methodName ) { var type = getSelectorType(selector); if (type === INVALID_SELECTOR) { throwError( "wrapper." + methodName + "() must be passed a valid CSS selector, Vue " + "constructor, or valid find option object" ); } return { type: type, value: selector } } // function getRealChild(vnode) { var compOptions = vnode && vnode.componentOptions; if (compOptions && compOptions.Ctor.options.abstract) { return getRealChild(getFirstComponentChild(compOptions.children)) } else { return vnode } } function isSameChild(child, oldChild) { return oldChild.key === child.key && oldChild.tag === child.tag } function getFirstComponentChild(children) { if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { var c = children[i]; if (c && (c.componentOptions || isAsyncPlaceholder(c))) { return c } } } } function isPrimitive(value) { return ( typeof value === 'string' || typeof value === 'number' || // $FlowIgnore typeof value === 'symbol' || typeof value === 'boolean' ) } function isAsyncPlaceholder(node) { return node.isComment && node.asyncFactory } function hasParentTransition(vnode) { while ((vnode = vnode.parent)) { if (vnode.data.transition) { return true } } } var TransitionStub = { render: function render(h) { var children = this.$options._renderChildren; if (!children) { return } // filter out text nodes (possible whitespaces) children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); }); /* istanbul ignore if */ if (!children.length) { return } // warn multiple elements if (children.length > 1) { warn( " can only be used on a single element. " + "Use " + ' for lists.' ); } var mode = this.mode; // warn invalid mode if (mode && mode !== 'in-out' && mode !== 'out-in') { warn('invalid mode: ' + mode); } var rawChild = children[0]; // if this is a component root node and the component's // parent container node also has transition, skip. if (hasParentTransition(this.$vnode)) { return rawChild } // apply transition data to child // use getRealChild() to ignore abstract components e.g. keep-alive var child = getRealChild(rawChild); if (!child) { return rawChild } var id = "__transition-" + (this._uid) + "-"; child.key = child.key == null ? child.isComment ? id + 'comment' : id + child.tag : isPrimitive(child.key) ? String(child.key).indexOf(id) === 0 ? child.key : id + child.key : child.key; var data = child.data || (child.data = {}); var oldRawChild = this._vnode; var oldChild = getRealChild(oldRawChild); if ( child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; }) ) { child.data.show = true; } // mark v-show // so that the transition module can hand over the control // to the directive if ( child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; }) ) { child.data.show = true; } if ( oldChild && oldChild.data && !isSameChild(child, oldChild) && !isAsyncPlaceholder(oldChild) && // #6687 component root is a comment node !( oldChild.componentInstance && oldChild.componentInstance._vnode.isComment ) ) { oldChild.data = Object.assign({}, data); } return rawChild } } // var TransitionGroupStub = { render: function render(h) { var tag = this.tag || this.$vnode.data.tag || 'span'; var children = this.$slots.default || []; return h(tag, null, children) } } var config = { stubs: { transition: TransitionStub, 'transition-group': TransitionGroupStub }, mocks: {}, methods: {}, provide: {}, logModifiedComponents: true, silent: true } // var WrapperArray = function WrapperArray(wrappers) { var length = wrappers.length; // $FlowIgnore Object.defineProperty(this, 'wrappers', { get: function () { return wrappers; }, set: function () { return throwError('wrapperArray.wrappers is read-only'); } }); // $FlowIgnore Object.defineProperty(this, 'length', { get: function () { return length; }, set: function () { return throwError('wrapperArray.length is read-only'); } }); }; WrapperArray.prototype.at = function at (index) { if (index > this.length - 1) { throwError(("no item exists at " + index)); } return this.wrappers[index] }; WrapperArray.prototype.attributes = function attributes () { this.throwErrorIfWrappersIsEmpty('attributes'); throwError( "attributes must be called on a single wrapper, use " + "at(i) to access a wrapper" ); }; WrapperArray.prototype.classes = function classes () { this.throwErrorIfWrappersIsEmpty('classes'); throwError( "classes must be called on a single wrapper, use " + "at(i) to access a wrapper" ); }; WrapperArray.prototype.contains = function contains (selector) { this.throwErrorIfWrappersIsEmpty('contains'); return this.wrappers.every(function (wrapper) { return wrapper.contains(selector); }) }; WrapperArray.prototype.exists = function exists () { return this.length > 0 && this.wrappers.every(function (wrapper) { return wrapper.exists(); }) }; WrapperArray.prototype.filter = function filter (predicate) { return new WrapperArray(this.wrappers.filter(predicate)) }; WrapperArray.prototype.emitted = function emitted () { this.throwErrorIfWrappersIsEmpty('emitted'); throwError( "emitted must be called on a single wrapper, use " + "at(i) to access a wrapper" ); }; WrapperArray.prototype.emittedByOrder = function emittedByOrder () { this.throwErrorIfWrappersIsEmpty('emittedByOrder'); throwError( "emittedByOrder must be called on a single wrapper, " + "use at(i) to access a wrapper" ); }; WrapperArray.prototype.findAll = function findAll () { this.throwErrorIfWrappersIsEmpty('findAll'); throwError( "findAll must be called on a single wrapper, use " + "at(i) to access a wrapper" ); }; WrapperArray.prototype.find = function find () { this.throwErrorIfWrappersIsEmpty('find'); throwError( "find must be called on a single wrapper, use at(i) " + "to access a wrapper" ); }; WrapperArray.prototype.html = function html () { this.throwErrorIfWrappersIsEmpty('html'); throwError( "html must be called on a single wrapper, use at(i) " + "to access a wrapper" ); }; WrapperArray.prototype.is = function is (selector) { this.throwErrorIfWrappersIsEmpty('is'); return this.wrappers.every(function (wrapper) { return wrapper.is(selector); }) }; WrapperArray.prototype.isEmpty = function isEmpty () { this.throwErrorIfWrappersIsEmpty('isEmpty'); return this.wrappers.every(function (wrapper) { return wrapper.isEmpty(); }) }; WrapperArray.prototype.isVisible = function isVisible () { this.throwErrorIfWrappersIsEmpty('isVisible'); return this.wrappers.every(function (wrapper) { return wrapper.isVisible(); }) }; WrapperArray.prototype.isVueInstance = function isVueInstance () { this.throwErrorIfWrappersIsEmpty('isVueInstance'); return this.wrappers.every(function (wrapper) { return wrapper.isVueInstance(); }) }; WrapperArray.prototype.name = function name () { this.throwErrorIfWrappersIsEmpty('name'); throwError( "name must be called on a single wrapper, use at(i) " + "to access a wrapper" ); }; WrapperArray.prototype.props = function props () { this.throwErrorIfWrappersIsEmpty('props'); throwError( "props must be called on a single wrapper, use " + "at(i) to access a wrapper" ); }; WrapperArray.prototype.text = function text () { this.throwErrorIfWrappersIsEmpty('text'); throwError( "text must be called on a single wrapper, use at(i) " + "to access a wrapper" ); }; WrapperArray.prototype.throwErrorIfWrappersIsEmpty = function throwErrorIfWrappersIsEmpty (method) { if (this.wrappers.length === 0) { throwError((method + " cannot be called on 0 items")); } }; WrapperArray.prototype.setData = function setData (data) { this.throwErrorIfWrappersIsEmpty('setData'); this.wrappers.forEach(function (wrapper) { return wrapper.setData(data); }); }; WrapperArray.prototype.setMethods = function setMethods (props) { this.throwErrorIfWrappersIsEmpty('setMethods'); this.wrappers.forEach(function (wrapper) { return wrapper.setMethods(props); }); }; WrapperArray.prototype.setProps = function setProps (props) { this.throwErrorIfWrappersIsEmpty('setProps'); this.wrappers.forEach(function (wrapper) { return wrapper.setProps(props); }); }; WrapperArray.prototype.setValue = function setValue (value) { this.throwErrorIfWrappersIsEmpty('setValue'); this.wrappers.forEach(function (wrapper) { return wrapper.setValue(value); }); }; WrapperArray.prototype.setChecked = function setChecked (checked) { if ( checked === void 0 ) checked = true; this.throwErrorIfWrappersIsEmpty('setChecked'); this.wrappers.forEach(function (wrapper) { return wrapper.setChecked(checked); }); }; WrapperArray.prototype.setSelected = function setSelected () { this.throwErrorIfWrappersIsEmpty('setSelected'); throwError( "setSelected must be called on a single wrapper, " + "use at(i) to access a wrapper" ); }; WrapperArray.prototype.trigger = function trigger (event, options) { this.throwErrorIfWrappersIsEmpty('trigger'); this.wrappers.forEach(function (wrapper) { return wrapper.trigger(event, options); }); }; WrapperArray.prototype.update = function update () { this.throwErrorIfWrappersIsEmpty('update'); warn( "update has been removed. All changes are now " + "synchrnous without calling update" ); }; WrapperArray.prototype.destroy = function destroy () { this.throwErrorIfWrappersIsEmpty('destroy'); this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); }); }; // var ErrorWrapper = function ErrorWrapper(selector) { this.selector = selector; }; ErrorWrapper.prototype.at = function at () { throwError( ("find did not return " + (this.selector) + ", cannot call at() on empty Wrapper") ); }; ErrorWrapper.prototype.attributes = function attributes () { throwError( ("find did not return " + (this.selector) + ", cannot call attributes() on empty Wrapper") ); }; ErrorWrapper.prototype.classes = function classes () { throwError( ("find did not return " + (this.selector) + ", cannot call classes() on empty Wrapper") ); }; ErrorWrapper.prototype.contains = function contains () { throwError( ("find did not return " + (this.selector) + ", cannot call contains() on empty Wrapper") ); }; ErrorWrapper.prototype.emitted = function emitted () { throwError( ("find did not return " + (this.selector) + ", cannot call emitted() on empty Wrapper") ); }; ErrorWrapper.prototype.emittedByOrder = function emittedByOrder () { throwError( ("find did not return " + (this.selector) + ", cannot call emittedByOrder() on empty Wrapper") ); }; ErrorWrapper.prototype.exists = function exists () { return false }; ErrorWrapper.prototype.filter = function filter () { throwError( ("find did not return " + (this.selector) + ", cannot call filter() on empty Wrapper") ); }; ErrorWrapper.prototype.visible = function visible () { throwError( ("find did not return " + (this.selector) + ", cannot call visible() on empty Wrapper") ); }; ErrorWrapper.prototype.hasAttribute = function hasAttribute () { throwError( ("find did not return " + (this.selector) + ", cannot call hasAttribute() on empty Wrapper") ); }; ErrorWrapper.prototype.hasClass = function hasClass () { throwError( ("find did not return " + (this.selector) + ", cannot call hasClass() on empty Wrapper") ); }; ErrorWrapper.prototype.hasProp = function hasProp () { throwError( ("find did not return " + (this.selector) + ", cannot call hasProp() on empty Wrapper") ); }; ErrorWrapper.prototype.hasStyle = function hasStyle () { throwError( ("find did not return " + (this.selector) + ", cannot call hasStyle() on empty Wrapper") ); }; ErrorWrapper.prototype.findAll = function findAll () { throwError( ("find did not return " + (this.selector) + ", cannot call findAll() on empty Wrapper") ); }; ErrorWrapper.prototype.find = function find () { throwError( ("find did not return " + (this.selector) + ", cannot call find() on empty Wrapper") ); }; ErrorWrapper.prototype.html = function html () { throwError( ("find did not return " + (this.selector) + ", cannot call html() on empty Wrapper") ); }; ErrorWrapper.prototype.is = function is () { throwError( ("find did not return " + (this.selector) + ", cannot call is() on empty Wrapper") ); }; ErrorWrapper.prototype.isEmpty = function isEmpty () { throwError( ("find did not return " + (this.selector) + ", cannot call isEmpty() on empty Wrapper") ); }; ErrorWrapper.prototype.isVisible = function isVisible () { throwError( ("find did not return " + (this.selector) + ", cannot call isVisible() on empty Wrapper") ); }; ErrorWrapper.prototype.isVueInstance = function isVueInstance () { throwError( ("find did not return " + (this.selector) + ", cannot call isVueInstance() on empty Wrapper") ); }; ErrorWrapper.prototype.name = function name () { throwError( ("find did not return " + (this.selector) + ", cannot call name() on empty Wrapper") ); }; ErrorWrapper.prototype.props = function props () { throwError( ("find did not return " + (this.selector) + ", cannot call props() on empty Wrapper") ); }; ErrorWrapper.prototype.text = function text () { throwError( ("find did not return " + (this.selector) + ", cannot call text() on empty Wrapper") ); }; ErrorWrapper.prototype.setComputed = function setComputed () { throwError( ("find did not return " + (this.selector) + ", cannot call setComputed() on empty Wrapper") ); }; ErrorWrapper.prototype.setData = function setData () { throwError( ("find did not return " + (this.selector) + ", cannot call setData() on empty Wrapper") ); }; ErrorWrapper.prototype.setMethods = function setMethods () { throwError( ("find did not return " + (this.selector) + ", cannot call setMethods() on empty Wrapper") ); }; ErrorWrapper.prototype.setProps = function setProps () { throwError( ("find did not return " + (this.selector) + ", cannot call setProps() on empty Wrapper") ); }; ErrorWrapper.prototype.setValue = function setValue () { throwError( ("find did not return " + (this.selector) + ", cannot call setValue() on empty Wrapper") ); }; ErrorWrapper.prototype.setChecked = function setChecked () { throwError( ("find did not return " + (this.selector) + ", cannot call setChecked() on empty Wrapper") ); }; ErrorWrapper.prototype.setSelected = function setSelected () { throwError( ("find did not return " + (this.selector) + ", cannot call setSelected() on empty Wrapper") ); }; ErrorWrapper.prototype.trigger = function trigger () { throwError( ("find did not return " + (this.selector) + ", cannot call trigger() on empty Wrapper") ); }; ErrorWrapper.prototype.update = function update () { throwError( "update has been removed from vue-test-utils." + "All updates are now synchronous by default" ); }; ErrorWrapper.prototype.destroy = function destroy () { throwError( ("find did not return " + (this.selector) + ", cannot call destroy() on empty Wrapper") ); }; // function findDOMNodes( element, selector ) { var nodes = []; if (!element || !element.querySelectorAll || !element.matches) { return nodes } if (element.matches(selector)) { nodes.push(element); } // $FlowIgnore return nodes.concat([].slice.call(element.querySelectorAll(selector))) } function vmMatchesName(vm, name) { return ( !!name && (vm.name === name || (vm.$options && vm.$options.name === name)) ) } function vmCtorMatches(vm, component) { if ( (vm.$options && vm.$options.$_vueTestUtils_original === component) || vm.$_vueTestUtils_original === component ) { return true } var Ctor = isConstructor(component) ? component.options._Ctor : component._Ctor; if (!Ctor) { return false } if (vm.constructor.extendOptions === component) { return true } if (component.functional) { return Object.keys(vm._Ctor || {}).some(function (c) { return component === vm._Ctor[c].extendOptions }) } } function matches(node, selector) { if (selector.type === DOM_SELECTOR) { var element = node instanceof Element ? node : node.elm; return element && element.matches && element.matches(selector.value) } var isFunctionalSelector = isConstructor(selector.value) ? selector.value.options.functional : selector.value.functional; var componentInstance = isFunctionalSelector ? node[FUNCTIONAL_OPTIONS] : node.child; if (!componentInstance) { return false } if (selector.type === COMPONENT_SELECTOR) { if (vmCtorMatches(componentInstance, selector.value)) { return true } } // Fallback to name selector for COMPONENT_SELECTOR for Vue < 2.1 var nameSelector = isConstructor(selector.value) ? selector.value.extendOptions.name : selector.value.name; return vmMatchesName(componentInstance, nameSelector) } // function findAllInstances(rootVm) { var instances = [rootVm]; var i = 0; while (i < instances.length) { var vm = instances[i] ;(vm.$children || []).forEach(function (child) { instances.push(child); }); i++; } return instances } function findAllVNodes(vnode, selector) { var matchingNodes = []; var nodes = [vnode]; while (nodes.length) { var node = nodes.shift(); if (node.children) { var children = [].concat( node.children ).reverse(); children.forEach(function (n) { nodes.unshift(n); }); } if (node.child) { nodes.unshift(node.child._vnode); } if (matches(node, selector)) { matchingNodes.push(node); } } return matchingNodes } function removeDuplicateNodes(vNodes) { var vNodeElms = vNodes.map(function (vNode) { return vNode.elm; }); return vNodes.filter(function (vNode, index) { return index === vNodeElms.indexOf(vNode.elm); }) } function find( root, vm, selector ) { if (root instanceof Element && selector.type !== DOM_SELECTOR) { throwError( "cannot find a Vue instance on a DOM node. The node " + "you are calling find on does not exist in the " + "VDom. Are you adding the node as innerHTML?" ); } if ( selector.type === COMPONENT_SELECTOR && (selector.value.functional || (selector.value.options && selector.value.options.functional)) && VUE_VERSION < 2.3 ) { throwError( "find for functional components is not supported " + "in Vue < 2.3" ); } if (root instanceof Element) { return findDOMNodes(root, selector.value) } if (!root && selector.type !== DOM_SELECTOR) { throwError( "cannot find a Vue instance on a DOM node. The node " + "you are calling find on does not exist in the " + "VDom. Are you adding the node as innerHTML?" ); } if (!vm && selector.type === REF_SELECTOR) { throwError("$ref selectors can only be used on Vue component " + "wrappers"); } if (vm && vm.$refs && selector.value.ref in vm.$refs) { var refs = vm.$refs[selector.value.ref]; return Array.isArray(refs) ? refs : [refs] } var nodes = findAllVNodes(root, selector); var dedupedNodes = removeDuplicateNodes(nodes); if (nodes.length > 0 || selector.type !== DOM_SELECTOR) { return dedupedNodes } // Fallback in case element exists in HTML, but not in vnode tree // (e.g. if innerHTML is set as a domProp) return findDOMNodes(root.elm, selector.value) } // function createWrapper( node, options ) { if ( options === void 0 ) options = {}; var componentInstance = node.child; if (componentInstance) { return new VueWrapper(componentInstance, options) } return node instanceof Vue ? new VueWrapper(node, options) : new Wrapper(node, options) } // var i = 0; function orderDeps(watcher) { watcher.deps.forEach(function (dep) { if (dep._sortedId === i) { return } dep._sortedId = i; dep.subs.forEach(orderDeps); dep.subs = dep.subs.sort(function (a, b) { return a.id - b.id; }); }); } function orderVmWatchers(vm) { if (vm._watchers) { vm._watchers.forEach(orderDeps); } if (vm._computedWatchers) { Object.keys(vm._computedWatchers).forEach(function (computedWatcher) { orderDeps(vm._computedWatchers[computedWatcher]); }); } vm._watcher && orderDeps(vm._watcher); vm.$children.forEach(orderVmWatchers); } function orderWatchers(vm) { orderVmWatchers(vm); i++; } function recursivelySetData(vm, target, data) { Object.keys(data).forEach(function (key) { var val = data[key]; var targetVal = target[key]; if (isPlainObject(val) && isPlainObject(targetVal)) { recursivelySetData(vm, targetVal, val); } else { vm.$set(target, key, val); } }); } var abort = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var afterprint = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var animationend = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false}; var animationiteration = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false}; var animationstart = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false}; var appinstalled = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var audioprocess = {"eventInterface":"AudioProcessingEvent"}; var audioend = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var audiostart = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var beforeprint = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var beforeunload = {"eventInterface":"BeforeUnloadEvent","bubbles":false,"cancelable":true}; var beginEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false}; var blur = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false}; var boundary = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false}; var cached = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var canplay = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var canplaythrough = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var change = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var chargingchange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var chargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var checking = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var click = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var close = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var complete = {"eventInterface":"OfflineAudioCompletionEvent"}; var compositionend = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true}; var compositionstart = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true}; var compositionupdate = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":false}; var contextmenu = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var copy = {"eventInterface":"ClipboardEvent"}; var cut = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true}; var dblclick = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var devicechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var devicelight = {"eventInterface":"DeviceLightEvent","bubbles":false,"cancelable":false}; var devicemotion = {"eventInterface":"DeviceMotionEvent","bubbles":false,"cancelable":false}; var deviceorientation = {"eventInterface":"DeviceOrientationEvent","bubbles":false,"cancelable":false}; var deviceproximity = {"eventInterface":"DeviceProximityEvent","bubbles":false,"cancelable":false}; var dischargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var DOMActivate = {"eventInterface":"UIEvent","bubbles":true,"cancelable":true}; var DOMAttributeNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true}; var DOMAttrModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true}; var DOMCharacterDataModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true}; var DOMContentLoaded = {"eventInterface":"Event","bubbles":true,"cancelable":true}; var DOMElementNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true}; var DOMFocusIn = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true}; var DOMFocusOut = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true}; var DOMNodeInserted = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true}; var DOMNodeInsertedIntoDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true}; var DOMNodeRemoved = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true}; var DOMNodeRemovedFromDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true}; var DOMSubtreeModified = {"eventInterface":"MutationEvent"}; var downloading = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var drag = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true}; var dragend = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false}; var dragenter = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true}; var dragleave = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false}; var dragover = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true}; var dragstart = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true}; var drop = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true}; var durationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var emptied = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var end = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var ended = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var endEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false}; var error = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var focus = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false}; var focusin = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false}; var focusout = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false}; var fullscreenchange = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var fullscreenerror = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var gamepadconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false}; var gamepaddisconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false}; var gotpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false}; var hashchange = {"eventInterface":"HashChangeEvent","bubbles":true,"cancelable":false}; var lostpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false}; var input = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var invalid = {"eventInterface":"Event","cancelable":true,"bubbles":false}; var keydown = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true}; var keypress = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true}; var keyup = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true}; var languagechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var levelchange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var load = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false}; var loadeddata = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var loadedmetadata = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var loadend = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false}; var loadstart = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false}; var mark = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false}; var message = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false}; var messageerror = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false}; var mousedown = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var mouseenter = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false}; var mouseleave = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false}; var mousemove = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var mouseout = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var mouseover = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var mouseup = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true}; var nomatch = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false}; var notificationclick = {"eventInterface":"NotificationEvent","bubbles":false,"cancelable":false}; var noupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var obsolete = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var offline = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var online = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var open = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var orientationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var pagehide = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false}; var pageshow = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false}; var paste = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true}; var pause = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false}; var pointercancel = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":false}; var pointerdown = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true}; var pointerenter = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false}; var pointerleave = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false}; var pointerlockchange = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var pointerlockerror = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var pointermove = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true}; var pointerout = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true}; var pointerover = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true}; var pointerup = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true}; var play = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var playing = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var popstate = {"eventInterface":"PopStateEvent","bubbles":true,"cancelable":false}; var progress = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false}; var push = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false}; var pushsubscriptionchange = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false}; var ratechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var readystatechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var repeatEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false}; var reset = {"eventInterface":"Event","bubbles":true,"cancelable":true}; var resize = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false}; var resourcetimingbufferfull = {"eventInterface":"Performance","bubbles":true,"cancelable":true}; var result = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false}; var resume = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false}; var scroll = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false}; var seeked = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var seeking = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var select = {"eventInterface":"UIEvent","bubbles":true,"cancelable":false}; var selectstart = {"eventInterface":"Event","bubbles":true,"cancelable":true}; var selectionchange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var show = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false}; var slotchange = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var soundend = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var soundstart = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var speechend = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var speechstart = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var stalled = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var start = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false}; var storage = {"eventInterface":"StorageEvent","bubbles":false,"cancelable":false}; var submit = {"eventInterface":"Event","bubbles":true,"cancelable":true}; var success = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var suspend = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var SVGAbort = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false}; var SVGError = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false}; var SVGLoad = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false}; var SVGResize = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false}; var SVGScroll = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false}; var SVGUnload = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false}; var SVGZoom = {"eventInterface":"SVGZoomEvent","bubbles":true,"cancelable":false}; var timeout = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false}; var timeupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var touchcancel = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":false}; var touchend = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true}; var touchmove = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true}; var touchstart = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true}; var transitionend = {"eventInterface":"TransitionEvent","bubbles":true,"cancelable":true}; var unload = {"eventInterface":"UIEvent","bubbles":false}; var updateready = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var userproximity = {"eventInterface":"UserProximityEvent","bubbles":false,"cancelable":false}; var voiceschanged = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var visibilitychange = {"eventInterface":"Event","bubbles":true,"cancelable":false}; var volumechange = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var waiting = {"eventInterface":"Event","bubbles":false,"cancelable":false}; var wheel = {"eventInterface":"WheelEvent","bubbles":true,"cancelable":true}; var domEventTypes = { abort: abort, afterprint: afterprint, animationend: animationend, animationiteration: animationiteration, animationstart: animationstart, appinstalled: appinstalled, audioprocess: audioprocess, audioend: audioend, audiostart: audiostart, beforeprint: beforeprint, beforeunload: beforeunload, beginEvent: beginEvent, blur: blur, boundary: boundary, cached: cached, canplay: canplay, canplaythrough: canplaythrough, change: change, chargingchange: chargingchange, chargingtimechange: chargingtimechange, checking: checking, click: click, close: close, complete: complete, compositionend: compositionend, compositionstart: compositionstart, compositionupdate: compositionupdate, contextmenu: contextmenu, copy: copy, cut: cut, dblclick: dblclick, devicechange: devicechange, devicelight: devicelight, devicemotion: devicemotion, deviceorientation: deviceorientation, deviceproximity: deviceproximity, dischargingtimechange: dischargingtimechange, DOMActivate: DOMActivate, DOMAttributeNameChanged: DOMAttributeNameChanged, DOMAttrModified: DOMAttrModified, DOMCharacterDataModified: DOMCharacterDataModified, DOMContentLoaded: DOMContentLoaded, DOMElementNameChanged: DOMElementNameChanged, DOMFocusIn: DOMFocusIn, DOMFocusOut: DOMFocusOut, DOMNodeInserted: DOMNodeInserted, DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument, DOMNodeRemoved: DOMNodeRemoved, DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument, DOMSubtreeModified: DOMSubtreeModified, downloading: downloading, drag: drag, dragend: dragend, dragenter: dragenter, dragleave: dragleave, dragover: dragover, dragstart: dragstart, drop: drop, durationchange: durationchange, emptied: emptied, end: end, ended: ended, endEvent: endEvent, error: error, focus: focus, focusin: focusin, focusout: focusout, fullscreenchange: fullscreenchange, fullscreenerror: fullscreenerror, gamepadconnected: gamepadconnected, gamepaddisconnected: gamepaddisconnected, gotpointercapture: gotpointercapture, hashchange: hashchange, lostpointercapture: lostpointercapture, input: input, invalid: invalid, keydown: keydown, keypress: keypress, keyup: keyup, languagechange: languagechange, levelchange: levelchange, load: load, loadeddata: loadeddata, loadedmetadata: loadedmetadata, loadend: loadend, loadstart: loadstart, mark: mark, message: message, messageerror: messageerror, mousedown: mousedown, mouseenter: mouseenter, mouseleave: mouseleave, mousemove: mousemove, mouseout: mouseout, mouseover: mouseover, mouseup: mouseup, nomatch: nomatch, notificationclick: notificationclick, noupdate: noupdate, obsolete: obsolete, offline: offline, online: online, open: open, orientationchange: orientationchange, pagehide: pagehide, pageshow: pageshow, paste: paste, pause: pause, pointercancel: pointercancel, pointerdown: pointerdown, pointerenter: pointerenter, pointerleave: pointerleave, pointerlockchange: pointerlockchange, pointerlockerror: pointerlockerror, pointermove: pointermove, pointerout: pointerout, pointerover: pointerover, pointerup: pointerup, play: play, playing: playing, popstate: popstate, progress: progress, push: push, pushsubscriptionchange: pushsubscriptionchange, ratechange: ratechange, readystatechange: readystatechange, repeatEvent: repeatEvent, reset: reset, resize: resize, resourcetimingbufferfull: resourcetimingbufferfull, result: result, resume: resume, scroll: scroll, seeked: seeked, seeking: seeking, select: select, selectstart: selectstart, selectionchange: selectionchange, show: show, slotchange: slotchange, soundend: soundend, soundstart: soundstart, speechend: speechend, speechstart: speechstart, stalled: stalled, start: start, storage: storage, submit: submit, success: success, suspend: suspend, SVGAbort: SVGAbort, SVGError: SVGError, SVGLoad: SVGLoad, SVGResize: SVGResize, SVGScroll: SVGScroll, SVGUnload: SVGUnload, SVGZoom: SVGZoom, timeout: timeout, timeupdate: timeupdate, touchcancel: touchcancel, touchend: touchend, touchmove: touchmove, touchstart: touchstart, transitionend: transitionend, unload: unload, updateready: updateready, userproximity: userproximity, voiceschanged: voiceschanged, visibilitychange: visibilitychange, volumechange: volumechange, waiting: waiting, wheel: wheel }; var domEventTypes$1 = Object.freeze({ abort: abort, afterprint: afterprint, animationend: animationend, animationiteration: animationiteration, animationstart: animationstart, appinstalled: appinstalled, audioprocess: audioprocess, audioend: audioend, audiostart: audiostart, beforeprint: beforeprint, beforeunload: beforeunload, beginEvent: beginEvent, blur: blur, boundary: boundary, cached: cached, canplay: canplay, canplaythrough: canplaythrough, change: change, chargingchange: chargingchange, chargingtimechange: chargingtimechange, checking: checking, click: click, close: close, complete: complete, compositionend: compositionend, compositionstart: compositionstart, compositionupdate: compositionupdate, contextmenu: contextmenu, copy: copy, cut: cut, dblclick: dblclick, devicechange: devicechange, devicelight: devicelight, devicemotion: devicemotion, deviceorientation: deviceorientation, deviceproximity: deviceproximity, dischargingtimechange: dischargingtimechange, DOMActivate: DOMActivate, DOMAttributeNameChanged: DOMAttributeNameChanged, DOMAttrModified: DOMAttrModified, DOMCharacterDataModified: DOMCharacterDataModified, DOMContentLoaded: DOMContentLoaded, DOMElementNameChanged: DOMElementNameChanged, DOMFocusIn: DOMFocusIn, DOMFocusOut: DOMFocusOut, DOMNodeInserted: DOMNodeInserted, DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument, DOMNodeRemoved: DOMNodeRemoved, DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument, DOMSubtreeModified: DOMSubtreeModified, downloading: downloading, drag: drag, dragend: dragend, dragenter: dragenter, dragleave: dragleave, dragover: dragover, dragstart: dragstart, drop: drop, durationchange: durationchange, emptied: emptied, end: end, ended: ended, endEvent: endEvent, error: error, focus: focus, focusin: focusin, focusout: focusout, fullscreenchange: fullscreenchange, fullscreenerror: fullscreenerror, gamepadconnected: gamepadconnected, gamepaddisconnected: gamepaddisconnected, gotpointercapture: gotpointercapture, hashchange: hashchange, lostpointercapture: lostpointercapture, input: input, invalid: invalid, keydown: keydown, keypress: keypress, keyup: keyup, languagechange: languagechange, levelchange: levelchange, load: load, loadeddata: loadeddata, loadedmetadata: loadedmetadata, loadend: loadend, loadstart: loadstart, mark: mark, message: message, messageerror: messageerror, mousedown: mousedown, mouseenter: mouseenter, mouseleave: mouseleave, mousemove: mousemove, mouseout: mouseout, mouseover: mouseover, mouseup: mouseup, nomatch: nomatch, notificationclick: notificationclick, noupdate: noupdate, obsolete: obsolete, offline: offline, online: online, open: open, orientationchange: orientationchange, pagehide: pagehide, pageshow: pageshow, paste: paste, pause: pause, pointercancel: pointercancel, pointerdown: pointerdown, pointerenter: pointerenter, pointerleave: pointerleave, pointerlockchange: pointerlockchange, pointerlockerror: pointerlockerror, pointermove: pointermove, pointerout: pointerout, pointerover: pointerover, pointerup: pointerup, play: play, playing: playing, popstate: popstate, progress: progress, push: push, pushsubscriptionchange: pushsubscriptionchange, ratechange: ratechange, readystatechange: readystatechange, repeatEvent: repeatEvent, reset: reset, resize: resize, resourcetimingbufferfull: resourcetimingbufferfull, result: result, resume: resume, scroll: scroll, seeked: seeked, seeking: seeking, select: select, selectstart: selectstart, selectionchange: selectionchange, show: show, slotchange: slotchange, soundend: soundend, soundstart: soundstart, speechend: speechend, speechstart: speechstart, stalled: stalled, start: start, storage: storage, submit: submit, success: success, suspend: suspend, SVGAbort: SVGAbort, SVGError: SVGError, SVGLoad: SVGLoad, SVGResize: SVGResize, SVGScroll: SVGScroll, SVGUnload: SVGUnload, SVGZoom: SVGZoom, timeout: timeout, timeupdate: timeupdate, touchcancel: touchcancel, touchend: touchend, touchmove: touchmove, touchstart: touchstart, transitionend: transitionend, unload: unload, updateready: updateready, userproximity: userproximity, voiceschanged: voiceschanged, visibilitychange: visibilitychange, volumechange: volumechange, waiting: waiting, wheel: wheel, default: domEventTypes }); var require$$0 = ( domEventTypes$1 && domEventTypes ) || domEventTypes$1; var domEventTypes$2 = require$$0; var defaultEventType = { eventInterface: 'Event', cancelable: true, bubbles: true }; var modifiers = { enter: 13, tab: 9, delete: 46, esc: 27, space: 32, up: 38, down: 40, left: 37, right: 39, end: 35, home: 36, backspace: 8, insert: 45, pageup: 33, pagedown: 34 }; function createEvent( type, modifier, ref, options ) { var eventInterface = ref.eventInterface; var bubbles = ref.bubbles; var cancelable = ref.cancelable; var SupportedEventInterface = typeof window[eventInterface] === 'function' ? window[eventInterface] : window.Event; var event = new SupportedEventInterface(type, Object.assign({}, options, {bubbles: bubbles, cancelable: cancelable, keyCode: modifiers[modifier]})); return event } function createOldEvent( type, modifier, ref ) { var eventInterface = ref.eventInterface; var bubbles = ref.bubbles; var cancelable = ref.cancelable; var event = document.createEvent('Event'); event.initEvent(type, bubbles, cancelable); event.keyCode = modifiers[modifier]; return event } function createDOMEvent(type, options) { var ref = type.split('.'); var eventType = ref[0]; var modifier = ref[1]; var meta = domEventTypes$2[eventType] || defaultEventType; // Fallback for IE10,11 - https://stackoverflow.com/questions/26596123 var event = typeof window.Event === 'function' ? createEvent(eventType, modifier, meta, options) : createOldEvent(eventType, modifier, meta); var eventPrototype = Object.getPrototypeOf(event); Object.keys(options || {}).forEach(function (key) { var propertyDescriptor = Object.getOwnPropertyDescriptor( eventPrototype, key ); var canSetProperty = !( propertyDescriptor && propertyDescriptor.setter === undefined ); if (canSetProperty) { event[key] = options[key]; } }); return event } function errorHandler(errorOrString, vm) { var error = typeof errorOrString === 'object' ? errorOrString : new Error(errorOrString); vm._error = error; throw error } function throwIfInstancesThrew(vm) { var instancesWithError = findAllInstances(vm).filter(function (_vm) { return _vm._error; }); if (instancesWithError.length > 0) { throw instancesWithError[0]._error } } var hasWarned = false; // Vue swallows errors thrown by instances, even if the global error handler // throws. In order to throw in the test, we add an _error property to an // instance when it throws. Then we loop through the instances with // throwIfInstancesThrew and throw an error in the test context if any // instances threw. function addGlobalErrorHandler(_Vue) { var existingErrorHandler = _Vue.config.errorHandler; if (existingErrorHandler === errorHandler) { return } if (_Vue.config.errorHandler && !hasWarned) { warn( "Global error handler detected (Vue.config.errorHandler). \n" + "Vue Test Utils sets a custom error handler to throw errors " + "thrown by instances. If you want this behavior in " + "your tests, you must remove the global error handler." ); hasWarned = true; } else { _Vue.config.errorHandler = errorHandler; } } // var Wrapper = function Wrapper( node, options, isVueWrapper ) { var vnode = node instanceof Element ? null : node; var element = node instanceof Element ? node : node.elm; // Prevent redefine by VueWrapper if (!isVueWrapper) { // $FlowIgnore : issue with defineProperty Object.defineProperty(this, 'rootNode', { get: function () { return vnode || element; }, set: function () { return throwError('wrapper.rootNode is read-only'); } }); // $FlowIgnore Object.defineProperty(this, 'vnode', { get: function () { return vnode; }, set: function () { return throwError('wrapper.vnode is read-only'); } }); // $FlowIgnore Object.defineProperty(this, 'element', { get: function () { return element; }, set: function () { return throwError('wrapper.element is read-only'); } }); // $FlowIgnore Object.defineProperty(this, 'vm', { get: function () { return undefined; }, set: function () { return throwError('wrapper.vm is read-only'); } }); } var frozenOptions = Object.freeze(options); // $FlowIgnore Object.defineProperty(this, 'options', { get: function () { return frozenOptions; }, set: function () { return throwError('wrapper.options is read-only'); } }); if ( this.vnode && (this.vnode[FUNCTIONAL_OPTIONS] || this.vnode.functionalContext) ) { this.isFunctionalComponent = true; } }; Wrapper.prototype.at = function at () { throwError('at() must be called on a WrapperArray'); }; /** * Returns an Object containing all the attribute/value pairs on the element. */ Wrapper.prototype.attributes = function attributes (key) { var attributes = this.element.attributes; var attributeMap = {}; for (var i = 0; i < attributes.length; i++) { var att = attributes.item(i); attributeMap[att.localName] = att.value; } return key ? attributeMap[key] : attributeMap }; /** * Returns an Array containing all the classes on the element */ Wrapper.prototype.classes = function classes (className) { var this$1 = this; var classAttribute = this.element.getAttribute('class'); var classes = classAttribute ? classAttribute.split(' ') : []; // Handle converting cssmodules identifiers back to the original class name if (this.vm && this.vm.$style) { var cssModuleIdentifiers = Object.keys(this.vm.$style).reduce( function (acc, key) { // $FlowIgnore var moduleIdent = this$1.vm.$style[key]; if (moduleIdent) { acc[moduleIdent.split(' ')[0]] = key; } return acc }, {} ); classes = classes.map(function (name) { return cssModuleIdentifiers[name] || name; }); } return className ? !!(classes.indexOf(className) > -1) : classes }; /** * Checks if wrapper contains provided selector. */ Wrapper.prototype.contains = function contains (rawSelector) { var selector = getSelector(rawSelector, 'contains'); var nodes = find(this.rootNode, this.vm, selector); return nodes.length > 0 }; /** * Calls destroy on vm */ Wrapper.prototype.destroy = function destroy () { if (!this.isVueInstance()) { throwError("wrapper.destroy() can only be called on a Vue instance"); } if (this.element.parentNode) { this.element.parentNode.removeChild(this.element); } // $FlowIgnore this.vm.$destroy(); throwIfInstancesThrew(this.vm); }; /** * Returns an object containing custom events emitted by the Wrapper vm */ Wrapper.prototype.emitted = function emitted ( event ) { if (!this._emitted && !this.vm) { throwError("wrapper.emitted() can only be called on a Vue instance"); } if (event) { return this._emitted[event] } return this._emitted }; /** * Returns an Array containing custom events emitted by the Wrapper vm */ Wrapper.prototype.emittedByOrder = function emittedByOrder () { if (!this._emittedByOrder && !this.vm) { throwError( "wrapper.emittedByOrder() can only be called on a Vue instance" ); } return this._emittedByOrder }; /** * Utility to check wrapper exists. Returns true as Wrapper always exists */ Wrapper.prototype.exists = function exists () { if (this.vm) { return !!this.vm && !this.vm._isDestroyed } return true }; Wrapper.prototype.filter = function filter () { throwError('filter() must be called on a WrapperArray'); }; /** * Finds first node in tree of the current wrapper that * matches the provided selector. */ Wrapper.prototype.find = function find$1 (rawSelector) { var selector = getSelector(rawSelector, 'find'); var node = find(this.rootNode, this.vm, selector)[0]; if (!node) { if (selector.type === REF_SELECTOR) { return new ErrorWrapper(("ref=\"" + (selector.value.ref) + "\"")) } return new ErrorWrapper( typeof selector.value === 'string' ? selector.value : 'Component' ) } return createWrapper(node, this.options) }; /** * Finds node in tree of the current wrapper that matches * the provided selector. */ Wrapper.prototype.findAll = function findAll (rawSelector) { var this$1 = this; var selector = getSelector(rawSelector, 'findAll'); var nodes = find(this.rootNode, this.vm, selector); var wrappers = nodes.map(function (node) { // Using CSS Selector, returns a VueWrapper instance if the root element // binds a Vue instance. return createWrapper(node, this$1.options) }); return new WrapperArray(wrappers) }; /** * Returns HTML of element as a string */ Wrapper.prototype.html = function html () { return this.element.outerHTML }; /** * Checks if node matches selector */ Wrapper.prototype.is = function is (rawSelector) { var selector = getSelector(rawSelector, 'is'); if (selector.type === REF_SELECTOR) { throwError('$ref selectors can not be used with wrapper.is()'); } return matches(this.rootNode, selector) }; /** * Checks if node is empty */ Wrapper.prototype.isEmpty = function isEmpty () { if (!this.vnode) { return this.element.innerHTML === '' } var nodes = []; var node = this.vnode; var i = 0; while (node) { if (node.child) { nodes.push(node.child._vnode); } node.children && node.children.forEach(function (n) { nodes.push(n); }); node = nodes[i++]; } return nodes.every(function (n) { return n.isComment || n.child; }) }; /** * Checks if node is visible */ Wrapper.prototype.isVisible = function isVisible () { var element = this.element; while (element) { if ( element.style && (element.style.visibility === 'hidden' || element.style.display === 'none') ) { return false } element = element.parentElement; } return true }; /** * Checks if wrapper is a vue instance */ Wrapper.prototype.isVueInstance = function isVueInstance () { return !!this.vm }; /** * Returns name of component, or tag name if node is not a Vue component */ Wrapper.prototype.name = function name () { if (this.vm) { return ( this.vm.$options.name || // compat for Vue < 2.3 (this.vm.$options.extendOptions && this.vm.$options.extendOptions.name) ) } if (!this.vnode) { return this.element.tagName } return this.vnode.tag }; /** * Returns an Object containing the prop name/value pairs on the element */ Wrapper.prototype.props = function props (key) { var this$1 = this; if (this.isFunctionalComponent) { throwError( "wrapper.props() cannot be called on a mounted functional component." ); } if (!this.vm) { throwError('wrapper.props() must be called on a Vue instance'); } var props = {}; var keys = this.vm && this.vm.$options._propKeys; if (keys) { (keys || {}).forEach(function (key) { if (this$1.vm) { props[key] = this$1.vm[key]; } }); } if (key) { return props[key] } return props }; /** * Checks radio button or checkbox element */ Wrapper.prototype.setChecked = function setChecked (checked) { if ( checked === void 0 ) checked = true; if (typeof checked !== 'boolean') { throwError('wrapper.setChecked() must be passed a boolean'); } var tagName = this.element.tagName; // $FlowIgnore var type = this.attributes().type; var event = getCheckedEvent(); if (tagName === 'INPUT' && type === 'checkbox') { if (this.element.checked === checked) { return } if (event !== 'click' || isPhantomJS) { // $FlowIgnore this.element.checked = checked; } this.trigger(event); return } if (tagName === 'INPUT' && type === 'radio') { if (!checked) { throwError( "wrapper.setChecked() cannot be called with parameter false on a " + " element." ); } if (event !== 'click' || isPhantomJS) { // $FlowIgnore this.element.selected = true; } this.trigger(event); return } throwError("wrapper.setChecked() cannot be called on this element"); }; /** * Selects element */ Wrapper.prototype.setSelected = function setSelected () { var tagName = this.element.tagName; if (tagName === 'SELECT') { throwError( "wrapper.setSelected() cannot be called on select. Call it on one of " + "its options" ); } if (tagName === 'OPTION') { // $FlowIgnore this.element.selected = true; // $FlowIgnore var parentElement = this.element.parentElement; // $FlowIgnore if (parentElement.tagName === 'OPTGROUP') { // $FlowIgnore parentElement = parentElement.parentElement; } // $FlowIgnore createWrapper(parentElement, this.options).trigger('change'); return } throwError("wrapper.setSelected() cannot be called on this element"); }; /** * Sets vm data */ Wrapper.prototype.setData = function setData (data) { if (this.isFunctionalComponent) { throwError("wrapper.setData() cannot be called on a functional component"); } if (!this.vm) { throwError("wrapper.setData() can only be called on a Vue instance"); } recursivelySetData(this.vm, this.vm, data); }; /** * Sets vm methods */ Wrapper.prototype.setMethods = function setMethods (methods) { var this$1 = this; if (!this.isVueInstance()) { throwError("wrapper.setMethods() can only be called on a Vue instance"); } Object.keys(methods).forEach(function (key) { // $FlowIgnore : Problem with possibly null this.vm this$1.vm[key] = methods[key]; // $FlowIgnore : Problem with possibly null this.vm this$1.vm.$options.methods[key] = methods[key]; }); if (this.vnode) { var context = this.vnode.context; if (context.$options.render) { context._update(context._render()); } } }; /** * Sets vm props */ Wrapper.prototype.setProps = function setProps (data) { var this$1 = this; var originalConfig = Vue.config.silent; Vue.config.silent = config.silent; if (this.isFunctionalComponent) { throwError( "wrapper.setProps() cannot be called on a functional component" ); } if (!this.vm) { throwError("wrapper.setProps() can only be called on a Vue instance"); } Object.keys(data).forEach(function (key) { if ( typeof data[key] === 'object' && data[key] !== null && // $FlowIgnore : Problem with possibly null this.vm data[key] === this$1.vm[key] ) { throwError( "wrapper.setProps() called with the same object of the existing " + key + " property. You must call wrapper.setProps() with a new " + "object to trigger reactivity" ); } if ( !this$1.vm || !this$1.vm.$options._propKeys || !this$1.vm.$options._propKeys.some(function (prop) { return prop === key; }) ) { if (VUE_VERSION > 2.3) { // $FlowIgnore : Problem with possibly null this.vm this$1.vm.$attrs[key] = data[key]; return } throwError( "wrapper.setProps() called with " + key + " property which " + "is not defined on the component" ); } if (this$1.vm && this$1.vm._props) { // Set actual props value this$1.vm._props[key] = data[key]; // $FlowIgnore : Problem with possibly null this.vm this$1.vm[key] = data[key]; } else { // $FlowIgnore : Problem with possibly null this.vm.$options this$1.vm.$options.propsData[key] = data[key]; // $FlowIgnore : Problem with possibly null this.vm this$1.vm[key] = data[key]; // $FlowIgnore : Need to call this twice to fix watcher bug in 2.0.x this$1.vm[key] = data[key]; } }); // $FlowIgnore : Problem with possibly null this.vm this.vm.$forceUpdate(); if (this.options.sync === COMPAT_SYNC_MODE) { // $FlowIgnore : Problem with possibly null this.vm orderWatchers(this.vm || this.vnode.context.$root); } Vue.config.silent = originalConfig; }; /** * Sets element value and triggers input event */ Wrapper.prototype.setValue = function setValue (value) { var tagName = this.element.tagName; // $FlowIgnore var type = this.attributes().type; if (tagName === 'OPTION') { throwError( "wrapper.setValue() cannot be called on an