@thisisagile/easy-test-react 13.5.2 → 13.6.1
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/dist/ElementTester.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class ElementTester {
|
|
|
7
7
|
get then(): Tester;
|
|
8
8
|
click: () => this | undefined;
|
|
9
9
|
awaitClick: () => Promise<boolean>;
|
|
10
|
-
mouseDown: () => this | undefined;
|
|
10
|
+
mouseDown: (index?: number) => this | undefined;
|
|
11
11
|
type: (value: string) => boolean;
|
|
12
12
|
wait: () => Promise<Element>;
|
|
13
13
|
waitForRemove: () => Promise<void>;
|
package/dist/ElementTester.js
CHANGED
|
@@ -9,7 +9,7 @@ class ElementTester {
|
|
|
9
9
|
this.element = element;
|
|
10
10
|
this.click = () => (this.element() && react_1.fireEvent.click(this.element()) ? this : undefined);
|
|
11
11
|
this.awaitClick = () => (0, react_1.waitFor)(() => react_1.fireEvent.click(this.element()));
|
|
12
|
-
this.mouseDown = () =>
|
|
12
|
+
this.mouseDown = (index) => this.element() && react_1.fireEvent.mouseDown((0, easy_1.isDefined)(index) ? this.element().children[index] : this.element()) ? this : undefined;
|
|
13
13
|
this.type = (value) => react_1.fireEvent.change(this.element(), { target: { value } });
|
|
14
14
|
this.wait = () => (0, react_1.waitFor)(this.element);
|
|
15
15
|
this.waitForRemove = () => (0, react_1.waitForElementToBeRemoved)(this.element);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTester.js","sourceRoot":"","sources":["../src/ElementTester.ts"],"names":[],"mappings":";;;AAAA,kDAAuF;AACvF,
|
|
1
|
+
{"version":3,"file":"ElementTester.js","sourceRoot":"","sources":["../src/ElementTester.ts"],"names":[],"mappings":";;;AAAA,kDAAuF;AACvF,4CAAqD;AACrD,qCAAkC;AAElC,MAAa,aAAa;IACxB,YAAqB,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAiB3C,UAAK,GAAG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;aACf,EAAE,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,eAAM,CAAC,IAAI,CAAC,OAAO,EAAiB,CAAC,CAAC;IACnD,CAAC;CASF;AAzBD,sCAyBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-test-react",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.6.1",
|
|
4
4
|
"description": "Straightforward wrapper library for testing-library/react",
|
|
5
5
|
"author": "Sander Hoogendoorn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@thisisagile/easy-test": "13.
|
|
36
|
+
"@thisisagile/easy-test": "13.6.1",
|
|
37
37
|
"jest-environment-jsdom": "^29.5.0",
|
|
38
38
|
"weak-napi": "^2.0.2"
|
|
39
39
|
},
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@testing-library/dom": "^9.2.0",
|
|
42
42
|
"@testing-library/jest-dom": "^5.16.5",
|
|
43
43
|
"@testing-library/react": "^14.0.0",
|
|
44
|
-
"@thisisagile/easy": "^13.
|
|
44
|
+
"@thisisagile/easy": "^13.6.1",
|
|
45
45
|
"@types/react": "^18.0.28",
|
|
46
46
|
"react": "^18.2.0",
|
|
47
47
|
"react-dom": "^18.2.0"
|
package/src/ElementTester.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fireEvent, waitFor, waitForElementToBeRemoved } from '@testing-library/react';
|
|
2
|
-
import { tryTo } from '@thisisagile/easy';
|
|
2
|
+
import { isDefined, tryTo } from '@thisisagile/easy';
|
|
3
3
|
import { Tester } from './Tester';
|
|
4
4
|
|
|
5
5
|
export class ElementTester {
|
|
@@ -22,7 +22,8 @@ export class ElementTester {
|
|
|
22
22
|
|
|
23
23
|
click = (): this | undefined => (this.element() && fireEvent.click(this.element()) ? this : undefined);
|
|
24
24
|
awaitClick = (): Promise<boolean> => waitFor(() => fireEvent.click(this.element()));
|
|
25
|
-
mouseDown = (): this | undefined =>
|
|
25
|
+
mouseDown = (index?: number): this | undefined =>
|
|
26
|
+
this.element() && fireEvent.mouseDown(isDefined(index) ? this.element().children[index] : this.element()) ? this : undefined;
|
|
26
27
|
type = (value: string): boolean => fireEvent.change(this.element(), { target: { value } });
|
|
27
28
|
wait = (): Promise<Element> => waitFor(this.element);
|
|
28
29
|
waitForRemove = (): Promise<void> => waitForElementToBeRemoved(this.element);
|