@testing-library/user-event 14.0.0-beta.11 → 14.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,7 +104,7 @@ possible][contributors]. Contributions of any kind are welcome! 💚
104
104
  [prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
105
105
  [prs]: http://makeapullrequest.com
106
106
  [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
107
- [coc]: https://github.com/testing-library/user-event/blob/main/other/CODE_OF_CONDUCT.md
107
+ [coc]: https://github.com/testing-library/.github/blob/main/CODE_OF_CONDUCT.md
108
108
  [github-watch-badge]: https://img.shields.io/github/watchers/testing-library/user-event.svg?style=social
109
109
  [github-watch]: https://github.com/testing-library/user-event/watchers
110
110
  [github-star-badge]: https://img.shields.io/github/stars/testing-library/user-event.svg?style=social
package/dist/index.cjs CHANGED
@@ -19,24 +19,19 @@ var __spreadValues = (a, b) => {
19
19
  return a;
20
20
  };
21
21
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
23
22
  var __export = (target, all) => {
24
23
  for (var name in all)
25
24
  __defProp(target, name, { get: all[name], enumerable: true });
26
25
  };
27
- var __reExport = (target, module2, copyDefault, desc) => {
28
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
29
- for (let key of __getOwnPropNames(module2))
30
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
31
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if (from && typeof from === "object" || typeof from === "function") {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
31
  }
33
- return target;
32
+ return to;
34
33
  };
35
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
36
- return (module2, temp) => {
37
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
38
- };
39
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
35
 
41
36
  // src/index.ts
42
37
  var src_exports = {};
@@ -44,6 +39,7 @@ __export(src_exports, {
44
39
  PointerEventsCheckLevel: () => PointerEventsCheckLevel,
45
40
  default: () => userEvent
46
41
  });
42
+ module.exports = __toCommonJS(src_exports);
47
43
 
48
44
  // src/utils/misc/isElementType.ts
49
45
  function isElementType(element, tag, props) {
@@ -643,7 +639,30 @@ function eventWrapper(cb) {
643
639
 
644
640
  // src/utils/misc/isDisabled.ts
645
641
  function isDisabled(element) {
646
- return Boolean(element && element.disabled);
642
+ var _a;
643
+ for (let el = element; el; el = el.parentElement) {
644
+ if (isElementType(el, [
645
+ "button",
646
+ "input",
647
+ "select",
648
+ "textarea",
649
+ "optgroup",
650
+ "option"
651
+ ])) {
652
+ if (el.hasAttribute("disabled")) {
653
+ return true;
654
+ }
655
+ } else if (isElementType(el, "fieldset")) {
656
+ if (el.hasAttribute("disabled") && !((_a = el.querySelector(":scope > legend")) == null ? void 0 : _a.contains(element))) {
657
+ return true;
658
+ }
659
+ } else if (el.tagName.includes("-")) {
660
+ if (el.constructor.formAssociated && el.hasAttribute("disabled")) {
661
+ return true;
662
+ }
663
+ }
664
+ }
665
+ return false;
647
666
  }
648
667
 
649
668
  // src/utils/focus/getActiveElement.ts
@@ -1070,7 +1089,7 @@ var bracketDict = /* @__PURE__ */ ((bracketDict2) => {
1070
1089
  bracketDict2["["] = "]";
1071
1090
  return bracketDict2;
1072
1091
  })(bracketDict || {});
1073
- function readNextDescriptor(text) {
1092
+ function readNextDescriptor(text, context) {
1074
1093
  let pos = 0;
1075
1094
  const startBracket = text[pos] in bracketDict ? text[pos] : "";
1076
1095
  pos += startBracket.length;
@@ -1078,11 +1097,11 @@ function readNextDescriptor(text) {
1078
1097
  const type3 = isEscapedChar ? "" : startBracket;
1079
1098
  return __spreadValues({
1080
1099
  type: type3
1081
- }, type3 === "" ? readPrintableChar(text, pos) : readTag(text, pos, type3));
1100
+ }, type3 === "" ? readPrintableChar(text, pos, context) : readTag(text, pos, type3, context));
1082
1101
  }
1083
- function readPrintableChar(text, pos) {
1102
+ function readPrintableChar(text, pos, context) {
1084
1103
  const descriptor = text[pos];
1085
- assertDescriptor(descriptor, text, pos);
1104
+ assertDescriptor(descriptor, text, pos, context);
1086
1105
  pos += descriptor.length;
1087
1106
  return {
1088
1107
  consumedLength: pos,
@@ -1092,14 +1111,14 @@ function readPrintableChar(text, pos) {
1092
1111
  repeat: 1
1093
1112
  };
1094
1113
  }
1095
- function readTag(text, pos, startBracket) {
1114
+ function readTag(text, pos, startBracket, context) {
1096
1115
  var _a, _b, _c;
1097
1116
  const releasePreviousModifier = text[pos] === "/" ? "/" : "";
1098
1117
  pos += releasePreviousModifier.length;
1099
1118
  const escapedDescriptor = startBracket === "{" && text[pos] === "\\";
1100
1119
  pos += Number(escapedDescriptor);
1101
1120
  const descriptor = escapedDescriptor ? text[pos] : (_a = text.slice(pos).match(startBracket === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) == null ? void 0 : _a[0];
1102
- assertDescriptor(descriptor, text, pos);
1121
+ assertDescriptor(descriptor, text, pos, context);
1103
1122
  pos += descriptor.length;
1104
1123
  const repeatModifier = (_c = (_b = text.slice(pos).match(/^>\d+/)) == null ? void 0 : _b[0]) != null ? _c : "";
1105
1124
  pos += repeatModifier.length;
@@ -1112,7 +1131,7 @@ function readTag(text, pos, startBracket) {
1112
1131
  !repeatModifier && "repeat modifier",
1113
1132
  !releaseSelfModifier && "release modifier",
1114
1133
  `"${expectedEndBracket}"`
1115
- ].filter(Boolean).join(" or "), text[pos], text));
1134
+ ].filter(Boolean).join(" or "), text[pos], text, context));
1116
1135
  }
1117
1136
  pos += endBracket.length;
1118
1137
  return {
@@ -1123,9 +1142,9 @@ function readTag(text, pos, startBracket) {
1123
1142
  releaseSelf: hasReleaseSelf(releaseSelfModifier, repeatModifier)
1124
1143
  };
1125
1144
  }
1126
- function assertDescriptor(descriptor, text, pos) {
1145
+ function assertDescriptor(descriptor, text, pos, context) {
1127
1146
  if (!descriptor) {
1128
- throw new Error(getErrorMessage("key descriptor", text[pos], text));
1147
+ throw new Error(getErrorMessage("key descriptor", text[pos], text, context));
1129
1148
  }
1130
1149
  }
1131
1150
  function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
@@ -1136,9 +1155,9 @@ function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
1136
1155
  return false;
1137
1156
  }
1138
1157
  }
1139
- function getErrorMessage(expected, found, text) {
1158
+ function getErrorMessage(expected, found, text, context) {
1140
1159
  return `Expected ${expected} but found "${found != null ? found : ""}" in "${text}"
1141
- See https://github.com/testing-library/user-event/blob/main/README.md#keyboardtext-options
1160
+ See ${context === "pointer" ? `https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen` : `https://testing-library.com/docs/user-event/keyboard`}
1142
1161
  for more information about how userEvent parses your input.`;
1143
1162
  }
1144
1163
 
@@ -1352,6 +1371,7 @@ var eventMap = __spreadProps(__spreadValues({}, import_event_map.eventMap), {
1352
1371
  defaultInit: { bubbles: true, cancelable: true, composed: true }
1353
1372
  }
1354
1373
  });
1374
+ var eventMapKeys = Object.fromEntries(Object.keys(eventMap).map((k) => [k.toLowerCase(), k]));
1355
1375
 
1356
1376
  // src/event/eventTypes.ts
1357
1377
  var import_event_map2 = require("@testing-library/dom/dist/event-map.js");
@@ -1369,8 +1389,7 @@ function isKeyboardEvent(type3) {
1369
1389
 
1370
1390
  // src/event/createEvent.ts
1371
1391
  function createEvent(type3, target, init) {
1372
- const eventKey = Object.keys(eventMap).find((k) => k.toLowerCase() === type3);
1373
- const event = (0, import_dom2.createEvent)(type3, target, init, eventMap[eventKey]);
1392
+ const event = (0, import_dom2.createEvent)(type3, target, init, eventMap[eventMapKeys[type3]]);
1374
1393
  if (isMouseEvent(type3) && init) {
1375
1394
  assignPositionInit(event, init);
1376
1395
  assignPointerInit(event, init);
@@ -1439,6 +1458,15 @@ behavior.click = (event, target, config) => {
1439
1458
  }
1440
1459
  };
1441
1460
 
1461
+ // src/event/behavior/cut.ts
1462
+ behavior.cut = (event, target, config) => {
1463
+ return () => {
1464
+ if (isEditable(target)) {
1465
+ input(config, target, "", "deleteByCut");
1466
+ }
1467
+ };
1468
+ };
1469
+
1442
1470
  // src/event/behavior/keydown.ts
1443
1471
  behavior.keydown = (event, target, config) => {
1444
1472
  var _a, _b;
@@ -1568,6 +1596,19 @@ var keyupBehavior = {
1568
1596
  }
1569
1597
  };
1570
1598
 
1599
+ // src/event/behavior/paste.ts
1600
+ behavior.paste = (event, target, config) => {
1601
+ if (isEditable(target)) {
1602
+ return () => {
1603
+ var _a;
1604
+ const insertData = (_a = event.clipboardData) == null ? void 0 : _a.getData("text");
1605
+ if (insertData) {
1606
+ input(config, target, insertData, "insertFromPaste");
1607
+ }
1608
+ };
1609
+ }
1610
+ };
1611
+
1571
1612
  // src/event/wrapEvent.ts
1572
1613
  var import_dom3 = require("@testing-library/dom");
1573
1614
  function wrapEvent(cb, _element) {
@@ -1926,7 +1967,7 @@ function parseKeyDef(keyboardMap, text) {
1926
1967
  releasePrevious,
1927
1968
  releaseSelf = true,
1928
1969
  repeat
1929
- } = readNextDescriptor(text);
1970
+ } = readNextDescriptor(text, "keyboard");
1930
1971
  const keyDef = (_a = keyboardMap.find((def) => {
1931
1972
  var _a2, _b;
1932
1973
  if (type3 === "[") {
@@ -1983,7 +2024,7 @@ function parseKeyDef2(pointerMap, keys) {
1983
2024
  consumedLength,
1984
2025
  releasePrevious,
1985
2026
  releaseSelf = true
1986
- } = readNextDescriptor(keys);
2027
+ } = readNextDescriptor(keys, "pointer");
1987
2028
  const keyDef = pointerMap.find((p) => p.name === descriptor);
1988
2029
  if (keyDef) {
1989
2030
  defs.push({ keyDef, releasePrevious, releaseSelf });
@@ -2502,10 +2543,9 @@ async function copy() {
2502
2543
  if (clipboardData.items.length === 0) {
2503
2544
  return;
2504
2545
  }
2505
- this.dispatchUIEvent(target, "copy", {
2546
+ if (this.dispatchUIEvent(target, "copy", {
2506
2547
  clipboardData
2507
- });
2508
- if (this[Config].writeToClipboard) {
2548
+ }) && this[Config].writeToClipboard) {
2509
2549
  await writeDataTransferToClipboard(doc, clipboardData);
2510
2550
  }
2511
2551
  return clipboardData;
@@ -2520,14 +2560,10 @@ async function cut() {
2520
2560
  if (clipboardData.items.length === 0) {
2521
2561
  return;
2522
2562
  }
2523
- this.dispatchUIEvent(target, "cut", {
2563
+ if (this.dispatchUIEvent(target, "cut", {
2524
2564
  clipboardData
2525
- });
2526
- if (isEditable(target)) {
2527
- input(this[Config], target, "", "deleteByCut");
2528
- }
2529
- if (this[Config].writeToClipboard) {
2530
- await writeDataTransferToClipboard(doc, clipboardData);
2565
+ }) && this[Config].writeToClipboard) {
2566
+ await writeDataTransferToClipboard(target.ownerDocument, clipboardData);
2531
2567
  }
2532
2568
  return clipboardData;
2533
2569
  }
@@ -2543,9 +2579,6 @@ async function paste(clipboardData) {
2543
2579
  this.dispatchUIEvent(target, "paste", {
2544
2580
  clipboardData: dataTransfer
2545
2581
  });
2546
- if (isEditable(target)) {
2547
- input(this[Config], target, dataTransfer.getData("text"), "insertFromPaste");
2548
- }
2549
2582
  }
2550
2583
  function getClipboardDataFromString(text) {
2551
2584
  const dt = createDataTransfer();
@@ -2861,4 +2894,3 @@ function tab2(options = {}) {
2861
2894
  var userEvent = __spreadProps(__spreadValues({}, directApi_exports), {
2862
2895
  setup: setupMain
2863
2896
  });
2864
- module.exports = __toCommonJS(src_exports);
package/dist/index.mjs CHANGED
@@ -655,7 +655,30 @@ function eventWrapper(cb) {
655
655
 
656
656
  // src/utils/misc/isDisabled.ts
657
657
  function isDisabled(element) {
658
- return Boolean(element && element.disabled);
658
+ var _a;
659
+ for (let el = element; el; el = el.parentElement) {
660
+ if (isElementType(el, [
661
+ "button",
662
+ "input",
663
+ "select",
664
+ "textarea",
665
+ "optgroup",
666
+ "option"
667
+ ])) {
668
+ if (el.hasAttribute("disabled")) {
669
+ return true;
670
+ }
671
+ } else if (isElementType(el, "fieldset")) {
672
+ if (el.hasAttribute("disabled") && !((_a = el.querySelector(":scope > legend")) == null ? void 0 : _a.contains(element))) {
673
+ return true;
674
+ }
675
+ } else if (el.tagName.includes("-")) {
676
+ if (el.constructor.formAssociated && el.hasAttribute("disabled")) {
677
+ return true;
678
+ }
679
+ }
680
+ }
681
+ return false;
659
682
  }
660
683
 
661
684
  // src/utils/focus/getActiveElement.ts
@@ -1082,7 +1105,7 @@ var bracketDict = /* @__PURE__ */ ((bracketDict2) => {
1082
1105
  bracketDict2["["] = "]";
1083
1106
  return bracketDict2;
1084
1107
  })(bracketDict || {});
1085
- function readNextDescriptor(text) {
1108
+ function readNextDescriptor(text, context) {
1086
1109
  let pos = 0;
1087
1110
  const startBracket = text[pos] in bracketDict ? text[pos] : "";
1088
1111
  pos += startBracket.length;
@@ -1090,11 +1113,11 @@ function readNextDescriptor(text) {
1090
1113
  const type3 = isEscapedChar ? "" : startBracket;
1091
1114
  return __spreadValues({
1092
1115
  type: type3
1093
- }, type3 === "" ? readPrintableChar(text, pos) : readTag(text, pos, type3));
1116
+ }, type3 === "" ? readPrintableChar(text, pos, context) : readTag(text, pos, type3, context));
1094
1117
  }
1095
- function readPrintableChar(text, pos) {
1118
+ function readPrintableChar(text, pos, context) {
1096
1119
  const descriptor = text[pos];
1097
- assertDescriptor(descriptor, text, pos);
1120
+ assertDescriptor(descriptor, text, pos, context);
1098
1121
  pos += descriptor.length;
1099
1122
  return {
1100
1123
  consumedLength: pos,
@@ -1104,14 +1127,14 @@ function readPrintableChar(text, pos) {
1104
1127
  repeat: 1
1105
1128
  };
1106
1129
  }
1107
- function readTag(text, pos, startBracket) {
1130
+ function readTag(text, pos, startBracket, context) {
1108
1131
  var _a, _b, _c;
1109
1132
  const releasePreviousModifier = text[pos] === "/" ? "/" : "";
1110
1133
  pos += releasePreviousModifier.length;
1111
1134
  const escapedDescriptor = startBracket === "{" && text[pos] === "\\";
1112
1135
  pos += Number(escapedDescriptor);
1113
1136
  const descriptor = escapedDescriptor ? text[pos] : (_a = text.slice(pos).match(startBracket === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) == null ? void 0 : _a[0];
1114
- assertDescriptor(descriptor, text, pos);
1137
+ assertDescriptor(descriptor, text, pos, context);
1115
1138
  pos += descriptor.length;
1116
1139
  const repeatModifier = (_c = (_b = text.slice(pos).match(/^>\d+/)) == null ? void 0 : _b[0]) != null ? _c : "";
1117
1140
  pos += repeatModifier.length;
@@ -1124,7 +1147,7 @@ function readTag(text, pos, startBracket) {
1124
1147
  !repeatModifier && "repeat modifier",
1125
1148
  !releaseSelfModifier && "release modifier",
1126
1149
  `"${expectedEndBracket}"`
1127
- ].filter(Boolean).join(" or "), text[pos], text));
1150
+ ].filter(Boolean).join(" or "), text[pos], text, context));
1128
1151
  }
1129
1152
  pos += endBracket.length;
1130
1153
  return {
@@ -1135,9 +1158,9 @@ function readTag(text, pos, startBracket) {
1135
1158
  releaseSelf: hasReleaseSelf(releaseSelfModifier, repeatModifier)
1136
1159
  };
1137
1160
  }
1138
- function assertDescriptor(descriptor, text, pos) {
1161
+ function assertDescriptor(descriptor, text, pos, context) {
1139
1162
  if (!descriptor) {
1140
- throw new Error(getErrorMessage("key descriptor", text[pos], text));
1163
+ throw new Error(getErrorMessage("key descriptor", text[pos], text, context));
1141
1164
  }
1142
1165
  }
1143
1166
  function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
@@ -1148,9 +1171,9 @@ function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
1148
1171
  return false;
1149
1172
  }
1150
1173
  }
1151
- function getErrorMessage(expected, found, text) {
1174
+ function getErrorMessage(expected, found, text, context) {
1152
1175
  return `Expected ${expected} but found "${found != null ? found : ""}" in "${text}"
1153
- See https://github.com/testing-library/user-event/blob/main/README.md#keyboardtext-options
1176
+ See ${context === "pointer" ? `https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen` : `https://testing-library.com/docs/user-event/keyboard`}
1154
1177
  for more information about how userEvent parses your input.`;
1155
1178
  }
1156
1179
 
@@ -1364,6 +1387,7 @@ var eventMap = __spreadProps(__spreadValues({}, baseEventMap), {
1364
1387
  defaultInit: { bubbles: true, cancelable: true, composed: true }
1365
1388
  }
1366
1389
  });
1390
+ var eventMapKeys = Object.fromEntries(Object.keys(eventMap).map((k) => [k.toLowerCase(), k]));
1367
1391
 
1368
1392
  // src/event/eventTypes.ts
1369
1393
  import { eventMap as eventMap2 } from "@testing-library/dom/dist/event-map.js";
@@ -1381,8 +1405,7 @@ function isKeyboardEvent(type3) {
1381
1405
 
1382
1406
  // src/event/createEvent.ts
1383
1407
  function createEvent(type3, target, init) {
1384
- const eventKey = Object.keys(eventMap).find((k) => k.toLowerCase() === type3);
1385
- const event = createEventBase(type3, target, init, eventMap[eventKey]);
1408
+ const event = createEventBase(type3, target, init, eventMap[eventMapKeys[type3]]);
1386
1409
  if (isMouseEvent(type3) && init) {
1387
1410
  assignPositionInit(event, init);
1388
1411
  assignPointerInit(event, init);
@@ -1451,6 +1474,15 @@ behavior.click = (event, target, config) => {
1451
1474
  }
1452
1475
  };
1453
1476
 
1477
+ // src/event/behavior/cut.ts
1478
+ behavior.cut = (event, target, config) => {
1479
+ return () => {
1480
+ if (isEditable(target)) {
1481
+ input(config, target, "", "deleteByCut");
1482
+ }
1483
+ };
1484
+ };
1485
+
1454
1486
  // src/event/behavior/keydown.ts
1455
1487
  behavior.keydown = (event, target, config) => {
1456
1488
  var _a, _b;
@@ -1580,6 +1612,19 @@ var keyupBehavior = {
1580
1612
  }
1581
1613
  };
1582
1614
 
1615
+ // src/event/behavior/paste.ts
1616
+ behavior.paste = (event, target, config) => {
1617
+ if (isEditable(target)) {
1618
+ return () => {
1619
+ var _a;
1620
+ const insertData = (_a = event.clipboardData) == null ? void 0 : _a.getData("text");
1621
+ if (insertData) {
1622
+ input(config, target, insertData, "insertFromPaste");
1623
+ }
1624
+ };
1625
+ }
1626
+ };
1627
+
1583
1628
  // src/event/wrapEvent.ts
1584
1629
  import { getConfig as getConfig2 } from "@testing-library/dom";
1585
1630
  function wrapEvent(cb, _element) {
@@ -1950,7 +1995,7 @@ function parseKeyDef(keyboardMap, text) {
1950
1995
  releasePrevious,
1951
1996
  releaseSelf = true,
1952
1997
  repeat
1953
- } = readNextDescriptor(text);
1998
+ } = readNextDescriptor(text, "keyboard");
1954
1999
  const keyDef = (_a = keyboardMap.find((def) => {
1955
2000
  var _a2, _b;
1956
2001
  if (type3 === "[") {
@@ -2009,7 +2054,7 @@ function parseKeyDef2(pointerMap, keys) {
2009
2054
  consumedLength,
2010
2055
  releasePrevious,
2011
2056
  releaseSelf = true
2012
- } = readNextDescriptor(keys);
2057
+ } = readNextDescriptor(keys, "pointer");
2013
2058
  const keyDef = pointerMap.find((p) => p.name === descriptor);
2014
2059
  if (keyDef) {
2015
2060
  defs.push({ keyDef, releasePrevious, releaseSelf });
@@ -2549,10 +2594,9 @@ function copy() {
2549
2594
  if (clipboardData.items.length === 0) {
2550
2595
  return;
2551
2596
  }
2552
- this.dispatchUIEvent(target, "copy", {
2597
+ if (this.dispatchUIEvent(target, "copy", {
2553
2598
  clipboardData
2554
- });
2555
- if (this[Config].writeToClipboard) {
2599
+ }) && this[Config].writeToClipboard) {
2556
2600
  yield writeDataTransferToClipboard(doc, clipboardData);
2557
2601
  }
2558
2602
  return clipboardData;
@@ -2569,14 +2613,10 @@ function cut() {
2569
2613
  if (clipboardData.items.length === 0) {
2570
2614
  return;
2571
2615
  }
2572
- this.dispatchUIEvent(target, "cut", {
2616
+ if (this.dispatchUIEvent(target, "cut", {
2573
2617
  clipboardData
2574
- });
2575
- if (isEditable(target)) {
2576
- input(this[Config], target, "", "deleteByCut");
2577
- }
2578
- if (this[Config].writeToClipboard) {
2579
- yield writeDataTransferToClipboard(doc, clipboardData);
2618
+ }) && this[Config].writeToClipboard) {
2619
+ yield writeDataTransferToClipboard(target.ownerDocument, clipboardData);
2580
2620
  }
2581
2621
  return clipboardData;
2582
2622
  });
@@ -2594,9 +2634,6 @@ function paste(clipboardData) {
2594
2634
  this.dispatchUIEvent(target, "paste", {
2595
2635
  clipboardData: dataTransfer
2596
2636
  });
2597
- if (isEditable(target)) {
2598
- input(this[Config], target, dataTransfer.getData("text"), "insertFromPaste");
2599
- }
2600
2637
  });
2601
2638
  }
2602
2639
  function getClipboardDataFromString(text) {
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,8 @@
1
1
  import './click';
2
+ import './cut';
2
3
  import './keydown';
3
4
  import './keypress';
4
5
  import './keyup';
6
+ import './paste';
5
7
  export { behavior } from './registry';
6
8
  export type { BehaviorPlugin } from './registry';
@@ -0,0 +1 @@
1
+ export {};
@@ -103,6 +103,10 @@ export declare const eventMap: {
103
103
  EventType: string;
104
104
  defaultInit: EventInit;
105
105
  };
106
+ resize: {
107
+ EventType: string;
108
+ defaultInit: EventInit;
109
+ };
106
110
  seeked: {
107
111
  EventType: string;
108
112
  defaultInit: EventInit;
@@ -291,10 +295,22 @@ export declare const eventMap: {
291
295
  EventType: string;
292
296
  defaultInit: EventInit;
293
297
  };
298
+ transitionCancel: {
299
+ EventType: string;
300
+ defaultInit: EventInit;
301
+ };
294
302
  transitionEnd: {
295
303
  EventType: string;
296
304
  defaultInit: EventInit;
297
305
  };
306
+ transitionRun: {
307
+ EventType: string;
308
+ defaultInit: EventInit;
309
+ };
310
+ transitionStart: {
311
+ EventType: string;
312
+ defaultInit: EventInit;
313
+ };
298
314
  doubleClick: {
299
315
  EventType: string;
300
316
  defaultInit: EventInit;
@@ -340,3 +356,6 @@ export declare const eventMap: {
340
356
  defaultInit: EventInit;
341
357
  };
342
358
  };
359
+ export declare const eventMapKeys: {
360
+ [k in keyof DocumentEventMap]?: keyof typeof eventMap;
361
+ };
@@ -1,3 +1,4 @@
1
+ declare type Context = 'pointer' | 'keyboard';
1
2
  /**
2
3
  * Read the next key definition from user input
3
4
  *
@@ -9,7 +10,7 @@
9
10
  * When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
10
11
  * You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
11
12
  */
12
- export declare function readNextDescriptor(text: string): {
13
+ export declare function readNextDescriptor(text: string, context: Context): {
13
14
  consumedLength: number;
14
15
  descriptor: string;
15
16
  releasePrevious: boolean;
@@ -17,3 +18,4 @@ export declare function readNextDescriptor(text: string): {
17
18
  releaseSelf: boolean | undefined;
18
19
  type: string;
19
20
  };
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/user-event",
3
- "version": "14.0.0-beta.11",
3
+ "version": "14.0.0-beta.14",
4
4
  "description": "Fire events the same way the user does",
5
5
  "keywords": [
6
6
  "react-testing-library",
@@ -44,22 +44,19 @@
44
44
  "validate": "kcd-scripts validate",
45
45
  "typecheck": "kcd-scripts typecheck"
46
46
  },
47
- "dependencies": {
48
- "@babel/runtime": "^7.12.5"
49
- },
47
+ "dependencies": {},
50
48
  "devDependencies": {
51
- "@testing-library/dom": "^7.28.1",
52
- "@testing-library/jest-dom": "^5.11.6",
53
- "@testing-library/react": "^11.2.5",
54
- "@types/estree": "0.0.45",
49
+ "@testing-library/dom": "^8.11.4",
50
+ "@testing-library/jest-dom": "^5.16.3",
51
+ "@testing-library/react": "^12.1.4",
55
52
  "@types/jest-in-case": "^1.0.3",
56
- "@types/react": "^17.0.3",
57
- "esbuild": "^0.14.9",
58
- "eslint-import-resolver-typescript": "^2.5.0",
59
- "is-ci": "^2.0.0",
53
+ "@types/react": "^17.0.42",
54
+ "esbuild": "^0.14.27",
55
+ "eslint-import-resolver-typescript": "^2.7.0",
56
+ "is-ci": "^3.0.1",
60
57
  "jest-in-case": "^1.0.2",
61
58
  "jest-serializer-ansi": "^1.0.3",
62
- "kcd-scripts": "^11.1.0",
59
+ "kcd-scripts": "^12.1.0",
63
60
  "react": "^17.0.2",
64
61
  "react-dom": "^17.0.2",
65
62
  "typescript": "^4.1.2"