UNPKG

307 kBJavaScriptView Raw
1
2/**
3 * @vue/test-utils v2.4.6
4 * (c) 2024 Lachlan Miller
5 * Released under the MIT License
6 */
7
8import * as Vue from 'vue';
9import { nextTick, setDevtoolsHook, Transition, BaseTransition, TransitionGroup, defineComponent, h, isRef, shallowReactive, reactive, ref, createApp, transformVNodeArgs, computed } from 'vue';
10import { compile } from '@vue/compiler-dom';
11import { renderToString as renderToString$1 } from '@vue/server-renderer';
12
13/******************************************************************************
14Copyright (c) Microsoft Corporation.
15
16Permission to use, copy, modify, and/or distribute this software for any
17purpose with or without fee is hereby granted.
18
19THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25PERFORMANCE OF THIS SOFTWARE.
26***************************************************************************** */
27/* global Reflect, Promise, SuppressedError, Symbol */
28
29var extendStatics = function(d, b) {
30 extendStatics = Object.setPrototypeOf ||
31 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33 return extendStatics(d, b);
34};
35
36function __extends(d, b) {
37 if (typeof b !== "function" && b !== null)
38 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
39 extendStatics(d, b);
40 function __() { this.constructor = d; }
41 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42}
43
44var __assign = function() {
45 __assign = Object.assign || function __assign(t) {
46 for (var s, i = 1, n = arguments.length; i < n; i++) {
47 s = arguments[i];
48 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
49 }
50 return t;
51 };
52 return __assign.apply(this, arguments);
53};
54
55function __awaiter(thisArg, _arguments, P, generator) {
56 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
57 return new (P || (P = Promise))(function (resolve, reject) {
58 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
59 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
60 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
61 step((generator = generator.apply(thisArg, _arguments || [])).next());
62 });
63}
64
65function __generator(thisArg, body) {
66 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
67 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
68 function verb(n) { return function (v) { return step([n, v]); }; }
69 function step(op) {
70 if (f) throw new TypeError("Generator is already executing.");
71 while (g && (g = 0, op[0] && (_ = 0)), _) try {
72 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
73 if (y = 0, t) op = [op[0] & 2, t.value];
74 switch (op[0]) {
75 case 0: case 1: t = op; break;
76 case 4: _.label++; return { value: op[1], done: false };
77 case 5: _.label++; y = op[1]; op = [0]; continue;
78 case 7: op = _.ops.pop(); _.trys.pop(); continue;
79 default:
80 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
81 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
82 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
83 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
84 if (t[2]) _.ops.pop();
85 _.trys.pop(); continue;
86 }
87 op = body.call(thisArg, _);
88 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
89 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
90 }
91}
92
93function __spreadArray(to, from, pack) {
94 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
95 if (ar || !(i in from)) {
96 if (!ar) ar = Array.prototype.slice.call(from, 0, i);
97 ar[i] = from[i];
98 }
99 }
100 return to.concat(ar || Array.prototype.slice.call(from));
101}
102
103typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
104 var e = new Error(message);
105 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
106};
107
108var Pluggable = /** @class */ (function () {
109 function Pluggable() {
110 this.installedPlugins = [];
111 }
112 Pluggable.prototype.install = function (handler, options) {
113 if (typeof handler !== 'function') {
114 console.error('plugin.install must receive a function');
115 handler = function () { return ({}); };
116 }
117 this.installedPlugins.push({ handler: handler, options: options });
118 };
119 Pluggable.prototype.extend = function (instance) {
120 var invokeSetup = function (_a) {
121 var handler = _a.handler, options = _a.options;
122 return handler(instance, options); // invoke the setup method passed to install
123 };
124 var bindProperty = function (_a) {
125 var property = _a[0], value = _a[1];
126 instance[property] =
127 typeof value === 'function' ? value.bind(instance) : value;
128 };
129 var addAllPropertiesFromSetup = function (setupResult) {
130 setupResult = typeof setupResult === 'object' ? setupResult : {};
131 Object.entries(setupResult).forEach(bindProperty);
132 };
133 this.installedPlugins.map(invokeSetup).forEach(addAllPropertiesFromSetup);
134 };
135 /** For testing */
136 Pluggable.prototype.reset = function () {
137 this.installedPlugins = [];
138 };
139 return Pluggable;
140}());
141var config = {
142 global: {
143 stubs: {
144 transition: true,
145 'transition-group': true
146 },
147 provide: {},
148 components: {},
149 config: {},
150 directives: {},
151 mixins: [],
152 mocks: {},
153 plugins: [],
154 renderStubDefaultSlot: false
155 },
156 plugins: {
157 VueWrapper: new Pluggable(),
158 DOMWrapper: new Pluggable()
159 }
160};
161
162function mergeStubs(target, source) {
163 if (source.stubs) {
164 if (Array.isArray(source.stubs)) {
165 source.stubs.forEach(function (x) { return (target[x] = true); });
166 }
167 else {
168 for (var _i = 0, _a = Object.entries(source.stubs); _i < _a.length; _i++) {
169 var _b = _a[_i], k = _b[0], v = _b[1];
170 target[k] = v;
171 }
172 }
173 }
174}
175// perform 1-level-deep-pseudo-clone merge in order to prevent config leaks
176// example: vue-router overwrites globalProperties.$router
177function mergeAppConfig(configGlobalConfig, mountGlobalConfig) {
178 return __assign(__assign(__assign({}, configGlobalConfig), mountGlobalConfig), { globalProperties: __assign(__assign({}, configGlobalConfig === null || configGlobalConfig === void 0 ? void 0 : configGlobalConfig.globalProperties), mountGlobalConfig === null || mountGlobalConfig === void 0 ? void 0 : mountGlobalConfig.globalProperties) });
179}
180function mergeGlobalProperties(mountGlobal) {
181 var _a, _b, _c;
182 if (mountGlobal === void 0) { mountGlobal = {}; }
183 var stubs = {};
184 var configGlobal = (_a = config === null || config === void 0 ? void 0 : config.global) !== null && _a !== void 0 ? _a : {};
185 mergeStubs(stubs, configGlobal);
186 mergeStubs(stubs, mountGlobal);
187 var renderStubDefaultSlot = (_c = (_b = mountGlobal.renderStubDefaultSlot) !== null && _b !== void 0 ? _b : (configGlobal.renderStubDefaultSlot || (config === null || config === void 0 ? void 0 : config.renderStubDefaultSlot))) !== null && _c !== void 0 ? _c : false;
188 if (config.renderStubDefaultSlot === true) {
189 console.warn('config.renderStubDefaultSlot is deprecated, use config.global.renderStubDefaultSlot instead');
190 }
191 return {
192 mixins: __spreadArray(__spreadArray([], (configGlobal.mixins || []), true), (mountGlobal.mixins || []), true),
193 plugins: __spreadArray(__spreadArray([], (configGlobal.plugins || []), true), (mountGlobal.plugins || []), true),
194 stubs: stubs,
195 components: __assign(__assign({}, configGlobal.components), mountGlobal.components),
196 provide: __assign(__assign({}, configGlobal.provide), mountGlobal.provide),
197 mocks: __assign(__assign({}, configGlobal.mocks), mountGlobal.mocks),
198 config: mergeAppConfig(configGlobal.config, mountGlobal.config),
199 directives: __assign(__assign({}, configGlobal.directives), mountGlobal.directives),
200 renderStubDefaultSlot: renderStubDefaultSlot
201 };
202}
203var isObject = function (obj) {
204 return !!obj && typeof obj === 'object';
205};
206function isClass(obj) {
207 if (!(obj instanceof Object))
208 return;
209 var isCtorClass = obj.constructor && obj.constructor.toString().substring(0, 5) === 'class';
210 if (!('prototype' in obj)) {
211 return isCtorClass;
212 }
213 var prototype = obj.prototype;
214 var isPrototypeCtorClass = prototype.constructor &&
215 prototype.constructor.toString &&
216 prototype.constructor.toString().substring(0, 5) === 'class';
217 return isCtorClass || isPrototypeCtorClass;
218}
219// https://stackoverflow.com/a/48218209
220var mergeDeep = function (target, source) {
221 var _a;
222 if (!isObject(target) || !isObject(source)) {
223 return source;
224 }
225 Object.keys(source)
226 .concat(isClass(source)
227 ? Object.getOwnPropertyNames((_a = Object.getPrototypeOf(source)) !== null && _a !== void 0 ? _a : {})
228 : Object.getOwnPropertyNames(source))
229 .forEach(function (key) {
230 var targetValue = target[key];
231 var sourceValue = source[key];
232 if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
233 target[key] = sourceValue;
234 }
235 else if (sourceValue instanceof Date) {
236 target[key] = sourceValue;
237 }
238 else if (isObject(targetValue) && isObject(sourceValue)) {
239 target[key] = mergeDeep(Object.assign({}, targetValue), sourceValue);
240 }
241 else {
242 target[key] = sourceValue;
243 }
244 });
245 return target;
246};
247function isClassComponent(component) {
248 return typeof component === 'function' && '__vccOpts' in component;
249}
250function isComponent(component) {
251 return Boolean(component &&
252 (typeof component === 'object' || typeof component === 'function'));
253}
254function isFunctionalComponent(component) {
255 return typeof component === 'function' && !isClassComponent(component);
256}
257function isObjectComponent(component) {
258 return Boolean(component && typeof component === 'object');
259}
260function textContent(element) {
261 var _a, _b;
262 // we check if the element is a comment first
263 // to return an empty string in that case, instead of the comment content
264 return element.nodeType !== Node.COMMENT_NODE
265 ? (_b = (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : ''
266 : '';
267}
268function hasOwnProperty(obj, prop) {
269 return obj.hasOwnProperty(prop);
270}
271function isNotNullOrUndefined(obj) {
272 return Boolean(obj);
273}
274function isRefSelector(selector) {
275 return typeof selector === 'object' && 'ref' in selector;
276}
277function convertStubsToRecord(stubs) {
278 if (Array.isArray(stubs)) {
279 // ['Foo', 'Bar'] => { Foo: true, Bar: true }
280 return stubs.reduce(function (acc, current) {
281 acc[current] = true;
282 return acc;
283 }, {});
284 }
285 return stubs;
286}
287var isDirectiveKey = function (key) { return key.match(/^v[A-Z].*/); };
288function getComponentsFromStubs(stubs) {
289 var normalizedStubs = convertStubsToRecord(stubs);
290 return Object.fromEntries(Object.entries(normalizedStubs).filter(function (_a) {
291 var key = _a[0];
292 return !isDirectiveKey(key);
293 }));
294}
295function getDirectivesFromStubs(stubs) {
296 var normalizedStubs = convertStubsToRecord(stubs);
297 return Object.fromEntries(Object.entries(normalizedStubs)
298 .filter(function (_a) {
299 var key = _a[0], value = _a[1];
300 return isDirectiveKey(key) && value !== false;
301 })
302 .map(function (_a) {
303 var key = _a[0], value = _a[1];
304 return [key.substring(1), value];
305 }));
306}
307function hasSetupState(vm) {
308 return (vm &&
309 vm.$.devtoolsRawSetupState);
310}
311function isScriptSetup(vm) {
312 return (vm && vm.$.setupState.__isScriptSetup);
313}
314var _globalThis;
315var getGlobalThis = function () {
316 return (_globalThis ||
317 (_globalThis =
318 typeof globalThis !== 'undefined'
319 ? globalThis
320 : typeof self !== 'undefined'
321 ? self
322 : typeof window !== 'undefined'
323 ? window
324 : typeof global !== 'undefined'
325 ? global
326 : {}));
327};
328
329var ignorableKeyModifiers = [
330 'stop',
331 'prevent',
332 'self',
333 'exact',
334 'prevent',
335 'capture'
336];
337var systemKeyModifiers = ['ctrl', 'shift', 'alt', 'meta'];
338var mouseKeyModifiers = ['left', 'middle', 'right'];
339var keyCodesByKeyName = {
340 backspace: 8,
341 tab: 9,
342 enter: 13,
343 esc: 27,
344 space: 32,
345 pageup: 33,
346 pagedown: 34,
347 end: 35,
348 home: 36,
349 left: 37,
350 up: 38,
351 right: 39,
352 down: 40,
353 insert: 45,
354 delete: 46
355};
356var domEvents = {
357 abort: {
358 eventInterface: 'Event',
359 bubbles: false,
360 cancelable: false
361 },
362 afterprint: {
363 eventInterface: 'Event',
364 bubbles: false,
365 cancelable: false
366 },
367 animationend: {
368 eventInterface: 'AnimationEvent',
369 bubbles: true,
370 cancelable: false
371 },
372 animationiteration: {
373 eventInterface: 'AnimationEvent',
374 bubbles: true,
375 cancelable: false
376 },
377 animationstart: {
378 eventInterface: 'AnimationEvent',
379 bubbles: true,
380 cancelable: false
381 },
382 appinstalled: {
383 eventInterface: 'Event',
384 bubbles: false,
385 cancelable: false
386 },
387 /**
388 * @deprecated
389 */
390 audioprocess: {
391 eventInterface: 'AudioProcessingEvent',
392 bubbles: false,
393 cancelable: false
394 },
395 audioend: {
396 eventInterface: 'Event',
397 bubbles: false,
398 cancelable: false
399 },
400 audiostart: {
401 eventInterface: 'Event',
402 bubbles: false,
403 cancelable: false
404 },
405 beforeprint: {
406 eventInterface: 'Event',
407 bubbles: false,
408 cancelable: false
409 },
410 beforeunload: {
411 eventInterface: 'BeforeUnloadEvent',
412 bubbles: false,
413 cancelable: true
414 },
415 beginEvent: {
416 eventInterface: 'TimeEvent',
417 bubbles: false,
418 cancelable: false
419 },
420 blur: {
421 eventInterface: 'FocusEvent',
422 bubbles: false,
423 cancelable: false
424 },
425 boundary: {
426 eventInterface: 'SpeechSynthesisEvent',
427 bubbles: false,
428 cancelable: false
429 },
430 cached: {
431 eventInterface: 'Event',
432 bubbles: false,
433 cancelable: false
434 },
435 canplay: {
436 eventInterface: 'Event',
437 bubbles: false,
438 cancelable: false
439 },
440 canplaythrough: {
441 eventInterface: 'Event',
442 bubbles: false,
443 cancelable: false
444 },
445 change: {
446 eventInterface: 'Event',
447 bubbles: true,
448 cancelable: false
449 },
450 chargingchange: {
451 eventInterface: 'Event',
452 bubbles: false,
453 cancelable: false
454 },
455 chargingtimechange: {
456 eventInterface: 'Event',
457 bubbles: false,
458 cancelable: false
459 },
460 checking: {
461 eventInterface: 'Event',
462 bubbles: false,
463 cancelable: false
464 },
465 click: {
466 eventInterface: 'MouseEvent',
467 bubbles: true,
468 cancelable: true
469 },
470 close: {
471 eventInterface: 'Event',
472 bubbles: false,
473 cancelable: false
474 },
475 complete: {
476 eventInterface: 'OfflineAudioCompletionEvent',
477 bubbles: false,
478 cancelable: false
479 },
480 compositionend: {
481 eventInterface: 'CompositionEvent',
482 bubbles: true,
483 cancelable: true
484 },
485 compositionstart: {
486 eventInterface: 'CompositionEvent',
487 bubbles: true,
488 cancelable: true
489 },
490 compositionupdate: {
491 eventInterface: 'CompositionEvent',
492 bubbles: true,
493 cancelable: false
494 },
495 contextmenu: {
496 eventInterface: 'MouseEvent',
497 bubbles: true,
498 cancelable: true
499 },
500 copy: {
501 eventInterface: 'ClipboardEvent',
502 bubbles: true,
503 cancelable: true
504 },
505 cut: {
506 eventInterface: 'ClipboardEvent',
507 bubbles: true,
508 cancelable: true
509 },
510 dblclick: {
511 eventInterface: 'MouseEvent',
512 bubbles: true,
513 cancelable: true
514 },
515 devicechange: {
516 eventInterface: 'Event',
517 bubbles: false,
518 cancelable: false
519 },
520 devicelight: {
521 eventInterface: 'DeviceLightEvent',
522 bubbles: false,
523 cancelable: false
524 },
525 devicemotion: {
526 eventInterface: 'DeviceMotionEvent',
527 bubbles: false,
528 cancelable: false
529 },
530 deviceorientation: {
531 eventInterface: 'DeviceOrientationEvent',
532 bubbles: false,
533 cancelable: false
534 },
535 deviceproximity: {
536 eventInterface: 'DeviceProximityEvent',
537 bubbles: false,
538 cancelable: false
539 },
540 dischargingtimechange: {
541 eventInterface: 'Event',
542 bubbles: false,
543 cancelable: false
544 },
545 DOMActivate: {
546 eventInterface: 'UIEvent',
547 bubbles: true,
548 cancelable: true
549 },
550 DOMAttributeNameChanged: {
551 eventInterface: 'MutationNameEvent',
552 bubbles: true,
553 cancelable: true
554 },
555 DOMAttrModified: {
556 eventInterface: 'MutationEvent',
557 bubbles: true,
558 cancelable: true
559 },
560 DOMCharacterDataModified: {
561 eventInterface: 'MutationEvent',
562 bubbles: true,
563 cancelable: true
564 },
565 DOMContentLoaded: {
566 eventInterface: 'Event',
567 bubbles: true,
568 cancelable: true
569 },
570 DOMElementNameChanged: {
571 eventInterface: 'MutationNameEvent',
572 bubbles: true,
573 cancelable: true
574 },
575 DOMFocusIn: {
576 eventInterface: 'FocusEvent',
577 bubbles: true,
578 cancelable: true
579 },
580 DOMFocusOut: {
581 eventInterface: 'FocusEvent',
582 bubbles: true,
583 cancelable: true
584 },
585 DOMNodeInserted: {
586 eventInterface: 'MutationEvent',
587 bubbles: true,
588 cancelable: true
589 },
590 DOMNodeInsertedIntoDocument: {
591 eventInterface: 'MutationEvent',
592 bubbles: true,
593 cancelable: true
594 },
595 DOMNodeRemoved: {
596 eventInterface: 'MutationEvent',
597 bubbles: true,
598 cancelable: true
599 },
600 DOMNodeRemovedFromDocument: {
601 eventInterface: 'MutationEvent',
602 bubbles: true,
603 cancelable: true
604 },
605 /**
606 * @deprecated
607 */
608 DOMSubtreeModified: {
609 eventInterface: 'MutationEvent',
610 bubbles: true,
611 cancelable: false
612 },
613 downloading: {
614 eventInterface: 'Event',
615 bubbles: false,
616 cancelable: false
617 },
618 drag: {
619 eventInterface: 'DragEvent',
620 bubbles: true,
621 cancelable: true
622 },
623 dragend: {
624 eventInterface: 'DragEvent',
625 bubbles: true,
626 cancelable: false
627 },
628 dragenter: {
629 eventInterface: 'DragEvent',
630 bubbles: true,
631 cancelable: true
632 },
633 dragleave: {
634 eventInterface: 'DragEvent',
635 bubbles: true,
636 cancelable: false
637 },
638 dragover: {
639 eventInterface: 'DragEvent',
640 bubbles: true,
641 cancelable: true
642 },
643 dragstart: {
644 eventInterface: 'DragEvent',
645 bubbles: true,
646 cancelable: true
647 },
648 drop: {
649 eventInterface: 'DragEvent',
650 bubbles: true,
651 cancelable: true
652 },
653 durationchange: {
654 eventInterface: 'Event',
655 bubbles: false,
656 cancelable: false
657 },
658 emptied: {
659 eventInterface: 'Event',
660 bubbles: false,
661 cancelable: false
662 },
663 end: {
664 eventInterface: 'Event',
665 bubbles: false,
666 cancelable: false
667 },
668 ended: {
669 eventInterface: 'Event',
670 bubbles: false,
671 cancelable: false
672 },
673 endEvent: {
674 eventInterface: 'TimeEvent',
675 bubbles: false,
676 cancelable: false
677 },
678 error: {
679 eventInterface: 'Event',
680 bubbles: false,
681 cancelable: false
682 },
683 focus: {
684 eventInterface: 'FocusEvent',
685 bubbles: false,
686 cancelable: false
687 },
688 focusin: {
689 eventInterface: 'FocusEvent',
690 bubbles: true,
691 cancelable: false
692 },
693 focusout: {
694 eventInterface: 'FocusEvent',
695 bubbles: true,
696 cancelable: false
697 },
698 fullscreenchange: {
699 eventInterface: 'Event',
700 bubbles: true,
701 cancelable: false
702 },
703 fullscreenerror: {
704 eventInterface: 'Event',
705 bubbles: true,
706 cancelable: false
707 },
708 gamepadconnected: {
709 eventInterface: 'GamepadEvent',
710 bubbles: false,
711 cancelable: false
712 },
713 gamepaddisconnected: {
714 eventInterface: 'GamepadEvent',
715 bubbles: false,
716 cancelable: false
717 },
718 gotpointercapture: {
719 eventInterface: 'PointerEvent',
720 bubbles: false,
721 cancelable: false
722 },
723 hashchange: {
724 eventInterface: 'HashChangeEvent',
725 bubbles: true,
726 cancelable: false
727 },
728 lostpointercapture: {
729 eventInterface: 'PointerEvent',
730 bubbles: false,
731 cancelable: false
732 },
733 input: {
734 eventInterface: 'Event',
735 bubbles: true,
736 cancelable: false
737 },
738 invalid: {
739 eventInterface: 'Event',
740 cancelable: true,
741 bubbles: false
742 },
743 keydown: {
744 eventInterface: 'KeyboardEvent',
745 bubbles: true,
746 cancelable: true
747 },
748 keypress: {
749 eventInterface: 'KeyboardEvent',
750 bubbles: true,
751 cancelable: true
752 },
753 keyup: {
754 eventInterface: 'KeyboardEvent',
755 bubbles: true,
756 cancelable: true
757 },
758 languagechange: {
759 eventInterface: 'Event',
760 bubbles: false,
761 cancelable: false
762 },
763 levelchange: {
764 eventInterface: 'Event',
765 bubbles: false,
766 cancelable: false
767 },
768 load: {
769 eventInterface: 'UIEvent',
770 bubbles: false,
771 cancelable: false
772 },
773 loadeddata: {
774 eventInterface: 'Event',
775 bubbles: false,
776 cancelable: false
777 },
778 loadedmetadata: {
779 eventInterface: 'Event',
780 bubbles: false,
781 cancelable: false
782 },
783 loadend: {
784 eventInterface: 'ProgressEvent',
785 bubbles: false,
786 cancelable: false
787 },
788 loadstart: {
789 eventInterface: 'ProgressEvent',
790 bubbles: false,
791 cancelable: false
792 },
793 mark: {
794 eventInterface: 'SpeechSynthesisEvent',
795 bubbles: false,
796 cancelable: false
797 },
798 message: {
799 eventInterface: 'MessageEvent',
800 bubbles: false,
801 cancelable: false
802 },
803 messageerror: {
804 eventInterface: 'MessageEvent',
805 bubbles: false,
806 cancelable: false
807 },
808 mousedown: {
809 eventInterface: 'MouseEvent',
810 bubbles: true,
811 cancelable: true
812 },
813 mouseenter: {
814 eventInterface: 'MouseEvent',
815 bubbles: false,
816 cancelable: false
817 },
818 mouseleave: {
819 eventInterface: 'MouseEvent',
820 bubbles: false,
821 cancelable: false
822 },
823 mousemove: {
824 eventInterface: 'MouseEvent',
825 bubbles: true,
826 cancelable: true
827 },
828 mouseout: {
829 eventInterface: 'MouseEvent',
830 bubbles: true,
831 cancelable: true
832 },
833 mouseover: {
834 eventInterface: 'MouseEvent',
835 bubbles: true,
836 cancelable: true
837 },
838 mouseup: {
839 eventInterface: 'MouseEvent',
840 bubbles: true,
841 cancelable: true
842 },
843 nomatch: {
844 eventInterface: 'SpeechRecognitionEvent',
845 bubbles: false,
846 cancelable: false
847 },
848 notificationclick: {
849 eventInterface: 'NotificationEvent',
850 bubbles: false,
851 cancelable: false
852 },
853 noupdate: {
854 eventInterface: 'Event',
855 bubbles: false,
856 cancelable: false
857 },
858 obsolete: {
859 eventInterface: 'Event',
860 bubbles: false,
861 cancelable: false
862 },
863 offline: {
864 eventInterface: 'Event',
865 bubbles: false,
866 cancelable: false
867 },
868 online: {
869 eventInterface: 'Event',
870 bubbles: false,
871 cancelable: false
872 },
873 open: {
874 eventInterface: 'Event',
875 bubbles: false,
876 cancelable: false
877 },
878 orientationchange: {
879 eventInterface: 'Event',
880 bubbles: false,
881 cancelable: false
882 },
883 pagehide: {
884 eventInterface: 'PageTransitionEvent',
885 bubbles: false,
886 cancelable: false
887 },
888 pageshow: {
889 eventInterface: 'PageTransitionEvent',
890 bubbles: false,
891 cancelable: false
892 },
893 paste: {
894 eventInterface: 'ClipboardEvent',
895 bubbles: true,
896 cancelable: true
897 },
898 pause: {
899 eventInterface: 'SpeechSynthesisEvent',
900 bubbles: false,
901 cancelable: false
902 },
903 pointercancel: {
904 eventInterface: 'PointerEvent',
905 bubbles: true,
906 cancelable: false
907 },
908 pointerdown: {
909 eventInterface: 'PointerEvent',
910 bubbles: true,
911 cancelable: true
912 },
913 pointerenter: {
914 eventInterface: 'PointerEvent',
915 bubbles: false,
916 cancelable: false
917 },
918 pointerleave: {
919 eventInterface: 'PointerEvent',
920 bubbles: false,
921 cancelable: false
922 },
923 pointerlockchange: {
924 eventInterface: 'Event',
925 bubbles: true,
926 cancelable: false
927 },
928 pointerlockerror: {
929 eventInterface: 'Event',
930 bubbles: true,
931 cancelable: false
932 },
933 pointermove: {
934 eventInterface: 'PointerEvent',
935 bubbles: true,
936 cancelable: true
937 },
938 pointerout: {
939 eventInterface: 'PointerEvent',
940 bubbles: true,
941 cancelable: true
942 },
943 pointerover: {
944 eventInterface: 'PointerEvent',
945 bubbles: true,
946 cancelable: true
947 },
948 pointerup: {
949 eventInterface: 'PointerEvent',
950 bubbles: true,
951 cancelable: true
952 },
953 play: {
954 eventInterface: 'Event',
955 bubbles: false,
956 cancelable: false
957 },
958 playing: {
959 eventInterface: 'Event',
960 bubbles: false,
961 cancelable: false
962 },
963 popstate: {
964 eventInterface: 'PopStateEvent',
965 bubbles: true,
966 cancelable: false
967 },
968 progress: {
969 eventInterface: 'ProgressEvent',
970 bubbles: false,
971 cancelable: false
972 },
973 push: {
974 eventInterface: 'PushEvent',
975 bubbles: false,
976 cancelable: false
977 },
978 pushsubscriptionchange: {
979 eventInterface: 'PushEvent',
980 bubbles: false,
981 cancelable: false
982 },
983 ratechange: {
984 eventInterface: 'Event',
985 bubbles: false,
986 cancelable: false
987 },
988 readystatechange: {
989 eventInterface: 'Event',
990 bubbles: false,
991 cancelable: false
992 },
993 repeatEvent: {
994 eventInterface: 'TimeEvent',
995 bubbles: false,
996 cancelable: false
997 },
998 reset: {
999 eventInterface: 'Event',
1000 bubbles: true,
1001 cancelable: true
1002 },
1003 resize: {
1004 eventInterface: 'UIEvent',
1005 bubbles: false,
1006 cancelable: false
1007 },
1008 resourcetimingbufferfull: {
1009 eventInterface: 'Performance',
1010 bubbles: true,
1011 cancelable: true
1012 },
1013 result: {
1014 eventInterface: 'SpeechRecognitionEvent',
1015 bubbles: false,
1016 cancelable: false
1017 },
1018 resume: {
1019 eventInterface: 'SpeechSynthesisEvent',
1020 bubbles: false,
1021 cancelable: false
1022 },
1023 scroll: {
1024 eventInterface: 'UIEvent',
1025 bubbles: false,
1026 cancelable: false
1027 },
1028 seeked: {
1029 eventInterface: 'Event',
1030 bubbles: false,
1031 cancelable: false
1032 },
1033 seeking: {
1034 eventInterface: 'Event',
1035 bubbles: false,
1036 cancelable: false
1037 },
1038 select: {
1039 eventInterface: 'UIEvent',
1040 bubbles: true,
1041 cancelable: false
1042 },
1043 selectstart: {
1044 eventInterface: 'Event',
1045 bubbles: true,
1046 cancelable: true
1047 },
1048 selectionchange: {
1049 eventInterface: 'Event',
1050 bubbles: false,
1051 cancelable: false
1052 },
1053 show: {
1054 eventInterface: 'MouseEvent',
1055 bubbles: false,
1056 cancelable: false
1057 },
1058 slotchange: {
1059 eventInterface: 'Event',
1060 bubbles: true,
1061 cancelable: false
1062 },
1063 soundend: {
1064 eventInterface: 'Event',
1065 bubbles: false,
1066 cancelable: false
1067 },
1068 soundstart: {
1069 eventInterface: 'Event',
1070 bubbles: false,
1071 cancelable: false
1072 },
1073 speechend: {
1074 eventInterface: 'Event',
1075 bubbles: false,
1076 cancelable: false
1077 },
1078 speechstart: {
1079 eventInterface: 'Event',
1080 bubbles: false,
1081 cancelable: false
1082 },
1083 stalled: {
1084 eventInterface: 'Event',
1085 bubbles: false,
1086 cancelable: false
1087 },
1088 start: {
1089 eventInterface: 'SpeechSynthesisEvent',
1090 bubbles: false,
1091 cancelable: false
1092 },
1093 storage: {
1094 eventInterface: 'StorageEvent',
1095 bubbles: false,
1096 cancelable: false
1097 },
1098 submit: {
1099 eventInterface: 'Event',
1100 bubbles: true,
1101 cancelable: true
1102 },
1103 success: {
1104 eventInterface: 'Event',
1105 bubbles: false,
1106 cancelable: false
1107 },
1108 suspend: {
1109 eventInterface: 'Event',
1110 bubbles: false,
1111 cancelable: false
1112 },
1113 SVGAbort: {
1114 eventInterface: 'SVGEvent',
1115 bubbles: true,
1116 cancelable: false
1117 },
1118 SVGError: {
1119 eventInterface: 'SVGEvent',
1120 bubbles: true,
1121 cancelable: false
1122 },
1123 SVGLoad: {
1124 eventInterface: 'SVGEvent',
1125 bubbles: false,
1126 cancelable: false
1127 },
1128 SVGResize: {
1129 eventInterface: 'SVGEvent',
1130 bubbles: true,
1131 cancelable: false
1132 },
1133 SVGScroll: {
1134 eventInterface: 'SVGEvent',
1135 bubbles: true,
1136 cancelable: false
1137 },
1138 SVGUnload: {
1139 eventInterface: 'SVGEvent',
1140 bubbles: false,
1141 cancelable: false
1142 },
1143 SVGZoom: {
1144 eventInterface: 'SVGZoomEvent',
1145 bubbles: true,
1146 cancelable: false
1147 },
1148 timeout: {
1149 eventInterface: 'ProgressEvent',
1150 bubbles: false,
1151 cancelable: false
1152 },
1153 timeupdate: {
1154 eventInterface: 'Event',
1155 bubbles: false,
1156 cancelable: false
1157 },
1158 touchcancel: {
1159 eventInterface: 'TouchEvent',
1160 bubbles: true,
1161 cancelable: false
1162 },
1163 touchend: {
1164 eventInterface: 'TouchEvent',
1165 bubbles: true,
1166 cancelable: true
1167 },
1168 touchmove: {
1169 eventInterface: 'TouchEvent',
1170 bubbles: true,
1171 cancelable: true
1172 },
1173 touchstart: {
1174 eventInterface: 'TouchEvent',
1175 bubbles: true,
1176 cancelable: true
1177 },
1178 transitionend: {
1179 eventInterface: 'TransitionEvent',
1180 bubbles: true,
1181 cancelable: true
1182 },
1183 unload: {
1184 eventInterface: 'UIEvent',
1185 bubbles: false,
1186 cancelable: false
1187 },
1188 updateready: {
1189 eventInterface: 'Event',
1190 bubbles: false,
1191 cancelable: false
1192 },
1193 userproximity: {
1194 eventInterface: 'UserProximityEvent',
1195 bubbles: false,
1196 cancelable: false
1197 },
1198 voiceschanged: {
1199 eventInterface: 'Event',
1200 bubbles: false,
1201 cancelable: false
1202 },
1203 visibilitychange: {
1204 eventInterface: 'Event',
1205 bubbles: true,
1206 cancelable: false
1207 },
1208 volumechange: {
1209 eventInterface: 'Event',
1210 bubbles: false,
1211 cancelable: false
1212 },
1213 waiting: {
1214 eventInterface: 'Event',
1215 bubbles: false,
1216 cancelable: false
1217 },
1218 wheel: {
1219 eventInterface: 'WheelEvent',
1220 bubbles: true,
1221 cancelable: true
1222 }
1223};
1224
1225/**
1226 * Groups modifiers into lists
1227 */
1228function generateModifiers(modifiers, isOnClick) {
1229 var keyModifiers = [];
1230 var systemModifiers = [];
1231 for (var i = 0; i < modifiers.length; i++) {
1232 var modifier = modifiers[i];
1233 // addEventListener() options, e.g. .passive & .capture, that we dont need to handle
1234 if (ignorableKeyModifiers.includes(modifier)) {
1235 continue;
1236 }
1237 // modifiers that require special conversion
1238 // if passed a left/right key modifier with onClick, add it here as well.
1239 if (systemKeyModifiers.includes(modifier) ||
1240 (mouseKeyModifiers.includes(modifier) &&
1241 isOnClick)) {
1242 systemModifiers.push(modifier);
1243 }
1244 else {
1245 keyModifiers.push(modifier);
1246 }
1247 }
1248 return {
1249 keyModifiers: keyModifiers,
1250 systemModifiers: systemModifiers
1251 };
1252}
1253function getEventProperties(eventParams) {
1254 var modifiers = eventParams.modifiers, _a = eventParams.options, options = _a === void 0 ? {} : _a, eventType = eventParams.eventType;
1255 var isOnClick = eventType === 'click';
1256 var _b = generateModifiers(modifiers, isOnClick), keyModifiers = _b.keyModifiers, systemModifiers = _b.systemModifiers;
1257 if (isOnClick) {
1258 // if it's a right click, it should fire a `contextmenu` event
1259 if (systemModifiers.includes('right')) {
1260 eventType = 'contextmenu';
1261 options.button = 2;
1262 // if its a middle click, fire a `mouseup` event
1263 }
1264 else if (systemModifiers.includes('middle')) {
1265 eventType = 'mouseup';
1266 options.button = 1;
1267 }
1268 }
1269 var meta = domEvents[eventType] || {
1270 eventInterface: 'Event',
1271 cancelable: true,
1272 bubbles: true
1273 };
1274 // convert `shift, ctrl` to `shiftKey, ctrlKey`
1275 // allows trigger('keydown.shift.ctrl.n') directly
1276 var systemModifiersMeta = systemModifiers.reduce(function (all, key) {
1277 all["".concat(key, "Key")] = true;
1278 return all;
1279 }, {});
1280 // get the keyCode for backwards compat
1281 var keyCode = keyCodesByKeyName[keyModifiers[0]] ||
1282 (options && (options.keyCode || options.code));
1283 var eventProperties = __assign(__assign(__assign(__assign({}, systemModifiersMeta), options), { bubbles: meta.bubbles, cancelable: meta.cancelable,
1284 // Any derived options should go here
1285 keyCode: keyCode, code: keyCode }), (keyModifiers[0] ? { key: keyModifiers[0] } : {}));
1286 return {
1287 eventProperties: eventProperties,
1288 meta: meta,
1289 eventType: eventType
1290 };
1291}
1292function createEvent(eventParams) {
1293 var _a = getEventProperties(eventParams), eventProperties = _a.eventProperties, meta = _a.meta, eventType = _a.eventType;
1294 // user defined eventInterface
1295 var eventInterface = meta.eventInterface;
1296 var metaEventInterface = window[eventInterface];
1297 var SupportedEventInterface = typeof metaEventInterface === 'function' ? metaEventInterface : window.Event;
1298 return new SupportedEventInterface(eventType,
1299 // event properties can only be added when the event is instantiated
1300 // custom properties must be added after the event has been instantiated
1301 eventProperties);
1302}
1303function createDOMEvent(eventString, options) {
1304 // split eventString like `keydown.ctrl.shift` into `keydown` and array of modifiers
1305 var _a = eventString.split('.'), eventType = _a[0], modifiers = _a.slice(1);
1306 var eventParams = {
1307 eventType: eventType,
1308 modifiers: modifiers,
1309 options: options
1310 };
1311 var event = createEvent(eventParams);
1312 var eventPrototype = Object.getPrototypeOf(event);
1313 // attach custom options to the event, like `relatedTarget` and so on.
1314 options &&
1315 Object.keys(options).forEach(function (key) {
1316 var propertyDescriptor = Object.getOwnPropertyDescriptor(eventPrototype, key);
1317 var canSetProperty = !(propertyDescriptor && propertyDescriptor.set === undefined);
1318 if (canSetProperty) {
1319 event[key] = options[key];
1320 }
1321 });
1322 return event;
1323}
1324
1325// Stubbing occurs when in vnode transformer we're swapping
1326// component vnode type due to stubbing either component
1327// or directive on component
1328// In order to be able to find components we need to track pairs
1329// stub --> original component
1330// Having this as global might feel unsafe at first point
1331// One can assume that sharing stub map across mounts might
1332// lead to false matches, however our vnode mappers always
1333// produce new nodeTypes for each mount even if you're reusing
1334// same stub, so we're safe and do not need to pass these stubs
1335// for each mount operation
1336var stubs = new WeakMap();
1337function registerStub(_a) {
1338 var source = _a.source, stub = _a.stub;
1339 stubs.set(stub, source);
1340}
1341function getOriginalComponentFromStub(stub) {
1342 return stubs.get(stub);
1343}
1344
1345var cacheStringFunction = function (fn) {
1346 var cache = Object.create(null);
1347 return (function (str) {
1348 var hit = cache[str];
1349 return hit || (cache[str] = fn(str));
1350 });
1351};
1352var camelizeRE = /-(\w)/g;
1353var camelize = cacheStringFunction(function (str) {
1354 return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
1355});
1356var capitalize = cacheStringFunction(function (str) {
1357 return str.charAt(0).toUpperCase() + str.slice(1);
1358});
1359var hyphenateRE = /\B([A-Z])/g;
1360var hyphenate = cacheStringFunction(function (str) {
1361 return str.replace(hyphenateRE, '-$1').toLowerCase();
1362});
1363
1364function matchName(target, sourceName) {
1365 var camelized = camelize(target);
1366 var capitalized = capitalize(camelized);
1367 return (!!sourceName &&
1368 (sourceName === target ||
1369 sourceName === camelized ||
1370 sourceName === capitalized ||
1371 capitalize(camelize(sourceName)) === capitalized));
1372}
1373
1374function isCompatEnabled(key) {
1375 var _a, _b;
1376 return (_b = (_a = Vue.compatUtils) === null || _a === void 0 ? void 0 : _a.isCompatEnabled(key)) !== null && _b !== void 0 ? _b : false;
1377}
1378function isLegacyExtendedComponent(component) {
1379 if (!isCompatEnabled('GLOBAL_EXTEND') || typeof component !== 'function') {
1380 return false;
1381 }
1382 return (hasOwnProperty(component, 'super') &&
1383 component.super.extend({}).super === component.super);
1384}
1385function unwrapLegacyVueExtendComponent(selector) {
1386 return isLegacyExtendedComponent(selector) ? selector.options : selector;
1387}
1388function isLegacyFunctionalComponent(component) {
1389 return Boolean(component &&
1390 typeof component === 'object' &&
1391 hasOwnProperty(component, 'functional') &&
1392 component.functional);
1393}
1394
1395var getComponentNameInSetup = function (instance, type) {
1396 return Object.keys((instance === null || instance === void 0 ? void 0 : instance.setupState) || {}).find(function (key) { var _a; return ((_a = Object.getOwnPropertyDescriptor(instance.setupState, key)) === null || _a === void 0 ? void 0 : _a.value) === type; });
1397};
1398var getComponentRegisteredName = function (instance, type) {
1399 if (!instance || !instance.parent)
1400 return null;
1401 // try to infer the name based on local resolution
1402 var registry = instance.type.components;
1403 for (var key in registry) {
1404 if (registry[key] === type) {
1405 return key;
1406 }
1407 }
1408 // try to retrieve name imported in script setup
1409 return getComponentNameInSetup(instance.parent, type) || null;
1410};
1411var getComponentName = function (instance, type) {
1412 if (isObjectComponent(type)) {
1413 return (
1414 // If the component we stub is a script setup component and is automatically
1415 // imported by unplugin-vue-components we can only get its name through
1416 // the `__name` property.
1417 getComponentNameInSetup(instance, type) || type.name || type.__name || '');
1418 }
1419 if (isLegacyExtendedComponent(type)) {
1420 return unwrapLegacyVueExtendComponent(type).name || '';
1421 }
1422 if (isFunctionalComponent(type)) {
1423 return type.displayName || type.name;
1424 }
1425 return '';
1426};
1427
1428/**
1429 * Detect whether a selector matches a VNode
1430 * @param node
1431 * @param selector
1432 * @return {boolean | ((value: any) => boolean)}
1433 */
1434function matches(node, rawSelector) {
1435 var _a, _b, _c;
1436 var selector = unwrapLegacyVueExtendComponent(rawSelector);
1437 // do not return none Vue components
1438 if (!node.component)
1439 return false;
1440 var nodeType = node.type;
1441 if (!isComponent(nodeType))
1442 return false;
1443 if (typeof selector === 'string') {
1444 return (_b = (_a = node.el) === null || _a === void 0 ? void 0 : _a.matches) === null || _b === void 0 ? void 0 : _b.call(_a, selector);
1445 }
1446 // When we're using stubs we want user to be able to
1447 // find stubbed components both by original component
1448 // or stub definition. That's why we are trying to
1449 // extract original component and also stub, which was
1450 // used to create specialized stub for render
1451 var nodeTypeCandidates = [
1452 nodeType,
1453 getOriginalComponentFromStub(nodeType)
1454 ].filter(Boolean);
1455 // our selector might be a stub itself
1456 var target = (_c = getOriginalComponentFromStub(selector)) !== null && _c !== void 0 ? _c : selector;
1457 if (nodeTypeCandidates.includes(target)) {
1458 return true;
1459 }
1460 var componentName;
1461 componentName = getComponentName(node.component, nodeType);
1462 var selectorName = selector.name;
1463 // the component and selector both have a name
1464 if (componentName && selectorName) {
1465 return matchName(selectorName, componentName);
1466 }
1467 componentName =
1468 getComponentRegisteredName(node.component, nodeType) || undefined;
1469 // if a name is missing, then check the locally registered components in the parent
1470 if (node.component.parent) {
1471 var registry = node.component.parent.type.components;
1472 for (var key in registry) {
1473 // is it the selector
1474 if (!selectorName && registry[key] === selector) {
1475 selectorName = key;
1476 }
1477 // is it the component
1478 if (!componentName && registry[key] === nodeType) {
1479 componentName = key;
1480 }
1481 }
1482 }
1483 if (selectorName && componentName) {
1484 return matchName(selectorName, componentName);
1485 }
1486 return false;
1487}
1488/**
1489 * Filters out the null, undefined and primitive values,
1490 * to only keep VNode and VNodeArrayChildren values
1491 * @param value
1492 */
1493function nodesAsObject(value) {
1494 return !!value && typeof value === 'object';
1495}
1496/**
1497 * Collect all children
1498 * @param nodes
1499 * @param children
1500 */
1501function aggregateChildren(nodes, children) {
1502 if (children && Array.isArray(children)) {
1503 var reversedNodes = __spreadArray([], children, true).reverse().filter(nodesAsObject);
1504 reversedNodes.forEach(function (node) {
1505 if (Array.isArray(node)) {
1506 aggregateChildren(nodes, node);
1507 }
1508 else {
1509 nodes.unshift(node);
1510 }
1511 });
1512 }
1513}
1514function findAllVNodes(vnode, selector) {
1515 var matchingNodes = [];
1516 var nodes = [vnode];
1517 while (nodes.length) {
1518 var node = nodes.shift();
1519 aggregateChildren(nodes, node.children);
1520 if (node.component) {
1521 aggregateChildren(nodes, [node.component.subTree]);
1522 }
1523 if (node.suspense) {
1524 // match children if component is Suspense
1525 var activeBranch = node.suspense.activeBranch;
1526 aggregateChildren(nodes, [activeBranch]);
1527 }
1528 if (matches(node, selector) && !matchingNodes.includes(node)) {
1529 matchingNodes.push(node);
1530 }
1531 }
1532 return matchingNodes;
1533}
1534function find(root, selector) {
1535 var matchingVNodes = findAllVNodes(root, selector);
1536 if (typeof selector === 'string') {
1537 // When searching by CSS selector we want only one (topmost) vnode for each el`
1538 matchingVNodes = matchingVNodes.filter(function (vnode) { var _a; return ((_a = vnode.component.parent) === null || _a === void 0 ? void 0 : _a.vnode.el) !== vnode.el; });
1539 }
1540 return matchingVNodes.map(function (vnode) { return vnode.component; });
1541}
1542
1543function createWrapperError(wrapperType) {
1544 return new Proxy(Object.create(null), {
1545 get: function (obj, prop) {
1546 switch (prop) {
1547 case 'then':
1548 // allows for better errors when wrapping `find` in `await`
1549 // https://github.com/vuejs/test-utils/issues/638
1550 return;
1551 case 'exists':
1552 return function () { return false; };
1553 default:
1554 throw new Error("Cannot call ".concat(String(prop), " on an empty ").concat(wrapperType, "."));
1555 }
1556 }
1557 });
1558}
1559
1560/*!
1561 * isElementVisible
1562 * Adapted from https://github.com/testing-library/jest-dom
1563 * Licensed under the MIT License.
1564 */
1565function isStyleVisible(element) {
1566 if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {
1567 return false;
1568 }
1569 var _a = getComputedStyle(element), display = _a.display, visibility = _a.visibility, opacity = _a.opacity;
1570 return (display !== 'none' &&
1571 visibility !== 'hidden' &&
1572 visibility !== 'collapse' &&
1573 opacity !== '0');
1574}
1575function isAttributeVisible(element) {
1576 return (!element.hasAttribute('hidden') &&
1577 (element.nodeName === 'DETAILS' ? element.hasAttribute('open') : true));
1578}
1579function isElementVisible(element) {
1580 return (element.nodeName !== '#comment' &&
1581 isStyleVisible(element) &&
1582 isAttributeVisible(element) &&
1583 (!element.parentElement || isElementVisible(element.parentElement)));
1584}
1585
1586function isElement(element) {
1587 return element instanceof Element;
1588}
1589
1590var WrapperType;
1591(function (WrapperType) {
1592 WrapperType[WrapperType["DOMWrapper"] = 0] = "DOMWrapper";
1593 WrapperType[WrapperType["VueWrapper"] = 1] = "VueWrapper";
1594})(WrapperType || (WrapperType = {}));
1595var factories = {};
1596function registerFactory(type, fn) {
1597 factories[type] = fn;
1598}
1599var createDOMWrapper = function (element) {
1600 return factories[WrapperType.DOMWrapper](element);
1601};
1602var createVueWrapper = function (app, vm, setProps) {
1603 return factories[WrapperType.VueWrapper](app, vm, setProps);
1604};
1605
1606function stringifyNode(node) {
1607 return node instanceof Element
1608 ? node.outerHTML
1609 : new XMLSerializer().serializeToString(node);
1610}
1611
1612function getDefaultExportFromCjs (x) {
1613 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1614}
1615
1616var js = {exports: {}};
1617</