@thisisagile/easy-test-react 7.11.8 → 7.12.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/ElementTester.js +2 -2
- package/dist/ElementTester.js.map +1 -1
- package/dist/Tester.d.ts +1 -0
- package/dist/Tester.js +7 -6
- package/dist/Tester.js.map +1 -1
- package/dist/waitForRender.js +3 -3
- package/dist/waitForRender.js.map +1 -1
- package/package.json +5 -5
- package/src/Tester.ts +1 -0
package/dist/ElementTester.js
CHANGED
|
@@ -7,8 +7,8 @@ class ElementTester {
|
|
|
7
7
|
this.element = element;
|
|
8
8
|
this.click = () => (this.element() ? react_1.fireEvent.click(this.element()) : false);
|
|
9
9
|
this.type = (value) => react_1.fireEvent.change(this.element(), { target: { value } });
|
|
10
|
-
this.wait = () => react_1.waitFor(this.element);
|
|
11
|
-
this.waitForRemove = () => react_1.waitForElementToBeRemoved(this.element);
|
|
10
|
+
this.wait = () => (0, react_1.waitFor)(this.element);
|
|
11
|
+
this.waitForRemove = () => (0, react_1.waitForElementToBeRemoved)(this.element);
|
|
12
12
|
}
|
|
13
13
|
get value() {
|
|
14
14
|
return this.element()?.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTester.js","sourceRoot":"","sources":["../src/ElementTester.ts"],"names":[],"mappings":";;;AAAA,kDAAuF;AAEvF,MAAa,aAAa;IACxB,YAAqB,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAe3C,UAAK,GAAG,GAAY,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,iBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAClF,SAAI,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,iBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3F,SAAI,GAAG,GAAqB,EAAE,CAAC,eAAO,
|
|
1
|
+
{"version":3,"file":"ElementTester.js","sourceRoot":"","sources":["../src/ElementTester.ts"],"names":[],"mappings":";;;AAAA,kDAAuF;AAEvF,MAAa,aAAa;IACxB,YAAqB,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAe3C,UAAK,GAAG,GAAY,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,iBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAClF,SAAI,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,iBAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3F,SAAI,GAAG,GAAqB,EAAE,CAAC,IAAA,eAAO,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,kBAAa,GAAG,GAAkB,EAAE,CAAC,IAAA,iCAAyB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAlB/B,CAAC;IAE/C,IAAI,KAAK;QACP,OAAQ,IAAI,CAAC,OAAO,EAAU,EAAE,KAAe,CAAC;IAClD,CAAC;IAED,IAAI,OAAO;QACT,IAAI;YACF,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;SACb;QAAC,MAAM;YACN,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CAMF;AApBD,sCAoBC"}
|
package/dist/Tester.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class Tester {
|
|
|
14
14
|
atRole: (role: string) => ElementTester;
|
|
15
15
|
byPlaceholder: (placeholder: string) => HTMLElement;
|
|
16
16
|
atPlaceholder: (placeholder: string) => ElementTester;
|
|
17
|
+
submit: (id?: Id) => ElementTester;
|
|
17
18
|
}
|
|
18
19
|
export declare const rendersWait: (component: ReactElement) => Promise<Tester>;
|
|
19
20
|
export declare const renders: (component: ReactElement) => Tester;
|
package/dist/Tester.js
CHANGED
|
@@ -7,19 +7,20 @@ const ElementTester_1 = require("./ElementTester");
|
|
|
7
7
|
class Tester {
|
|
8
8
|
constructor(container) {
|
|
9
9
|
this.container = container;
|
|
10
|
-
this.byText = (text) => react_1.getByText(this.container, text);
|
|
10
|
+
this.byText = (text) => (0, react_1.getByText)(this.container, text);
|
|
11
11
|
this.atText = (text) => new ElementTester_1.ElementTester(() => this.byText(text));
|
|
12
|
-
this.byId = (id) => react_1.getByTestId(this.container, id.toString());
|
|
12
|
+
this.byId = (id) => (0, react_1.getByTestId)(this.container, id.toString());
|
|
13
13
|
this.atId = (id) => new ElementTester_1.ElementTester(() => this.byId(id));
|
|
14
|
-
this.byRole = (role) => react_1.getByRole(this.container, role);
|
|
14
|
+
this.byRole = (role) => (0, react_1.getByRole)(this.container, role);
|
|
15
15
|
this.atRole = (role) => new ElementTester_1.ElementTester(() => this.byRole(role));
|
|
16
|
-
this.byPlaceholder = (placeholder) => react_1.getByPlaceholderText(this.container, placeholder);
|
|
16
|
+
this.byPlaceholder = (placeholder) => (0, react_1.getByPlaceholderText)(this.container, placeholder);
|
|
17
17
|
this.atPlaceholder = (placeholder) => new ElementTester_1.ElementTester(() => this.byPlaceholder(placeholder));
|
|
18
|
+
this.submit = (id = 'btn-submit') => this.atId(id);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
exports.Tester = Tester;
|
|
21
|
-
Tester.render = (component) => waitForRender_1.waitForRender(component).then(c => new Tester(c.container));
|
|
22
|
-
Tester.renderSync = (component) => new Tester(react_1.render(component).container);
|
|
22
|
+
Tester.render = (component) => (0, waitForRender_1.waitForRender)(component).then(c => new Tester(c.container));
|
|
23
|
+
Tester.renderSync = (component) => new Tester((0, react_1.render)(component).container);
|
|
23
24
|
const rendersWait = async (component) => await Tester.render(component);
|
|
24
25
|
exports.rendersWait = rendersWait;
|
|
25
26
|
const renders = (component) => Tester.renderSync(component);
|
package/dist/Tester.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tester.js","sourceRoot":"","sources":["../src/Tester.ts"],"names":[],"mappings":";;;AAAA,kDAAyG;AAGzG,mDAAgD;AAChD,mDAAgD;AAEhD,MAAa,MAAM;IACjB,YAA4B,SAAsB;QAAtB,cAAS,GAAT,SAAS,CAAa;QAKlD,WAAM,GAAG,CAAC,IAAY,EAAe,EAAE,CAAC,iBAAS,
|
|
1
|
+
{"version":3,"file":"Tester.js","sourceRoot":"","sources":["../src/Tester.ts"],"names":[],"mappings":";;;AAAA,kDAAyG;AAGzG,mDAAgD;AAChD,mDAAgD;AAEhD,MAAa,MAAM;IACjB,YAA4B,SAAsB;QAAtB,cAAS,GAAT,SAAS,CAAa;QAKlD,WAAM,GAAG,CAAC,IAAY,EAAe,EAAE,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACxE,WAAM,GAAG,CAAC,IAAY,EAAiB,EAAE,CAAC,IAAI,6BAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACrF,SAAI,GAAG,CAAC,EAAM,EAAe,EAAE,CAAC,IAAA,mBAAW,EAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,SAAI,GAAG,CAAC,EAAM,EAAiB,EAAE,CAAC,IAAI,6BAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACzE,WAAM,GAAG,CAAC,IAAY,EAAe,EAAE,CAAC,IAAA,iBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACxE,WAAM,GAAG,CAAC,IAAY,EAAiB,EAAE,CAAC,IAAI,6BAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACrF,kBAAa,GAAG,CAAC,WAAmB,EAAe,EAAE,CAAC,IAAA,4BAAoB,EAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACxG,kBAAa,GAAG,CAAC,WAAmB,EAAiB,EAAE,CAAC,IAAI,6BAAa,CAAC,GAAG,EAAE,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;IAbZ,CAAC;;AADxD,wBAeC;AAZQ,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;AAa5F,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/dist/waitForRender.js
CHANGED
|
@@ -4,9 +4,9 @@ exports.waitForRender = void 0;
|
|
|
4
4
|
const react_1 = require("@testing-library/react");
|
|
5
5
|
async function waitForRender(ui, options) {
|
|
6
6
|
let r = {};
|
|
7
|
-
await react_1.act(async () => {
|
|
8
|
-
r = react_1.render(ui, options);
|
|
9
|
-
await react_1.waitFor(() => r.container, { container: r.container });
|
|
7
|
+
await (0, react_1.act)(async () => {
|
|
8
|
+
r = (0, react_1.render)(ui, options);
|
|
9
|
+
await (0, react_1.waitFor)(() => r.container, { container: r.container });
|
|
10
10
|
});
|
|
11
11
|
return r;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitForRender.js","sourceRoot":"","sources":["../src/waitForRender.ts"],"names":[],"mappings":";;;AAAA,kDAA2F;AAIpF,KAAK,UAAU,aAAa,CAAC,EAAgB,EAAE,OAAwC;IAC5F,IAAI,CAAC,GAAG,EAAkB,CAAC;IAE3B,MAAM,WAAG,
|
|
1
|
+
{"version":3,"file":"waitForRender.js","sourceRoot":"","sources":["../src/waitForRender.ts"],"names":[],"mappings":";;;AAAA,kDAA2F;AAIpF,KAAK,UAAU,aAAa,CAAC,EAAgB,EAAE,OAAwC;IAC5F,IAAI,CAAC,GAAG,EAAkB,CAAC;IAE3B,MAAM,IAAA,WAAG,EAAC,KAAK,IAAI,EAAE;QACnB,CAAC,GAAG,IAAA,cAAM,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACxB,MAAM,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACX,CAAC;AARD,sCAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thisisagile/easy-test-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0",
|
|
4
4
|
"description": "Straightforward wrapper library for testing-library/react",
|
|
5
5
|
"author": "Sander Hoogendoorn",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@thisisagile/easy-test": "7.
|
|
36
|
+
"@thisisagile/easy-test": "7.12.0",
|
|
37
37
|
"weak-napi": "^2.0.2"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@testing-library/dom": "8.
|
|
40
|
+
"@testing-library/dom": "8.9.1",
|
|
41
41
|
"@testing-library/jest-dom": "5.14.1",
|
|
42
42
|
"@testing-library/react": "12.1.2",
|
|
43
|
-
"@thisisagile/easy": "7.
|
|
44
|
-
"@types/react": "17.0.
|
|
43
|
+
"@thisisagile/easy": "7.12.0",
|
|
44
|
+
"@types/react": "17.0.30",
|
|
45
45
|
"react": "^17.0.2",
|
|
46
46
|
"react-dom": "^17.0.2"
|
|
47
47
|
}
|
package/src/Tester.ts
CHANGED
|
@@ -18,6 +18,7 @@ export class Tester {
|
|
|
18
18
|
atRole = (role: string): ElementTester => new ElementTester(() => this.byRole(role));
|
|
19
19
|
byPlaceholder = (placeholder: string): HTMLElement => getByPlaceholderText(this.container, placeholder);
|
|
20
20
|
atPlaceholder = (placeholder: string): ElementTester => new ElementTester(() => this.byPlaceholder(placeholder));
|
|
21
|
+
submit = (id: Id = 'btn-submit'): ElementTester => this.atId(id);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export const rendersWait = async (component: ReactElement): Promise<Tester> => await Tester.render(component);
|