@interactors/core 0.3.0 → 1.0.0-rc1.2

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/cjs/constructor.js +28 -34
  3. package/dist/cjs/constructor.js.map +1 -1
  4. package/dist/cjs/index.js +1 -20
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/inspector.js +1 -1
  7. package/dist/cjs/inspector.js.map +1 -1
  8. package/dist/cjs/matcher.js +13 -1
  9. package/dist/cjs/matcher.js.map +1 -1
  10. package/dist/cjs/matchers/and.js +3 -0
  11. package/dist/cjs/matchers/and.js.map +1 -1
  12. package/dist/cjs/matchers/every.js +3 -0
  13. package/dist/cjs/matchers/every.js.map +1 -1
  14. package/dist/cjs/matchers/including.js +4 -0
  15. package/dist/cjs/matchers/including.js.map +1 -1
  16. package/dist/cjs/matchers/matching.js +4 -0
  17. package/dist/cjs/matchers/matching.js.map +1 -1
  18. package/dist/cjs/matchers/not.js +3 -0
  19. package/dist/cjs/matchers/not.js.map +1 -1
  20. package/dist/cjs/matchers/or.js +3 -0
  21. package/dist/cjs/matchers/or.js.map +1 -1
  22. package/dist/cjs/matchers/some.js +3 -0
  23. package/dist/cjs/matchers/some.js.map +1 -1
  24. package/dist/constructor.d.ts +3 -4
  25. package/dist/constructor.d.ts.map +1 -1
  26. package/dist/esm/constructor.js +27 -32
  27. package/dist/esm/constructor.js.map +1 -1
  28. package/dist/esm/index.js +0 -4
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/inspector.js +2 -2
  31. package/dist/esm/inspector.js.map +1 -1
  32. package/dist/esm/matcher.js +11 -0
  33. package/dist/esm/matcher.js.map +1 -1
  34. package/dist/esm/matchers/and.js +4 -1
  35. package/dist/esm/matchers/and.js.map +1 -1
  36. package/dist/esm/matchers/every.js +4 -1
  37. package/dist/esm/matchers/every.js.map +1 -1
  38. package/dist/esm/matchers/including.js +4 -0
  39. package/dist/esm/matchers/including.js.map +1 -1
  40. package/dist/esm/matchers/matching.js +4 -0
  41. package/dist/esm/matchers/matching.js.map +1 -1
  42. package/dist/esm/matchers/not.js +4 -1
  43. package/dist/esm/matchers/not.js.map +1 -1
  44. package/dist/esm/matchers/or.js +4 -1
  45. package/dist/esm/matchers/or.js.map +1 -1
  46. package/dist/esm/matchers/some.js +4 -1
  47. package/dist/esm/matchers/some.js.map +1 -1
  48. package/dist/index.d.ts +3 -5
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/inspector.d.ts +2 -2
  51. package/dist/inspector.d.ts.map +1 -1
  52. package/dist/matcher.d.ts +2 -0
  53. package/dist/matcher.d.ts.map +1 -1
  54. package/dist/matchers/and.d.ts.map +1 -1
  55. package/dist/matchers/every.d.ts.map +1 -1
  56. package/dist/matchers/including.d.ts.map +1 -1
  57. package/dist/matchers/matching.d.ts.map +1 -1
  58. package/dist/matchers/not.d.ts.map +1 -1
  59. package/dist/matchers/or.d.ts.map +1 -1
  60. package/dist/matchers/some.d.ts.map +1 -1
  61. package/dist/specification.d.ts +40 -44
  62. package/dist/specification.d.ts.map +1 -1
  63. package/dist/tsconfig.build.tsbuildinfo +1 -1
  64. package/package.json +2 -3
  65. package/src/constructor.ts +36 -45
  66. package/src/index.ts +3 -5
  67. package/src/inspector.ts +4 -4
  68. package/src/matcher.ts +11 -0
  69. package/src/matchers/and.ts +4 -1
  70. package/src/matchers/every.ts +4 -1
  71. package/src/matchers/including.ts +4 -1
  72. package/src/matchers/matching.ts +4 -1
  73. package/src/matchers/not.ts +4 -1
  74. package/src/matchers/or.ts +4 -1
  75. package/src/matchers/some.ts +4 -1
  76. package/src/specification.ts +47 -52
  77. package/dist/cjs/dispatch.js +0 -34
  78. package/dist/cjs/dispatch.js.map +0 -1
  79. package/dist/cjs/element/fill-in.js +0 -71
  80. package/dist/cjs/element/fill-in.js.map +0 -1
  81. package/dist/cjs/focused.js +0 -47
  82. package/dist/cjs/focused.js.map +0 -1
  83. package/dist/cjs/perform.js +0 -13
  84. package/dist/cjs/perform.js.map +0 -1
  85. package/dist/dispatch.d.ts +0 -6
  86. package/dist/dispatch.d.ts.map +0 -1
  87. package/dist/element/fill-in.d.ts +0 -12
  88. package/dist/element/fill-in.d.ts.map +0 -1
  89. package/dist/esm/dispatch.js +0 -26
  90. package/dist/esm/dispatch.js.map +0 -1
  91. package/dist/esm/element/fill-in.js +0 -67
  92. package/dist/esm/element/fill-in.js.map +0 -1
  93. package/dist/esm/focused.js +0 -41
  94. package/dist/esm/focused.js.map +0 -1
  95. package/dist/esm/perform.js +0 -9
  96. package/dist/esm/perform.js.map +0 -1
  97. package/dist/focused.d.ts +0 -30
  98. package/dist/focused.d.ts.map +0 -1
  99. package/dist/perform.d.ts +0 -3
  100. package/dist/perform.d.ts.map +0 -1
  101. package/src/dispatch.ts +0 -24
  102. package/src/element/fill-in.ts +0 -76
  103. package/src/focused.ts +0 -43
  104. package/src/perform.ts +0 -11
