Socket
Socket
Sign inDemoInstall

@testing-library/user-event

Package Overview
Dependencies
Maintainers
15
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/user-event - npm Package Compare versions

Comparing version 14.5.0 to 14.5.1

11

dist/cjs/_interop/dtl.js
'use strict';
var def = require('@testing-library/dom');
var named = require('@testing-library/dom');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {

@@ -25,7 +23,6 @@ if (e && e.__esModule) return e;

var def__default = /*#__PURE__*/_interopDefaultLegacy(def);
var def__namespace = /*#__PURE__*/_interopNamespace(def);
var named__namespace = /*#__PURE__*/_interopNamespace(named);
var dtl = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
module.exports = dtl;
module.exports = named__namespace;
'use strict';
var def = require('@testing-library/dom/dist/event-map.js');
var named = require('@testing-library/dom/dist/event-map.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {

@@ -25,7 +23,6 @@ if (e && e.__esModule) return e;

var def__default = /*#__PURE__*/_interopDefaultLegacy(def);
var def__namespace = /*#__PURE__*/_interopNamespace(def);
var named__namespace = /*#__PURE__*/_interopNamespace(named);
var dtlEvents = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
module.exports = dtlEvents;
module.exports = named__namespace;
'use strict';
var def = require('@testing-library/dom/dist/helpers.js');
var named = require('@testing-library/dom/dist/helpers.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {

@@ -25,7 +23,6 @@ if (e && e.__esModule) return e;

var def__default = /*#__PURE__*/_interopDefaultLegacy(def);
var def__namespace = /*#__PURE__*/_interopNamespace(def);
var named__namespace = /*#__PURE__*/_interopNamespace(named);
var dtlHelpers = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
module.exports = dtlHelpers;
module.exports = named__namespace;

@@ -19,11 +19,9 @@ 'use strict';

function prepareInterceptor(element, propName, interceptorImpl) {
var _prototypeDescriptor, _prototypeDescriptor1;
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
const target = ((_prototypeDescriptor = prototypeDescriptor) === null || _prototypeDescriptor === void 0 ? void 0 : _prototypeDescriptor.set) ? 'set' : 'value';
/* istanbul ignore if */ if (typeof ((_prototypeDescriptor1 = prototypeDescriptor) === null || _prototypeDescriptor1 === void 0 ? void 0 : _prototypeDescriptor1[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value';
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
}
function intercept(...args) {
var _then;
const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);

@@ -36,3 +34,3 @@ const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];

}
(_then = then) === null || _then === void 0 ? void 0 : _then();
then === null || then === void 0 ? void 0 : then();
}

@@ -39,0 +37,0 @@ intercept[Interceptor] = Interceptor;

@@ -46,6 +46,6 @@ 'use strict';

function commitValueAfterInput(element, cursorOffset) {
var _changes_tracked, _changes;
var _changes_tracked;
const changes = element[TrackChanges];
element[TrackChanges] = undefined;
if (!((_changes = changes) === null || _changes === void 0 ? void 0 : (_changes_tracked = _changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
if (!(changes === null || changes === void 0 ? void 0 : (_changes_tracked = changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
return;

@@ -52,0 +52,0 @@ }

@@ -26,5 +26,5 @@ 'use strict';

registry.behavior.keydown = (event, target, instance)=>{
var _keydownBehavior_event_key, _keydownBehavior;
var _keydownBehavior_event_key;
var _keydownBehavior_event_key1;
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = (_keydownBehavior = keydownBehavior)[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(_keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
};

@@ -31,0 +31,0 @@ const keydownBehavior = {

@@ -23,5 +23,4 @@ 'use strict';

} else if (isElementType.isElementType(target, 'input')) {
var _form;
const form = target.form;
const submit = (_form = form) === null || _form === void 0 ? void 0 : _form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
if (submit) {

@@ -28,0 +27,0 @@ return ()=>instance.dispatchUIEvent(submit, 'click');

@@ -14,4 +14,4 @@ 'use strict';

registry.behavior.keyup = (event, target, instance)=>{
var _keyupBehavior_event_key, _keyupBehavior;
return (_keyupBehavior_event_key = (_keyupBehavior = keyupBehavior)[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(_keyupBehavior, event, target, instance);
var _keyupBehavior_event_key;
return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
};

@@ -18,0 +18,0 @@ const keyupBehavior = {

@@ -27,5 +27,5 @@ 'use strict';

function dispatchEvent(target, event, preventDefault = false) {
var _behavior_type, _behavior;
var _behavior_type;
const type = event.type;
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = (_behavior = registry.behavior)[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(_behavior, event, target, this);
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = registry.behavior[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(registry.behavior, event, target, this);
if (behaviorImplementation) {

@@ -32,0 +32,0 @@ event.preventDefault();

@@ -5,6 +5,26 @@ 'use strict';

var dtlEventMap = require('../_interop/dtlEventMap.js');
var named = require('@testing-library/dom/dist/event-map.js');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var named__namespace = /*#__PURE__*/_interopNamespace(named);
const eventMap = {
...dtlEventMap.eventMap,
...named__namespace.eventMap,
click: {

@@ -11,0 +31,0 @@ EventType: 'PointerEvent',

@@ -29,6 +29,3 @@ 'use strict';

} else {
wrapEvent.wrapEvent(()=>{
var _activeElement;
return (_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.blur();
});
wrapEvent.wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
}

@@ -35,0 +32,0 @@ updateSelectionOnFocus.updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);

@@ -20,3 +20,2 @@ 'use strict';

*/ function getTargetTypeAndSelection(node) {
var _element, _selection;
const element = getElement(node);

@@ -29,6 +28,6 @@ if (element && selection.hasOwnSelection(element)) {

}
const selection$1 = (_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.getSelection();
const selection$1 = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection();
// It is possible to extend a single-range selection into a contenteditable.
// This results in the range acting like a range outside of contenteditable.
const isCE = isContentEditable.getContentEditable(node) && ((_selection = selection$1) === null || _selection === void 0 ? void 0 : _selection.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
const isCE = isContentEditable.getContentEditable(node) && (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
return {

@@ -35,0 +34,0 @@ type: isCE ? 'contenteditable' : 'default',

@@ -36,3 +36,2 @@ 'use strict';

} else {
var _selection, _selection1;
const range = selectionRange.cloneRange();

@@ -46,4 +45,4 @@ const cmp = range.comparePoint(selectionFocus.node, selectionFocus.offset);

const selection = document.getSelection();
(_selection = selection) === null || _selection === void 0 ? void 0 : _selection.removeAllRanges();
(_selection1 = selection) === null || _selection1 === void 0 ? void 0 : _selection1.addRange(range.cloneRange());
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
}

@@ -50,0 +49,0 @@ }

@@ -29,5 +29,4 @@ 'use strict';

} else {
var _selection;
const selection = node.ownerDocument.getSelection();
if (!((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.focusNode)) {
if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
return;

@@ -34,0 +33,0 @@ }

@@ -37,3 +37,2 @@ 'use strict';

function isAllSelected(target) {
var _selection;
if (selection.hasOwnSelection(target)) {

@@ -45,3 +44,3 @@ return UI.getUISelection(target).startOffset === 0 && UI.getUISelection(target).endOffset === UI.getUIValue(target).length;

const selection$1 = target.ownerDocument.getSelection();
return ((_selection = selection$1) === null || _selection === void 0 ? void 0 : _selection.anchorNode) === focusNode && selection$1.focusNode === focusNode && selection$1.anchorOffset === 0 && selection$1.focusOffset === focusNode.childNodes.length;
return (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) === focusNode && selection$1.focusNode === focusNode && selection$1.anchorOffset === 0 && selection$1.focusOffset === focusNode.childNodes.length;
}

@@ -48,0 +47,0 @@

@@ -46,3 +46,2 @@ 'use strict';

} else {
var _selection, _selection1;
const { node: startNode, offset: startOffset } = resolveCaretPosition.resolveCaretPosition({

@@ -66,4 +65,4 @@ target,

const selection = document.getSelection();
(_selection = selection) === null || _selection === void 0 ? void 0 : _selection.removeAllRanges();
(_selection1 = selection) === null || _selection1 === void 0 ? void 0 : _selection1.addRange(range.cloneRange());
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
return range;

@@ -70,0 +69,0 @@ }

@@ -20,5 +20,4 @@ 'use strict';

*/ function updateSelectionOnFocus(element) {
var _selection;
const selection$1 = element.ownerDocument.getSelection();
/* istanbul ignore if */ if (!((_selection = selection$1) === null || _selection === void 0 ? void 0 : _selection.focusNode)) {
/* istanbul ignore if */ if (!(selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.focusNode)) {
return;

@@ -25,0 +24,0 @@ }

@@ -5,5 +5,25 @@ 'use strict';

var dtl = require('../_interop/dtl.js');
var named = require('@testing-library/dom');
const { getConfig } = dtl;
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var named__namespace = /*#__PURE__*/_interopNamespace(named);
const { getConfig } = named__namespace;
function wrapEvent(cb, _element) {

@@ -10,0 +30,0 @@ return getConfig().eventWrapper(cb);

@@ -40,3 +40,3 @@ 'use strict';

async function pointerAction(instance, action) {
var _previousPosition, _previousPosition_caret, _previousPosition1, _previousPosition_caret1, _previousPosition2;
var _previousPosition_caret, _previousPosition_caret1;
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? instance.system.pointer.getPointerName(action.keyDef) : 'mouse';

@@ -47,6 +47,6 @@ const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);

target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : (_previousPosition = previousPosition) === null || _previousPosition === void 0 ? void 0 : _previousPosition.coords,
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
caret: {
node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : (_previousPosition1 = previousPosition) === null || _previousPosition1 === void 0 ? void 0 : (_previousPosition_caret = _previousPosition1.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : (_previousPosition2 = previousPosition) === null || _previousPosition2 === void 0 ? void 0 : (_previousPosition_caret1 = _previousPosition2.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret = previousPosition.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret1 = previousPosition.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
}

@@ -53,0 +53,0 @@ };

@@ -5,5 +5,25 @@ 'use strict';

var dtl = require('../_interop/dtl.js');
var named = require('@testing-library/dom');
const { getConfig } = dtl;
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var named__namespace = /*#__PURE__*/_interopNamespace(named);
const { getConfig } = named__namespace;
/**

@@ -10,0 +30,0 @@ * Wrap an internal Promise

@@ -43,3 +43,2 @@ 'use strict';

async move(instance, pointerName, position) {
var _pointermove, _mousemove, _pointermove1, _mousemove1, _pointermove2, _mousemove2;
const pointer = this.pointers.get(pointerName);

@@ -52,8 +51,8 @@ // In (some?) browsers this order of events can be observed.

const mousemove = pointer.pointerType === 'touch' || pointer.isPrevented && pointer.isDown ? undefined : this.mouse.move(instance, position);
(_pointermove = pointermove) === null || _pointermove === void 0 ? void 0 : _pointermove.leave();
(_mousemove = mousemove) === null || _mousemove === void 0 ? void 0 : _mousemove.leave();
(_pointermove1 = pointermove) === null || _pointermove1 === void 0 ? void 0 : _pointermove1.enter();
(_mousemove1 = mousemove) === null || _mousemove1 === void 0 ? void 0 : _mousemove1.enter();
(_pointermove2 = pointermove) === null || _pointermove2 === void 0 ? void 0 : _pointermove2.move();
(_mousemove2 = mousemove) === null || _mousemove2 === void 0 ? void 0 : _mousemove2.move();
pointermove === null || pointermove === void 0 ? void 0 : pointermove.leave();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
pointermove === null || pointermove === void 0 ? void 0 : pointermove.enter();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
pointermove === null || pointermove === void 0 ? void 0 : pointermove.move();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
}

@@ -78,15 +77,13 @@ async release(instance, keyDef, position) {

if (pointer.pointerType === 'touch' && !pointer.isMultitouch) {
var _mousemove, _mousemove1, _mousemove2;
const mousemove = this.mouse.move(instance, pointer.position);
(_mousemove = mousemove) === null || _mousemove === void 0 ? void 0 : _mousemove.leave();
(_mousemove1 = mousemove) === null || _mousemove1 === void 0 ? void 0 : _mousemove1.enter();
(_mousemove2 = mousemove) === null || _mousemove2 === void 0 ? void 0 : _mousemove2.move();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
this.mouse.down(instance, keyDef, pointer);
}
if (!pointer.isMultitouch) {
var _mousemove3, _mousemove4, _mousemove5;
const mousemove = this.mouse.move(instance, pointer.position);
(_mousemove3 = mousemove) === null || _mousemove3 === void 0 ? void 0 : _mousemove3.leave();
(_mousemove4 = mousemove) === null || _mousemove4 === void 0 ? void 0 : _mousemove4.enter();
(_mousemove5 = mousemove) === null || _mousemove5 === void 0 ? void 0 : _mousemove5.move();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
this.mouse.up(instance, keyDef, pointer);

@@ -93,0 +90,0 @@ }

@@ -5,3 +5,3 @@ 'use strict';

var dtl = require('../_interop/dtl.js');
var named = require('@testing-library/dom');
require('../utils/click/isClickableInput.js');

@@ -27,3 +27,23 @@ require('../utils/dataTransfer/Clipboard.js');

const { getConfig } = dtl;
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var named__namespace = /*#__PURE__*/_interopNamespace(named);
const { getConfig } = named__namespace;
async function selectOptions(select, values) {

@@ -30,0 +50,0 @@ return selectOptionsBase.call(this, true, select, values);

@@ -23,4 +23,3 @@ 'use strict';

})) {
var _input;
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${(_input = input) === null || _input === void 0 ? void 0 : _input.tagName} element does not accept file uploads`);
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === void 0 ? void 0 : input.tagName} element does not accept file uploads`);
}

@@ -27,0 +26,0 @@ if (isDisabled.isDisabled(element)) return;

@@ -89,4 +89,3 @@ 'use strict';

function isClipboardStub(clipboard) {
var _clipboard;
return !!((_clipboard = clipboard) === null || _clipboard === void 0 ? void 0 : _clipboard[ClipboardStubControl]);
return !!(clipboard === null || clipboard === void 0 ? void 0 : clipboard[ClipboardStubControl]);
}

@@ -132,5 +131,4 @@ function attachClipboardStubToView(window) {

async function readDataTransferFromClipboard(document) {
var _window;
const window = document.defaultView;
const clipboard = (_window = window) === null || _window === void 0 ? void 0 : _window.navigator.clipboard;
const clipboard = window === null || window === void 0 ? void 0 : window.navigator.clipboard;
const items = clipboard && await clipboard.read();

@@ -137,0 +135,0 @@ if (!items) {

@@ -73,7 +73,6 @@ 'use strict';

getData(format) {
var _match;
var _this_items_find;
const match = (_this_items_find = this.items.find(getTypeMatcher(format, true))) !== null && _this_items_find !== void 0 ? _this_items_find : this.items.find(getTypeMatcher(format, false));
let text = '';
(_match = match) === null || _match === void 0 ? void 0 : _match.getAsString((t)=>{
match === null || match === void 0 ? void 0 : match.getAsString((t)=>{
text = t;

@@ -80,0 +79,0 @@ });

@@ -43,4 +43,4 @@ 'use strict';

} else {
var _valueDescr_set, _valueDescr;
(_valueDescr = valueDescr) === null || _valueDescr === void 0 ? void 0 : (_valueDescr_set = _valueDescr.set) === null || _valueDescr_set === void 0 ? void 0 : _valueDescr_set.call(el, v);
var _valueDescr_set;
valueDescr === null || valueDescr === void 0 ? void 0 : (_valueDescr_set = valueDescr.set) === null || _valueDescr_set === void 0 ? void 0 : _valueDescr_set.call(el, v);
}

@@ -47,0 +47,0 @@ }

@@ -8,5 +8,4 @@ 'use strict';

function getActiveElement(document) {
var _activeElement;
const activeElement = document.activeElement;
if ((_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.shadowRoot) {
if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) {
return getActiveElement(activeElement.shadowRoot);

@@ -13,0 +12,0 @@ } else {

@@ -5,5 +5,25 @@ 'use strict';

var dtlHelpers = require('../../_interop/dtlHelpers.js');
var named = require('@testing-library/dom/dist/helpers.js');
const { getWindowFromNode } = dtlHelpers;
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var named__namespace = /*#__PURE__*/_interopNamespace(named);
const { getWindowFromNode } = named__namespace;
function getWindow(node) {

@@ -10,0 +30,0 @@ return getWindowFromNode(node);

@@ -8,5 +8,4 @@ 'use strict';

function isVisible(element) {
var _el;
const window = getWindow.getWindow(element);
for(let el = element; (_el = el) === null || _el === void 0 ? void 0 : _el.ownerDocument; el = el.parentElement){
for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
const { display, visibility } = window.getComputedStyle(el);

@@ -13,0 +12,0 @@ if (display === 'none') {

@@ -15,5 +15,4 @@ 'use strict';

function closestPointerEventsDeclaration(element) {
var _el;
const window = getWindow.getWindow(element);
for(let el = element, tree = []; (_el = el) === null || _el === void 0 ? void 0 : _el.ownerDocument; el = el.parentElement){
for(let el = element, tree = []; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
tree.push(el);

@@ -38,4 +37,3 @@ const pointerEvents = window.getComputedStyle(el).pointerEvents;

if (!needsCheck) {
var _lastCheck;
return (_lastCheck = lastCheck) === null || _lastCheck === void 0 ? void 0 : _lastCheck.result;
return lastCheck === null || lastCheck === void 0 ? void 0 : lastCheck.result;
}

@@ -51,5 +49,4 @@ const declaration = closestPointerEventsDeclaration(element);

function assertPointerEvents(instance, element) {
var _declaration;
const declaration = checkPointerEvents(instance, element);
if (((_declaration = declaration) === null || _declaration === void 0 ? void 0 : _declaration.pointerEvents) === 'none') {
if ((declaration === null || declaration === void 0 ? void 0 : declaration.pointerEvents) === 'none') {
throw new Error([

@@ -74,3 +71,3 @@ `Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? 'inherits' : 'has'} \`pointer-events: none\`:`,

function getLabelDescr(element) {
var _element_labels, _label, _label1;
var _element_labels;
let label;

@@ -99,6 +96,5 @@ if (element.hasAttribute('aria-label')) {

}
label = (_label = label) === null || _label === void 0 ? void 0 : _label.replace(/\n/g, ' ');
if (Number((_label1 = label) === null || _label1 === void 0 ? void 0 : _label1.length) > 30) {
var _label2;
label = `${(_label2 = label) === null || _label2 === void 0 ? void 0 : _label2.substring(0, 29)}…`;
label = label === null || label === void 0 ? void 0 : label.replace(/\n/g, ' ');
if (Number(label === null || label === void 0 ? void 0 : label.length) > 30) {
label = `${label === null || label === void 0 ? void 0 : label.substring(0, 29)}…`;
}

@@ -105,0 +101,0 @@ return label ? `(label=${label})` : '';

@@ -1,6 +0,2 @@

import * as def from '@testing-library/dom';
import def__default from '@testing-library/dom';
var dtl = def__default !== null && def__default !== void 0 ? def__default : def;
export { dtl as default };
import * as named from '@testing-library/dom';
export { named as default };

@@ -1,6 +0,2 @@

import * as def from '@testing-library/dom/dist/event-map.js';
import def__default from '@testing-library/dom/dist/event-map.js';
var dtlEvents = def__default !== null && def__default !== void 0 ? def__default : def;
export { dtlEvents as default };
import * as named from '@testing-library/dom/dist/event-map.js';
export { named as default };

@@ -1,6 +0,2 @@

import * as def from '@testing-library/dom/dist/helpers.js';
import def__default from '@testing-library/dom/dist/helpers.js';
var dtlHelpers = def__default !== null && def__default !== void 0 ? def__default : def;
export { dtlHelpers as default };
import * as named from '@testing-library/dom/dist/helpers.js';
export { named as default };

@@ -15,11 +15,9 @@ import '../utils/click/isClickableInput.js';

function prepareInterceptor(element, propName, interceptorImpl) {
var _prototypeDescriptor, _prototypeDescriptor1;
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
const target = ((_prototypeDescriptor = prototypeDescriptor) === null || _prototypeDescriptor === void 0 ? void 0 : _prototypeDescriptor.set) ? 'set' : 'value';
/* istanbul ignore if */ if (typeof ((_prototypeDescriptor1 = prototypeDescriptor) === null || _prototypeDescriptor1 === void 0 ? void 0 : _prototypeDescriptor1[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value';
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
}
function intercept(...args) {
var _then;
const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);

@@ -32,3 +30,3 @@ const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];

}
(_then = then) === null || _then === void 0 ? void 0 : _then();
then === null || then === void 0 ? void 0 : then();
}

@@ -35,0 +33,0 @@ intercept[Interceptor] = Interceptor;

@@ -42,6 +42,6 @@ import '../utils/click/isClickableInput.js';

function commitValueAfterInput(element, cursorOffset) {
var _changes_tracked, _changes;
var _changes_tracked;
const changes = element[TrackChanges];
element[TrackChanges] = undefined;
if (!((_changes = changes) === null || _changes === void 0 ? void 0 : (_changes_tracked = _changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
if (!(changes === null || changes === void 0 ? void 0 : (_changes_tracked = changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
return;

@@ -48,0 +48,0 @@ }

@@ -24,5 +24,5 @@ import { getUIValue, setUISelection } from '../../document/UI.js';

behavior.keydown = (event, target, instance)=>{
var _keydownBehavior_event_key, _keydownBehavior;
var _keydownBehavior_event_key;
var _keydownBehavior_event_key1;
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = (_keydownBehavior = keydownBehavior)[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(_keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = keydownBehavior[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
};

@@ -29,0 +29,0 @@ const keydownBehavior = {

@@ -21,5 +21,4 @@ import '../../utils/click/isClickableInput.js';

} else if (isElementType(target, 'input')) {
var _form;
const form = target.form;
const submit = (_form = form) === null || _form === void 0 ? void 0 : _form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
if (submit) {

@@ -26,0 +25,0 @@ return ()=>instance.dispatchUIEvent(submit, 'click');

@@ -12,4 +12,4 @@ import { isClickableInput } from '../../utils/click/isClickableInput.js';

behavior.keyup = (event, target, instance)=>{
var _keyupBehavior_event_key, _keyupBehavior;
return (_keyupBehavior_event_key = (_keyupBehavior = keyupBehavior)[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(_keyupBehavior, event, target, instance);
var _keyupBehavior_event_key;
return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
};

@@ -16,0 +16,0 @@ const keyupBehavior = {

@@ -23,5 +23,5 @@ import './behavior/click.js';

function dispatchEvent(target, event, preventDefault = false) {
var _behavior_type, _behavior;
var _behavior_type;
const type = event.type;
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = (_behavior = behavior)[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(_behavior, event, target, this);
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = behavior[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(behavior, event, target, this);
if (behaviorImplementation) {

@@ -28,0 +28,0 @@ event.preventDefault();

@@ -1,5 +0,5 @@

import dtlEvents from '../_interop/dtlEventMap.js';
import * as named from '@testing-library/dom/dist/event-map.js';
const eventMap = {
...dtlEvents.eventMap,
...named.eventMap,
click: {

@@ -6,0 +6,0 @@ EventType: 'PointerEvent',

@@ -25,6 +25,3 @@ import '../utils/click/isClickableInput.js';

} else {
wrapEvent(()=>{
var _activeElement;
return (_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.blur();
});
wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
}

@@ -31,0 +28,0 @@ updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);

@@ -16,3 +16,2 @@ import { getUISelection } from '../../document/UI.js';

*/ function getTargetTypeAndSelection(node) {
var _element, _selection;
const element = getElement(node);

@@ -25,6 +24,6 @@ if (element && hasOwnSelection(element)) {

}
const selection = (_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.getSelection();
const selection = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection();
// It is possible to extend a single-range selection into a contenteditable.
// This results in the range acting like a range outside of contenteditable.
const isCE = getContentEditable(node) && ((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.anchorNode) && getContentEditable(selection.anchorNode);
const isCE = getContentEditable(node) && (selection === null || selection === void 0 ? void 0 : selection.anchorNode) && getContentEditable(selection.anchorNode);
return {

@@ -31,0 +30,0 @@ type: isCE ? 'contenteditable' : 'default',

@@ -32,3 +32,2 @@ import { setUISelection } from '../../document/UI.js';

} else {
var _selection, _selection1;
const range = selectionRange.cloneRange();

@@ -42,4 +41,4 @@ const cmp = range.comparePoint(selectionFocus.node, selectionFocus.offset);

const selection = document.getSelection();
(_selection = selection) === null || _selection === void 0 ? void 0 : _selection.removeAllRanges();
(_selection1 = selection) === null || _selection1 === void 0 ? void 0 : _selection1.addRange(range.cloneRange());
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
}

@@ -46,0 +45,0 @@ }

@@ -25,5 +25,4 @@ import { getUISelection } from '../../document/UI.js';

} else {
var _selection;
const selection = node.ownerDocument.getSelection();
if (!((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.focusNode)) {
if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
return;

@@ -30,0 +29,0 @@ }

@@ -33,3 +33,2 @@ import { getUIValue, getUISelection } from '../../document/UI.js';

function isAllSelected(target) {
var _selection;
if (hasOwnSelection(target)) {

@@ -41,5 +40,5 @@ return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length;

const selection = target.ownerDocument.getSelection();
return ((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
}
export { isAllSelected, selectAll };

@@ -42,3 +42,2 @@ import { getUIValue, setUISelection } from '../../document/UI.js';

} else {
var _selection, _selection1;
const { node: startNode, offset: startOffset } = resolveCaretPosition({

@@ -62,4 +61,4 @@ target,

const selection = document.getSelection();
(_selection = selection) === null || _selection === void 0 ? void 0 : _selection.removeAllRanges();
(_selection1 = selection) === null || _selection1 === void 0 ? void 0 : _selection1.addRange(range.cloneRange());
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
return range;

@@ -66,0 +65,0 @@ }

@@ -16,5 +16,4 @@ import '../../utils/click/isClickableInput.js';

*/ function updateSelectionOnFocus(element) {
var _selection;
const selection = element.ownerDocument.getSelection();
/* istanbul ignore if */ if (!((_selection = selection) === null || _selection === void 0 ? void 0 : _selection.focusNode)) {
/* istanbul ignore if */ if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
return;

@@ -21,0 +20,0 @@ }

@@ -1,4 +0,4 @@

import dtl from '../_interop/dtl.js';
import * as named from '@testing-library/dom';
const { getConfig } = dtl;
const { getConfig } = named;
function wrapEvent(cb, _element) {

@@ -5,0 +5,0 @@ return getConfig().eventWrapper(cb);

@@ -36,3 +36,3 @@ import '../utils/click/isClickableInput.js';

async function pointerAction(instance, action) {
var _previousPosition, _previousPosition_caret, _previousPosition1, _previousPosition_caret1, _previousPosition2;
var _previousPosition_caret, _previousPosition_caret1;
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? instance.system.pointer.getPointerName(action.keyDef) : 'mouse';

@@ -43,6 +43,6 @@ const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);

target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : (_previousPosition = previousPosition) === null || _previousPosition === void 0 ? void 0 : _previousPosition.coords,
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
caret: {
node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : (_previousPosition1 = previousPosition) === null || _previousPosition1 === void 0 ? void 0 : (_previousPosition_caret = _previousPosition1.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : (_previousPosition2 = previousPosition) === null || _previousPosition2 === void 0 ? void 0 : (_previousPosition_caret1 = _previousPosition2.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret = previousPosition.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret1 = previousPosition.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
}

@@ -49,0 +49,0 @@ };

@@ -1,4 +0,4 @@

import dtl from '../_interop/dtl.js';
import * as named from '@testing-library/dom';
const { getConfig } = dtl;
const { getConfig } = named;
/**

@@ -5,0 +5,0 @@ * Wrap an internal Promise

@@ -39,3 +39,2 @@ import { Buttons } from './buttons.js';

async move(instance, pointerName, position) {
var _pointermove, _mousemove, _pointermove1, _mousemove1, _pointermove2, _mousemove2;
const pointer = this.pointers.get(pointerName);

@@ -48,8 +47,8 @@ // In (some?) browsers this order of events can be observed.

const mousemove = pointer.pointerType === 'touch' || pointer.isPrevented && pointer.isDown ? undefined : this.mouse.move(instance, position);
(_pointermove = pointermove) === null || _pointermove === void 0 ? void 0 : _pointermove.leave();
(_mousemove = mousemove) === null || _mousemove === void 0 ? void 0 : _mousemove.leave();
(_pointermove1 = pointermove) === null || _pointermove1 === void 0 ? void 0 : _pointermove1.enter();
(_mousemove1 = mousemove) === null || _mousemove1 === void 0 ? void 0 : _mousemove1.enter();
(_pointermove2 = pointermove) === null || _pointermove2 === void 0 ? void 0 : _pointermove2.move();
(_mousemove2 = mousemove) === null || _mousemove2 === void 0 ? void 0 : _mousemove2.move();
pointermove === null || pointermove === void 0 ? void 0 : pointermove.leave();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
pointermove === null || pointermove === void 0 ? void 0 : pointermove.enter();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
pointermove === null || pointermove === void 0 ? void 0 : pointermove.move();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
}

@@ -74,15 +73,13 @@ async release(instance, keyDef, position) {

if (pointer.pointerType === 'touch' && !pointer.isMultitouch) {
var _mousemove, _mousemove1, _mousemove2;
const mousemove = this.mouse.move(instance, pointer.position);
(_mousemove = mousemove) === null || _mousemove === void 0 ? void 0 : _mousemove.leave();
(_mousemove1 = mousemove) === null || _mousemove1 === void 0 ? void 0 : _mousemove1.enter();
(_mousemove2 = mousemove) === null || _mousemove2 === void 0 ? void 0 : _mousemove2.move();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
this.mouse.down(instance, keyDef, pointer);
}
if (!pointer.isMultitouch) {
var _mousemove3, _mousemove4, _mousemove5;
const mousemove = this.mouse.move(instance, pointer.position);
(_mousemove3 = mousemove) === null || _mousemove3 === void 0 ? void 0 : _mousemove3.leave();
(_mousemove4 = mousemove) === null || _mousemove4 === void 0 ? void 0 : _mousemove4.enter();
(_mousemove5 = mousemove) === null || _mousemove5 === void 0 ? void 0 : _mousemove5.move();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
this.mouse.up(instance, keyDef, pointer);

@@ -89,0 +86,0 @@ }

@@ -1,2 +0,2 @@

import dtl from '../_interop/dtl.js';
import * as named from '@testing-library/dom';
import '../utils/click/isClickableInput.js';

@@ -22,3 +22,3 @@ import '../utils/dataTransfer/Clipboard.js';

const { getConfig } = dtl;
const { getConfig } = named;
async function selectOptions(select, values) {

@@ -25,0 +25,0 @@ return selectOptionsBase.call(this, true, select, values);

@@ -19,4 +19,3 @@ import '../utils/click/isClickableInput.js';

})) {
var _input;
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${(_input = input) === null || _input === void 0 ? void 0 : _input.tagName} element does not accept file uploads`);
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === void 0 ? void 0 : input.tagName} element does not accept file uploads`);
}

@@ -23,0 +22,0 @@ if (isDisabled(element)) return;

@@ -85,4 +85,3 @@ import { getWindow } from '../misc/getWindow.js';

function isClipboardStub(clipboard) {
var _clipboard;
return !!((_clipboard = clipboard) === null || _clipboard === void 0 ? void 0 : _clipboard[ClipboardStubControl]);
return !!(clipboard === null || clipboard === void 0 ? void 0 : clipboard[ClipboardStubControl]);
}

@@ -128,5 +127,4 @@ function attachClipboardStubToView(window) {

async function readDataTransferFromClipboard(document) {
var _window;
const window = document.defaultView;
const clipboard = (_window = window) === null || _window === void 0 ? void 0 : _window.navigator.clipboard;
const clipboard = window === null || window === void 0 ? void 0 : window.navigator.clipboard;
const items = clipboard && await clipboard.read();

@@ -133,0 +131,0 @@ if (!items) {

@@ -69,7 +69,6 @@ import { createFileList } from './FileList.js';

getData(format) {
var _match;
var _this_items_find;
const match = (_this_items_find = this.items.find(getTypeMatcher(format, true))) !== null && _this_items_find !== void 0 ? _this_items_find : this.items.find(getTypeMatcher(format, false));
let text = '';
(_match = match) === null || _match === void 0 ? void 0 : _match.getAsString((t)=>{
match === null || match === void 0 ? void 0 : match.getAsString((t)=>{
text = t;

@@ -76,0 +75,0 @@ });

@@ -39,4 +39,4 @@ // It is not possible to create a real FileList programmatically.

} else {
var _valueDescr_set, _valueDescr;
(_valueDescr = valueDescr) === null || _valueDescr === void 0 ? void 0 : (_valueDescr_set = _valueDescr.set) === null || _valueDescr_set === void 0 ? void 0 : _valueDescr_set.call(el, v);
var _valueDescr_set;
valueDescr === null || valueDescr === void 0 ? void 0 : (_valueDescr_set = valueDescr.set) === null || _valueDescr_set === void 0 ? void 0 : _valueDescr_set.call(el, v);
}

@@ -43,0 +43,0 @@ }

import { isDisabled } from '../misc/isDisabled.js';
function getActiveElement(document) {
var _activeElement;
const activeElement = document.activeElement;
if ((_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.shadowRoot) {
if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) {
return getActiveElement(activeElement.shadowRoot);

@@ -8,0 +7,0 @@ } else {

@@ -1,4 +0,4 @@

import dtlHelpers from '../../_interop/dtlHelpers.js';
import * as named from '@testing-library/dom/dist/helpers.js';
const { getWindowFromNode } = dtlHelpers;
const { getWindowFromNode } = named;
function getWindow(node) {

@@ -5,0 +5,0 @@ return getWindowFromNode(node);

import { getWindow } from './getWindow.js';
function isVisible(element) {
var _el;
const window = getWindow(element);
for(let el = element; (_el = el) === null || _el === void 0 ? void 0 : _el.ownerDocument; el = el.parentElement){
for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
const { display, visibility } = window.getComputedStyle(el);

@@ -8,0 +7,0 @@ if (display === 'none') {

@@ -11,5 +11,4 @@ import { PointerEventsCheckLevel } from '../../options.js';

function closestPointerEventsDeclaration(element) {
var _el;
const window = getWindow(element);
for(let el = element, tree = []; (_el = el) === null || _el === void 0 ? void 0 : _el.ownerDocument; el = el.parentElement){
for(let el = element, tree = []; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
tree.push(el);

@@ -34,4 +33,3 @@ const pointerEvents = window.getComputedStyle(el).pointerEvents;

if (!needsCheck) {
var _lastCheck;
return (_lastCheck = lastCheck) === null || _lastCheck === void 0 ? void 0 : _lastCheck.result;
return lastCheck === null || lastCheck === void 0 ? void 0 : lastCheck.result;
}

@@ -47,5 +45,4 @@ const declaration = closestPointerEventsDeclaration(element);

function assertPointerEvents(instance, element) {
var _declaration;
const declaration = checkPointerEvents(instance, element);
if (((_declaration = declaration) === null || _declaration === void 0 ? void 0 : _declaration.pointerEvents) === 'none') {
if ((declaration === null || declaration === void 0 ? void 0 : declaration.pointerEvents) === 'none') {
throw new Error([

@@ -70,3 +67,3 @@ `Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? 'inherits' : 'has'} \`pointer-events: none\`:`,

function getLabelDescr(element) {
var _element_labels, _label, _label1;
var _element_labels;
let label;

@@ -95,6 +92,5 @@ if (element.hasAttribute('aria-label')) {

}
label = (_label = label) === null || _label === void 0 ? void 0 : _label.replace(/\n/g, ' ');
if (Number((_label1 = label) === null || _label1 === void 0 ? void 0 : _label1.length) > 30) {
var _label2;
label = `${(_label2 = label) === null || _label2 === void 0 ? void 0 : _label2.substring(0, 29)}…`;
label = label === null || label === void 0 ? void 0 : label.replace(/\n/g, ' ');
if (Number(label === null || label === void 0 ? void 0 : label.length) > 30) {
label = `${label === null || label === void 0 ? void 0 : label.substring(0, 29)}…`;
}

@@ -101,0 +97,0 @@ return label ? `(label=${label})` : '';

@@ -1,3 +0,2 @@

import def from '@testing-library/dom';
declare const _default: typeof def;
export default _default;
import * as named from '@testing-library/dom';
export default named;

@@ -1,3 +0,2 @@

import def from '@testing-library/dom/dist/event-map.js';
declare const _default: typeof def;
export default _default;
import * as named from '@testing-library/dom/dist/event-map.js';
export default named;

@@ -1,3 +0,2 @@

import def from '@testing-library/dom/dist/helpers.js';
declare const _default: typeof def;
export default _default;
import * as named from '@testing-library/dom/dist/helpers.js';
export default named;
{
"name": "@testing-library/user-event",
"version": "14.5.0",
"version": "14.5.1",
"description": "Fire events the same way the user does",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc