@thisisagile/easy-test-react 12.6.0 → 12.7.0
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/Tester.js +5 -5
- package/dist/Tester.js.map +1 -1
- package/package.json +4 -4
- package/src/Tester.ts +6 -6
package/dist/Tester.js
CHANGED
|
@@ -7,15 +7,15 @@ const ElementTester_1 = require("./ElementTester");
|
|
|
7
7
|
class Tester {
|
|
8
8
|
constructor(container) {
|
|
9
9
|
this.container = container;
|
|
10
|
-
this.byText = (text) =>
|
|
10
|
+
this.byText = (text) => react_1.screen.getByText(text);
|
|
11
11
|
this.atText = (text) => new ElementTester_1.ElementTester(() => this.byText(text));
|
|
12
|
-
this.byId = (id) =>
|
|
12
|
+
this.byId = (id) => react_1.screen.getByTestId(id.toString());
|
|
13
13
|
this.atId = (id) => new ElementTester_1.ElementTester(() => this.byId(id));
|
|
14
|
-
this.byRole = (role) =>
|
|
14
|
+
this.byRole = (role) => react_1.screen.getByRole(role);
|
|
15
15
|
this.atRole = (role) => new ElementTester_1.ElementTester(() => this.byRole(role));
|
|
16
|
-
this.byTitle = (title) =>
|
|
16
|
+
this.byTitle = (title) => react_1.screen.getByTitle(title);
|
|
17
17
|
this.atTitle = (title) => new ElementTester_1.ElementTester(() => this.byTitle(title));
|
|
18
|
-
this.byPlaceholder = (placeholder) =>
|
|
18
|
+
this.byPlaceholder = (placeholder) => react_1.screen.getByPlaceholderText(placeholder);
|
|
19
19
|
this.atPlaceholder = (placeholder) => new ElementTester_1.ElementTester(() => this.byPlaceholder(placeholder));
|
|
20
20
|
this.submit = (id = 'btn-submit') => this.atId(id);
|
|
21
21
|
}
|
package/dist/Tester.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tester.js","sourceRoot":"","sources":["../src/Tester.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Tester.js","sourceRoot":"","sources":["../src/Tester.ts"],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CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;QACjH,WAAM,GAAG,CAAC,KAAS,YAAY,EAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAfZ,CAAC;;AADxD,wBAiBC;AAdQ,aAAM,GAAG,CAAC,SAAuB,EAAmB,EAAE,CAAC,IAAA,6BAAa,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACnH,iBAAU,GAAG,CAAC,SAAuB,EAAU,EAAE,CAAC,IAAI,MAAM,CAAC,IAAA,cAAM,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;AAe5F,MAAM,WAAW,GAAG,KAAK,EAAE,SAAuB,EAAmB,EAAE,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAAjG,QAAA,WAAW,eAAsF;AACvG,MAAM,OAAO,GAAG,CAAC,SAAuB,EAAU,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAA5E,QAAA,OAAO,WAAqE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-test-react",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.7.0",
|
|
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": "12.
|
|
36
|
+
"@thisisagile/easy-test": "12.7.0",
|
|
37
37
|
"jest-environment-jsdom": "^29.0.3",
|
|
38
38
|
"weak-napi": "^2.0.2"
|
|
39
39
|
},
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@testing-library/dom": "^8.18.1",
|
|
42
42
|
"@testing-library/jest-dom": "^5.16.5",
|
|
43
43
|
"@testing-library/react": "^13.4.0",
|
|
44
|
-
"@thisisagile/easy": "^12.
|
|
45
|
-
"@types/react": "^18.0.
|
|
44
|
+
"@thisisagile/easy": "^12.7.0",
|
|
45
|
+
"@types/react": "^18.0.24",
|
|
46
46
|
"react": "^18.2.0",
|
|
47
47
|
"react-dom": "^18.2.0"
|
|
48
48
|
}
|
package/src/Tester.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, render } from '@testing-library/react';
|
|
1
|
+
import { getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, render, screen } from '@testing-library/react';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import { Id } from '@thisisagile/easy';
|
|
4
4
|
import { waitForRender } from './waitForRender';
|
|
@@ -10,15 +10,15 @@ export class Tester {
|
|
|
10
10
|
static render = (component: ReactElement): Promise<Tester> => waitForRender(component).then(c => new Tester(c.container));
|
|
11
11
|
static renderSync = (component: ReactElement): Tester => new Tester(render(component).container);
|
|
12
12
|
|
|
13
|
-
byText = (text: string): HTMLElement => getByText(
|
|
13
|
+
byText = (text: string): HTMLElement => screen.getByText(text);
|
|
14
14
|
atText = (text: string): ElementTester => new ElementTester(() => this.byText(text));
|
|
15
|
-
byId = (id: Id): HTMLElement => getByTestId(
|
|
15
|
+
byId = (id: Id): HTMLElement => screen.getByTestId(id.toString());
|
|
16
16
|
atId = (id: Id): ElementTester => new ElementTester(() => this.byId(id));
|
|
17
|
-
byRole = (role: string): HTMLElement => getByRole(
|
|
17
|
+
byRole = (role: string): HTMLElement => screen.getByRole(role);
|
|
18
18
|
atRole = (role: string): ElementTester => new ElementTester(() => this.byRole(role));
|
|
19
|
-
byTitle = (title: string): HTMLElement => getByTitle(
|
|
19
|
+
byTitle = (title: string): HTMLElement => screen.getByTitle(title);
|
|
20
20
|
atTitle = (title: string): ElementTester => new ElementTester(() => this.byTitle(title));
|
|
21
|
-
byPlaceholder = (placeholder: string): HTMLElement => getByPlaceholderText(
|
|
21
|
+
byPlaceholder = (placeholder: string): HTMLElement => screen.getByPlaceholderText( placeholder);
|
|
22
22
|
atPlaceholder = (placeholder: string): ElementTester => new ElementTester(() => this.byPlaceholder(placeholder));
|
|
23
23
|
submit = (id: Id = 'btn-submit'): ElementTester => this.atId(id);
|
|
24
24
|
}
|