@@ -8,42 +8,20 @@ import { MaybeMatcher } from './matcher';
8
8
 
9
9
  export type EmptyObject = Record<never, never>;
10
10
 
11
- export interface ExistsAssertionsImplementation {
12
-
13
- /**
14
- * An assertion which checks that an element matching the interactor exists.
15
- * Throws an error if the element does not exist.
16
- *
17
- * ## Example
18
- *
19
- * ``` typescript
20
- * await Link('Next').exists();
21
- * ```
22
- */
23
- exists(): ReadonlyInteraction<void> & FilterObject<boolean, Element>;
24
-
25
- /**
26
- * An assertion which checks that an element matching the interactor does not
27
- * exist. Throws an error if the element exists.
28
- *
29
- * ## Example
30
- *
31
- * ``` typescript
32
- * await Link('Next').absent();
33
- * ```
34
- */
35
- absent(): ReadonlyInteraction<void> & FilterObject<boolean, Element>;
36
- }
37
-
38
- export interface BaseInteractor<E extends Element, F extends FilterParams<any, any>> {
11
+ /**
12
+ * Instances of an interactor returned by an {@link InteractorConstructor}, use
13
+ * this class as its base. They are also extended with any additional actions
14
+ * defined in their {@link InteractorSpecification}.
15
+ */
16
+ export interface Interactor<E extends Element, F extends FilterParams<any, any>> {
39
17
  /**
40
18
  * @hidden
41
19
  */
42
20
  options: InteractorOptions<E, any, any>;
43
21
 
44
- /**
45
- * @returns a human readable description of this interactor
46
- */
22
+ /**
23
+ * @returns a human readable description of this interactor
24
+ */
47
25
  description: string;
48
26
 
49
27
  /**
@@ -78,6 +56,30 @@ export interface BaseInteractor<E extends Element, F extends FilterParams<any, a
78
56
  */
79
57
  assert(fn: (element: E) => void): ReadonlyInteraction<void>;
80
58
 
59
+ /**
60
+ * An assertion which checks that an element matching the interactor exists.
61
+ * Throws an error if the element does not exist.
62
+ *
63
+ * ## Example
64
+ *
65
+ * ``` typescript
66
+ * await Link('Next').exists();
67
+ * ```
68
+ */
69
+ exists(): ReadonlyInteraction<void> & FilterObject<boolean, Element>;
70
+
71
+ /**
72
+ * An assertion which checks that an element matching the interactor does not
73
+ * exist. Throws an error if the element exists.
74
+ *
75
+ * ## Example
76
+ *
77
+ * ``` typescript
78
+ * await Link('Next').absent();
79
+ * ```
80
+ */
81
+ absent(): ReadonlyInteraction<void> & FilterObject<boolean, Element>;
82
+
81
83
  /**
82
84
  * Checks that there is one element matching the interactor, and that this
83
85
  * element matches the given filters. The available filters are defined by
@@ -102,18 +104,6 @@ export interface BaseInteractor<E extends Element, F extends FilterParams<any, a
102
104
  */
103
105
  is(filters: F): ReadonlyInteraction<void>;
104
106
 
105
- /**
106
- * @hidden
107
- */
108
- apply: FilterFn<string, Element>;
109
- }
110
-
111
- /**
112
- * Instances of an interactor returned by an {@link InteractorConstructor}, use
113
- * this class as its base. They are also extended with any additional actions
114
- * defined in their {@link InteractorSpecification}.
115
- */
116
- export interface Interactor<E extends Element, F extends FilterParams<any, any>> extends BaseInteractor<E, F>, ExistsAssertionsImplementation {
117
107
  /**
118
108
  * Returns a copy of the given interactor which is scoped to this interactor.
119
109
  * When there are multiple matches for an interactor, this makes it possible
@@ -130,10 +120,15 @@ export interface Interactor<E extends Element, F extends FilterParams<any, any>>
130
120
  * @returns a scoped copy of the initial interactor
131
121
  * @typeParam T the type of the interactor that we are going to scope
132
122
  */
133
- find<T extends Interactor<any, any>>(interactor: T): T;
123
+ find<T extends Interactor<any, any>>(interactor: T): T;
124
+
125
+ /**
126
+ * @hidden
127
+ */
128
+ apply: FilterFn<string, Element>;
134
129
  }
135
130
 
136
- export type ActionFn<E extends Element> = (interactor: Interactor<E, EmptyObject>, ...args: any[]) => Promise<unknown>;
131
+ export type ActionFn<E extends Element, I extends Interactor<E, any>> = (interactor: I, ...args: any[]) => Promise<unknown>;
137
132
 
138
133
  export type FilterFn<T, E extends Element> = (element: E) => T;
139
134
 
@@ -146,11 +141,11 @@ export type FilterDefinition<T, E extends Element> = FilterFn<T, E> | FilterObje
146
141
 
147
142
  export type Filters<E extends Element> = Record<string, FilterDefinition<unknown, E>>;
148
143
 
149
- export type Actions<E extends Element> = Record<string, ActionFn<E>>;
144
+ export type Actions<E extends Element, I extends Interactor<E, any>> = Record<string, ActionFn<E, I>>;
150
145
 
151
146
  export type SelectorFn<E extends Element> = (parentElement: Element) => E[];
152
147
 
153
- export type InteractorSpecification<E extends Element, F extends Filters<E>, A extends Actions<E>> = {
148
+ export type InteractorSpecification<E extends Element, F extends Filters<E>, A extends Actions<E, Interactor<E, EmptyObject>>> = {
154
149
  /**
155
150
  * The CSS selector that this interactor uses to find matching elements
156
151
  */
@@ -166,8 +161,8 @@ export type InteractorSpecification<E extends Element, F extends Filters<E>, A e
166
161
  locator?: FilterDefinition<string, E>;
167
162
  }
168
163
 
169
- export type ActionMethods<E extends Element, A extends Actions<E>> = {
170
- [P in keyof A]: A[P] extends ((interactor: Interactor<E, EmptyObject>, ...args: infer TArgs) => Promise<infer TReturn>)
164
+ export type ActionMethods<E extends Element, A extends Actions<E, I>, I extends Interactor<E, any>> = {
165
+ [P in keyof A]: A[P] extends ((interactor: I, ...args: infer TArgs) => Promise<infer TReturn>)
171
166
  ? ((...args: TArgs) => Interaction<TReturn>)
172
167
  : never;
173
168
  }
@@ -202,11 +197,11 @@ export type FilterParams<E extends Element, F extends Filters<E>> = keyof F exte
202
197
  * @typeParam F the filters of this interactor, this is usually inferred from the specification
203
198
  * @typeParam A the actions of this interactor, this is usually inferred from the specification
204
199
  */
205
- export interface InteractorConstructor<E extends Element, FP extends FilterParams<any, any>, FM extends FilterMethods<any, any>, AM extends ActionMethods<any, any>> {
200
+ export interface InteractorConstructor<E extends Element, FP extends FilterParams<any, any>, FM extends FilterMethods<any, any>, AM extends ActionMethods<any, any, any>> {
206
201
  selector(value: string | SelectorFn<E>): InteractorConstructor<E, FP, FM, AM>;
207
202
  locator(value: FilterDefinition<string, E>): InteractorConstructor<E, FP, FM, AM>;
208
203
  filters<FR extends Filters<E>>(filters: FR): InteractorConstructor<E, MergeObjects<FP, FilterParams<E, FR>>, MergeObjects<FM, FilterMethods<E, FR>>, AM>;
209
- actions<AR extends Actions<E>>(actions: AR): InteractorConstructor<E, FP, FM, MergeObjects<AM, ActionMethods<E, AR>>>;
204
+ actions<I extends Interactor<E, FP> & FM & AM, AR extends Actions<E, I>>(actions: AR): InteractorConstructor<E, FP, FM, MergeObjects<AM, ActionMethods<E, AR, I>>>;
210
205
  extend<ER extends E = E>(name: string): InteractorConstructor<ER, FP, FM, AM>;
211
206
 
212
207
  /**
@@ -244,7 +239,7 @@ export interface InteractorConstructor<E extends Element, FP extends FilterParam
244
239
  (value: MaybeMatcher<string>, filters?: FP): Interactor<E, FP> & FM & AM;
245
240
  }
246
241
 
247
- export type InteractorOptions<E extends Element, F extends Filters<E>, A extends Actions<E>> = {
242
+ export type InteractorOptions<E extends Element, F extends Filters<E>, A extends Actions<E, Interactor<E, EmptyObject>>> = {
248
243
  name: string;
249
244
  specification: InteractorSpecification<E, F, A>;
250
245
  locator?: Locator<E>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dispatchClick = exports.dispatchKeyUp = exports.dispatchKeyDown = exports.dispatchInput = exports.dispatchChange = void 0;
4
- function dispatchChange(element) {
5
- var _a;
6
- let Event = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.Event) || window.Event;
7
- return element.dispatchEvent(new Event('change', { bubbles: true, cancelable: false }));
8
- }
9
- exports.dispatchChange = dispatchChange;
10
- function dispatchInput(element, options = {}) {
11
- var _a;
12
- let InputEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.InputEvent) || window.InputEvent;
13
- return element.dispatchEvent(new InputEvent('input', Object.assign({ bubbles: true, cancelable: false }, options)));
14
- }
15
- exports.dispatchInput = dispatchInput;
16
- function dispatchKeyDown(element, options = {}) {
17
- var _a;
18
- let KeyboardEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.KeyboardEvent) || window.KeyboardEvent;
19
- return element.dispatchEvent(new KeyboardEvent('keydown', Object.assign({ bubbles: true, cancelable: true }, options)));
20
- }
21
- exports.dispatchKeyDown = dispatchKeyDown;
22
- function dispatchKeyUp(element, options = {}) {
23
- var _a;
24
- let KeyboardEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.KeyboardEvent) || window.KeyboardEvent;
25
- return element.dispatchEvent(new KeyboardEvent('keyup', Object.assign({ bubbles: true, cancelable: true }, options)));
26
- }
27
- exports.dispatchKeyUp = dispatchKeyUp;
28
- function dispatchClick(element, options = {}) {
29
- var _a;
30
- let MouseEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.MouseEvent) || window.MouseEvent;
31
- return element.dispatchEvent(new MouseEvent('click', Object.assign({ bubbles: true, cancelable: true }, options)));
32
- }
33
- exports.dispatchClick = dispatchClick;
34
- //# sourceMappingURL=dispatch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/dispatch.ts"],"names":[],"mappings":";;;AAAA,SAAgB,cAAc,CAAC,OAAoB;;IACjD,IAAI,KAAK,GAAG,CAAA,MA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,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACxH,CAAC;AAHD,sCAGC;AAED,SAAgB,aAAa,CAAC,OAAoB,EAAE,UAA0B,EAAE;;IAC9E,IAAI,UAAU,GAAG,CAAA,MAAA,OAAO,CAAC,aAAa,CAAC,WAAW,0CAAE,UAAU,KAAI,MAAM,CAAC,UAAU,CAAC;IACpF,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACrH,CAAC;AAHD,sCAGC"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fillIn = void 0;
4
- const dispatch_1 = require("../dispatch");
5
- // do a best effort at determining the key code
6
- function guessCode(letter) {
7
- if (letter.match(/^[a-zA-Z]$/)) {
8
- return `Key${letter.toUpperCase()}`;
9
- }
10
- else if (letter.match(/^[0-9]$/)) {
11
- return `Digit${letter}`;
12
- }
13
- }
14
- function clearText(element) {
15
- if (element.value.length) {
16
- setValue(element, "");
17
- dispatch_1.dispatchInput(element, { inputType: 'deleteContentBackward', data: null });
18
- }
19
- }
20
- function enterText(element, value) {
21
- for (let letter of value) {
22
- if (dispatch_1.dispatchKeyDown(element, { key: letter, code: guessCode(letter) })) {
23
- // don't change the value if the keydown event was stopped
24
- setValue(element, element.value + letter);
25
- // input is not dispatched if the keydown event was stopped
26
- dispatch_1.dispatchInput(element, { inputType: 'insertText', data: letter });
27
- }
28
- // keyup is always dispatched
29
- dispatch_1.dispatchKeyUp(element, { key: letter, code: guessCode(letter) });
30
- }
31
- }
32
- /**
33
- * Use the prototype setter of the element in order to set the value, that way any behavior that monkey patches
34
- * the element itself is circumvented. This has the effect of the value just "magically" appearing on the input
35
- * element just like it does when the browser sets the value because of the default action of an event.
36
- * We have to do this because React actually does do this monkey-patching as an optimization. Basically, they
37
- * short-circuit syncing the react state whenever someone sets input.value and then ignore the next `change` event.
38
- *
39
- * See https://github.com/cypress-io/cypress/issues/536
40
- */
41
- function setValue(element, value) {
42
- let property = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), 'value');
43
- if (property && property.set) {
44
- property.set.call(element, value);
45
- }
46
- else {
47
- // if the value property on the element protoype is not present
48
- // then there are worse problems. But this is very typesafe!
49
- element.value = value;
50
- }
51
- }
52
- /**
53
- * Fill in text into an element by emulating how a user would do it, first
54
- * focusing the element, then filling in the text letter by letter, generating
55
- * the appropriate keyboard events.
56
- *
57
- * @param element The element to fill in text in
58
- * @param value The text value to fill in
59
- */
60
- function fillIn(element, value) {
61
- let originalValue = element.value;
62
- element.focus();
63
- clearText(element);
64
- enterText(element, value);
65
- if (originalValue !== value) {
66
- dispatch_1.dispatchChange(element);
67
- }
68
- element.blur();
69
- }
70
- exports.fillIn = fillIn;
71
- //# sourceMappingURL=fill-in.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fill-in.js","sourceRoot":"","sources":["../../../src/element/fill-in.ts"],"names":[],"mappings":";;;AAAA,0CAA4F;AAI5F,+CAA+C;AAC/C,SAAS,SAAS,CAAC,MAAc;IAC/B,IAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC7B,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;KACrC;SAAM,IAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;QACjC,OAAO,QAAQ,MAAM,EAAE,CAAC;KACzB;AACH,CAAC;AAED,SAAS,SAAS,CAAC,OAAyB;IAC1C,IAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE;QACvB,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtB,wBAAa,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,uBAAuB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,EAAE,KAAK,CAAC,CAAC;IAE1B,IAAG,aAAa,KAAK,KAAK,EAAE;QAC1B,yBAAc,CAAC,OAAO,CAAC,CAAC;KACzB;IAED,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAbD,wBAaC"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.blur = exports.focus = exports.focused = void 0;
5
- /**
6
- * Helper function for focused filters, returns whether the given element is focused.
7
- */
8
- function focused(element) {
9
- console.warn("usage of the focused() helper is deprecated, and will be removed from the public API. Instead, switch your interactor to extend the `HTML` interactor to inherit the `focused` filter");
10
- return element.ownerDocument.activeElement === element;
11
- }
12
- exports.focused = focused;
13
- /**
14
- * Helper function for focus action, performs `element.focus()` on the selected element.
15
- *
16
- * Can be used with object property value shorthand in your interactor actions.
17
- *
18
- * ```js
19
- * actions: {
20
- * focus,
21
- * }
22
- * ```
23
- */
24
- async function focus(interactor) {
25
- console.warn("usage of the focus() helper is deprecated, and will be removed from the public API. Instead, switch your interactor to extend the `HTML` interactor to inherit the `focus()` action");
26
- await interactor.perform((element) => element.focus());
27
- }
28
- exports.focus = focus;
29
- ;
30
- /**
31
- * Helper function for blur action, performs `element.blur()` on the selected element.
32
- *
33
- * Can be used with object property value shorthand in your interactor actions.
34
- *
35
- * ```js
36
- * actions: {
37
- * focus,
38
- * }
39
- * ```
40
- */
41
- async function blur(interactor) {
42
- console.warn("usage of the blur() helper is deprecated, and will be removed from the public API. Instead, switch your interactor to extend the `HTML` interactor to inherit the `blur()` action");
43
- await interactor.perform((element) => element.blur());
44
- }
45
- exports.blur = blur;
46
- ;
47
- //# sourceMappingURL=focused.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focused.js","sourceRoot":"","sources":["../../src/focused.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAIvD;;GAEG;AACH,SAAgB,OAAO,CAAC,OAAgB;IACtC,OAAO,CAAC,IAAI,CAAC,uLAAuL,CAAC,CAAC;IACtM,OAAO,OAAO,CAAC,aAAa,CAAC,aAAa,KAAK,OAAO,CAAC;AACzD,CAAC;AAHD,0BAGC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,KAAK,CAAwB,UAA8B;IAC/E,OAAO,CAAC,IAAI,CAAC,qLAAqL,CAAC,CAAC;IACpM,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;AACxD,CAAC;AAHD,sBAGC;AAAA,CAAC;AAEF;;;;;;;;;;GAUG;AACI,KAAK,UAAU,IAAI,CAAwB,UAA8B;IAC9E,OAAO,CAAC,IAAI,CAAC,mLAAmL,CAAC,CAAC;IAClM,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AACvD,CAAC;AAHD,oBAGC;AAAA,CAAC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.perform = void 0;
4
- function perform(fn) {
5
- console.warn('`perform` is deprecated, please use `({ perform }) => perform(...)` instead!');
6
- return async (interactor, ...args) => {
7
- return await interactor.perform(element => {
8
- fn(element, ...args);
9
- });
10
- };
11
- }
12
- exports.perform = perform;
13
- //# sourceMappingURL=perform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perform.js","sourceRoot":"","sources":["../../src/perform.ts"],"names":[],"mappings":";;;AAGA,SAAgB,OAAO,CAA2E,EAAoC;IACpI,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;IAC7F,OAAO,KAAK,EAAE,UAA4B,EAAE,GAAG,IAAO,EAAE,EAAE;QACxD,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACxC,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAPD,0BAOC"}
@@ -1,6 +0,0 @@
1
- export declare function dispatchChange(element: HTMLElement): boolean;
2
- export declare function dispatchInput(element: HTMLElement, options?: InputEventInit): boolean;
3
- export declare function dispatchKeyDown(element: HTMLElement, options?: KeyboardEventInit): boolean;
4
- export declare function dispatchKeyUp(element: HTMLElement, options?: KeyboardEventInit): boolean;
5
- export declare function dispatchClick(element: HTMLElement, options?: MouseEventInit): boolean;
6
- //# sourceMappingURL=dispatch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAG5D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAGzF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAG9F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAG5F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAGzF"}
@@ -1,12 +0,0 @@
1
- declare type TextFieldElement = HTMLInputElement | HTMLTextAreaElement;
2
- /**
3
- * Fill in text into an element by emulating how a user would do it, first
4
- * focusing the element, then filling in the text letter by letter, generating
5
- * the appropriate keyboard events.
6
- *
7
- * @param element The element to fill in text in
8
- * @param value The text value to fill in
9
- */
10
- export declare function fillIn(element: TextFieldElement, value: string): void;
11
- export {};
12
- //# sourceMappingURL=fill-in.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fill-in.d.ts","sourceRoot":"","sources":["../../src/element/fill-in.ts"],"names":[],"mappings":"AAEA,aAAK,gBAAgB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAoD/D;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAarE"}
@@ -1,26 +0,0 @@
1
- export function dispatchChange(element) {
2
- var _a;
3
- let Event = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.Event) || window.Event;
4
- return element.dispatchEvent(new Event('change', { bubbles: true, cancelable: false }));
5
- }
6
- export function dispatchInput(element, options = {}) {
7
- var _a;
8
- let InputEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.InputEvent) || window.InputEvent;
9
- return element.dispatchEvent(new InputEvent('input', Object.assign({ bubbles: true, cancelable: false }, options)));
10
- }
11
- export function dispatchKeyDown(element, options = {}) {
12
- var _a;
13
- let KeyboardEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.KeyboardEvent) || window.KeyboardEvent;
14
- return element.dispatchEvent(new KeyboardEvent('keydown', Object.assign({ bubbles: true, cancelable: true }, options)));
15
- }
16
- export function dispatchKeyUp(element, options = {}) {
17
- var _a;
18
- let KeyboardEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.KeyboardEvent) || window.KeyboardEvent;
19
- return element.dispatchEvent(new KeyboardEvent('keyup', Object.assign({ bubbles: true, cancelable: true }, options)));
20
- }
21
- export function dispatchClick(element, options = {}) {
22
- var _a;
23
- let MouseEvent = ((_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.MouseEvent) || window.MouseEvent;
24
- return element.dispatchEvent(new MouseEvent('click', Object.assign({ bubbles: true, cancelable: true }, options)));
25
- }
26
- //# sourceMappingURL=dispatch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/dispatch.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,OA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C,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACxH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAoB,EAAE,UAA0B,EAAE;;IAC9E,IAAI,UAAU,GAAG,CAAA,MAAA,OAAO,CAAC,aAAa,CAAC,WAAW,0CAAE,UAAU,KAAI,MAAM,CAAC,UAAU,CAAC;IACpF,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACrH,CAAC"}
@@ -1,67 +0,0 @@
1
- import { dispatchChange, dispatchInput, dispatchKeyDown, dispatchKeyUp } from '../dispatch';
2
- // do a best effort at determining the key code
3
- function guessCode(letter) {
4
- if (letter.match(/^[a-zA-Z]$/)) {
5
- return `Key${letter.toUpperCase()}`;
6
- }
7
- else if (letter.match(/^[0-9]$/)) {
8
- return `Digit${letter}`;
9
- }
10
- }
11
- function clearText(element) {
12
- if (element.value.length) {
13
- setValue(element, "");
14
- dispatchInput(element, { inputType: 'deleteContentBackward', data: null });
15
- }
16
- }
17
- function enterText(element, value) {
18
- for (let letter of value) {
19
- if (dispatchKeyDown(element, { key: letter, code: guessCode(letter) })) {
20
- // don't change the value if the keydown event was stopped
21
- setValue(element, element.value + letter);
22
- // input is not dispatched if the keydown event was stopped
23
- dispatchInput(element, { inputType: 'insertText', data: letter });
24
- }
25
- // keyup is always dispatched
26
- dispatchKeyUp(element, { key: letter, code: guessCode(letter) });
27
- }
28
- }
29
- /**
30
- * Use the prototype setter of the element in order to set the value, that way any behavior that monkey patches
31
- * the element itself is circumvented. This has the effect of the value just "magically" appearing on the input
32
- * element just like it does when the browser sets the value because of the default action of an event.
33
- * We have to do this because React actually does do this monkey-patching as an optimization. Basically, they
34
- * short-circuit syncing the react state whenever someone sets input.value and then ignore the next `change` event.
35
- *
36
- * See https://github.com/cypress-io/cypress/issues/536
37
- */
38
- function setValue(element, value) {
39
- let property = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), 'value');
40
- if (property && property.set) {
41
- property.set.call(element, value);
42
- }
43
- else {
44
- // if the value property on the element protoype is not present
45
- // then there are worse problems. But this is very typesafe!
46
- element.value = value;
47
- }
48
- }
49
- /**
50
- * Fill in text into an element by emulating how a user would do it, first
51
- * focusing the element, then filling in the text letter by letter, generating
52
- * the appropriate keyboard events.
53
- *
54
- * @param element The element to fill in text in
55
- * @param value The text value to fill in
56
- */
57
- export function fillIn(element, value) {
58
- let originalValue = element.value;
59
- element.focus();
60
- clearText(element);
61
- enterText(element, value);
62
- if (originalValue !== value) {
63
- dispatchChange(element);
64
- }
65
- element.blur();
66
- }
67
- //# sourceMappingURL=fill-in.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fill-in.js","sourceRoot":"","sources":["../../../src/element/fill-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5F,+CAA+C;AAC/C,SAAS,SAAS,CAAC,MAAc;IAC/B,IAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC7B,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;KACrC;SAAM,IAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;QACjC,OAAO,QAAQ,MAAM,EAAE,CAAC;KACzB;AACH,CAAC;AAED,SAAS,SAAS,CAAC,OAAyB;IAC1C,IAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE;QACvB,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtB,aAAa,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,CA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IAAG,aAAa,KAAK,KAAK,EAAE;QAC1B,cAAc,CAAC,OAAO,CAAC,CAAC;KACzB;IAED,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC"}
@@ -1,41 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /**
3
- * Helper function for focused filters, returns whether the given element is focused.
4
- */
5
- export function focused(element) {
6
- console.warn("usage of the focused() helper is deprecated, and will be removed from the public API. Instead, switch your interactor to extend the `HTML` interactor to inherit the `focused` filter");
7
- return element.ownerDocument.activeElement === element;
8
- }
9
- /**
10
- * Helper function for focus action, performs `element.focus()` on the selected element.
11
- *
12
- * Can be used with object property value shorthand in your interactor actions.
13
- *
14
- * ```js
15
- * actions: {
16
- * focus,
17
- * }
18
- * ```
19
- */
20
- export async function focus(interactor) {
21
- console.warn("usage of the focus() helper is deprecated, and will be removed from the public API. Instead, switch your interactor to extend the `HTML` interactor to inherit the `focus()` action");
22
- await interactor.perform((element) => element.focus());
23
- }
24
- ;
25
- /**
26
- * Helper function for blur action, performs `element.blur()` on the selected element.
27
- *
28
- * Can be used with object property value shorthand in your interactor actions.
29
- *
30
- * ```js
31
- * actions: {
32
- * focus,
33
- * }
34
- * ```
35
- */
36
- export async function blur(interactor) {
37
- console.warn("usage of the blur() helper is deprecated, and will be removed from the public API. Instead, switch your interactor to extend the `HTML` interactor to inherit the `blur()` action");
38
- await interactor.perform((element) => element.blur());
39
- }
40
- ;
41
- //# sourceMappingURL=focused.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focused.js","sourceRoot":"","sources":["../../src/focused.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAIvD;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB;IACtC,OAAO,CAAC,IAAI,CAAC,uLAAuL,CAAC,CAAC;IACtM,OAAO,OAAO,CAAC,aAAa,CAAC,aAAa,KAAK,OAAO,CAAC;AACzD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAwB,UAA8B;IAC/E,OAAO,CAAC,IAAI,CAAC,qLAAqL,CAAC,CAAC;IACpM,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;AACxD,CAAC;AAAA,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAwB,UAA8B;IAC9E,OAAO,CAAC,IAAI,CAAC,mLAAmL,CAAC,CAAC;IAClM,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AACvD,CAAC;AAAA,CAAC"}
@@ -1,9 +0,0 @@
1
- export function perform(fn) {
2
- console.warn('`perform` is deprecated, please use `({ perform }) => perform(...)` instead!');
3
- return async (interactor, ...args) => {
4
- return await interactor.perform(element => {
5
- fn(element, ...args);
6
- });
7
- };
8
- }
9
- //# sourceMappingURL=perform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perform.js","sourceRoot":"","sources":["../../src/perform.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,OAAO,CAA2E,EAAoC;IACpI,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;IAC7F,OAAO,KAAK,EAAE,UAA4B,EAAE,GAAG,IAAO,EAAE,EAAE;QACxD,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACxC,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
package/dist/focused.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { Interactor } from './specification';
2
- /**
3
- * Helper function for focused filters, returns whether the given element is focused.
4
- */
5
- export declare function focused(element: Element): boolean;
6
- /**
7
- * Helper function for focus action, performs `element.focus()` on the selected element.
8
- *
9
- * Can be used with object property value shorthand in your interactor actions.
10
- *
11
- * ```js
12
- * actions: {
13
- * focus,
14
- * }
15
- * ```
16
- */
17
- export declare function focus<E extends HTMLElement>(interactor: Interactor<E, any>): Promise<void>;
18
- /**
19
- * Helper function for blur action, performs `element.blur()` on the selected element.
20
- *
21
- * Can be used with object property value shorthand in your interactor actions.
22
- *
23
- * ```js
24
- * actions: {
25
- * focus,
26
- * }
27
- * ```
28
- */
29
- export declare function blur<E extends HTMLElement>(interactor: Interactor<E, any>): Promise<void>;
30
- //# sourceMappingURL=focused.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focused.d.ts","sourceRoot":"","sources":["../src/focused.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAGjD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhG;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/F"}
package/dist/perform.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Interactor, FilterParams } from './specification';
2
- export declare function perform<E extends Element, F extends FilterParams<any, any>, T extends unknown[]>(fn: (element: E, ...args: T) => void): (interactor: Interactor<E, F>, ...args: T) => Promise<void>;
3
- //# sourceMappingURL=perform.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perform.d.ts","sourceRoot":"","sources":["../src/perform.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3D,wBAAgB,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAOnM"}
package/src/dispatch.ts DELETED
@@ -1,24 +0,0 @@
1
- export function dispatchChange(element: HTMLElement): boolean {
2
- let Event = element.ownerDocument.defaultView?.Event || window.Event;
3
- return element.dispatchEvent(new Event('change', { bubbles: true, cancelable: false }));
4
- }
5
-
6
- export function dispatchInput(element: HTMLElement, options: InputEventInit = {}): boolean {
7
- let InputEvent = element.ownerDocument.defaultView?.InputEvent || window.InputEvent;
8
- return element.dispatchEvent(new InputEvent('input', Object.assign({ bubbles: true, cancelable: false }, options)));
9
- }
10
-
11
- export function dispatchKeyDown(element: HTMLElement, options: KeyboardEventInit = {}): boolean {
12
- let KeyboardEvent = element.ownerDocument.defaultView?.KeyboardEvent || window.KeyboardEvent;
13
- return element.dispatchEvent(new KeyboardEvent('keydown', Object.assign({ bubbles: true, cancelable: true }, options)));
14
- }
15
-
16
- export function dispatchKeyUp(element: HTMLElement, options: KeyboardEventInit = {}): boolean {
17
- let KeyboardEvent = element.ownerDocument.defaultView?.KeyboardEvent || window.KeyboardEvent;
18
- return element.dispatchEvent(new KeyboardEvent('keyup', Object.assign({ bubbles: true, cancelable: true }, options)));
19
- }
20
-
21
- export function dispatchClick(element: HTMLElement, options: MouseEventInit = {}): boolean {
22
- let MouseEvent = element.ownerDocument.defaultView?.MouseEvent || window.MouseEvent;
23
- return element.dispatchEvent(new MouseEvent('click', Object.assign({ bubbles: true, cancelable: true }, options)));
24
- }