@testing-library/react-native 14.0.0-alpha.5 → 14.0.0-beta.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/README.md +18 -7
- package/build/act.d.ts +0 -3
- package/build/act.js +2 -3
- package/build/act.js.map +1 -1
- package/build/config.js +10 -4
- package/build/config.js.map +1 -1
- package/build/event-handler.d.ts +0 -1
- package/build/event-handler.js +0 -1
- package/build/event-handler.js.map +1 -1
- package/build/fire-event.d.ts +2 -11
- package/build/fire-event.js +0 -32
- package/build/fire-event.js.map +1 -1
- package/build/helpers/accessibility.d.ts +1 -1
- package/build/helpers/accessibility.js.map +1 -1
- package/build/helpers/component-tree.d.ts +1 -1
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/debug.d.ts +1 -1
- package/build/helpers/debug.js.map +1 -1
- package/build/helpers/errors.d.ts +1 -3
- package/build/helpers/errors.js +3 -36
- package/build/helpers/errors.js.map +1 -1
- package/build/helpers/find-all.d.ts +1 -1
- package/build/helpers/find-all.js.map +1 -1
- package/build/helpers/format-element.d.ts +1 -1
- package/build/helpers/format-element.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +1 -1
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
- package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-value.d.ts +1 -1
- package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
- package/build/helpers/matchers/match-label-text.d.ts +1 -1
- package/build/helpers/matchers/match-label-text.js.map +1 -1
- package/build/helpers/matchers/match-text-content.d.ts +1 -1
- package/build/helpers/matchers/match-text-content.js.map +1 -1
- package/build/helpers/pointer-events.d.ts +1 -1
- package/build/helpers/pointer-events.js.map +1 -1
- package/build/helpers/text-content.d.ts +1 -1
- package/build/helpers/text-content.js.map +1 -1
- package/build/helpers/text-input.d.ts +1 -1
- package/build/helpers/text-input.js.map +1 -1
- package/build/helpers/validate-options.d.ts +9 -0
- package/build/helpers/validate-options.js +32 -0
- package/build/helpers/validate-options.js.map +1 -0
- package/build/matchers/to-be-busy.d.ts +1 -1
- package/build/matchers/to-be-busy.js.map +1 -1
- package/build/matchers/to-be-checked.d.ts +1 -1
- package/build/matchers/to-be-checked.js.map +1 -1
- package/build/matchers/to-be-disabled.d.ts +1 -1
- package/build/matchers/to-be-disabled.js.map +1 -1
- package/build/matchers/to-be-empty-element.d.ts +1 -1
- package/build/matchers/to-be-empty-element.js.map +1 -1
- package/build/matchers/to-be-expanded.d.ts +1 -1
- package/build/matchers/to-be-expanded.js.map +1 -1
- package/build/matchers/to-be-on-the-screen.d.ts +1 -1
- package/build/matchers/to-be-on-the-screen.js.map +1 -1
- package/build/matchers/to-be-partially-checked.d.ts +1 -1
- package/build/matchers/to-be-partially-checked.js.map +1 -1
- package/build/matchers/to-be-selected.d.ts +1 -1
- package/build/matchers/to-be-selected.js.map +1 -1
- package/build/matchers/to-be-visible.d.ts +1 -1
- package/build/matchers/to-be-visible.js.map +1 -1
- package/build/matchers/to-contain-element.d.ts +1 -1
- package/build/matchers/to-contain-element.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.d.ts +1 -1
- package/build/matchers/to-have-accessibility-value.js.map +1 -1
- package/build/matchers/to-have-accessible-name.d.ts +1 -1
- package/build/matchers/to-have-accessible-name.js.map +1 -1
- package/build/matchers/to-have-display-value.d.ts +1 -1
- package/build/matchers/to-have-display-value.js.map +1 -1
- package/build/matchers/to-have-prop.d.ts +1 -1
- package/build/matchers/to-have-prop.js.map +1 -1
- package/build/matchers/to-have-style.d.ts +1 -1
- package/build/matchers/to-have-style.js.map +1 -1
- package/build/matchers/to-have-text-content.d.ts +1 -1
- package/build/matchers/to-have-text-content.js.map +1 -1
- package/build/matchers/types.d.ts +1 -1
- package/build/matchers/types.js.map +1 -1
- package/build/matchers/utils.d.ts +1 -1
- package/build/matchers/utils.js.map +1 -1
- package/build/native-state.d.ts +1 -1
- package/build/native-state.js.map +1 -1
- package/build/pure.d.ts +5 -7
- package/build/pure.js +0 -31
- package/build/pure.js.map +1 -1
- package/build/queries/display-value.d.ts +1 -1
- package/build/queries/display-value.js.map +1 -1
- package/build/queries/hint-text.d.ts +1 -1
- package/build/queries/hint-text.js.map +1 -1
- package/build/queries/label-text.d.ts +1 -1
- package/build/queries/label-text.js.map +1 -1
- package/build/queries/make-queries.d.ts +1 -1
- package/build/queries/make-queries.js.map +1 -1
- package/build/queries/placeholder-text.d.ts +1 -1
- package/build/queries/placeholder-text.js.map +1 -1
- package/build/queries/role.d.ts +1 -1
- package/build/queries/role.js.map +1 -1
- package/build/queries/test-id.d.ts +1 -1
- package/build/queries/test-id.js.map +1 -1
- package/build/queries/text.d.ts +1 -1
- package/build/queries/text.js.map +1 -1
- package/build/render-hook.d.ts +0 -8
- package/build/render-hook.js +7 -39
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +2 -3
- package/build/render.js +12 -9
- package/build/render.js.map +1 -1
- package/build/screen.js +0 -1
- package/build/screen.js.map +1 -1
- package/build/test-utils/json.d.ts +1 -1
- package/build/test-utils/json.js.map +1 -1
- package/build/test-utils/timers.d.ts +2 -0
- package/build/test-utils/timers.js +20 -0
- package/build/test-utils/timers.js.map +1 -0
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/user-event/clear.d.ts +1 -1
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/event-builder/base.d.ts +5 -1
- package/build/user-event/event-builder/base.js +1 -1
- package/build/user-event/event-builder/base.js.map +1 -1
- package/build/user-event/event-builder/common.d.ts +5 -0
- package/build/user-event/event-builder/index.d.ts +12 -0
- package/build/user-event/event-builder/scroll-view.d.ts +1 -0
- package/build/user-event/event-builder/text-input.d.ts +6 -0
- package/build/user-event/index.d.ts +1 -1
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/paste.d.ts +1 -1
- package/build/user-event/paste.js.map +1 -1
- package/build/user-event/press/press.d.ts +1 -1
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/scroll/scroll-to.d.ts +1 -1
- package/build/user-event/scroll/scroll-to.js.map +1 -1
- package/build/user-event/setup/setup.d.ts +1 -1
- package/build/user-event/setup/setup.js +17 -3
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.d.ts +1 -1
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/dispatch-event.d.ts +1 -1
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/wait-for.js +8 -13
- package/build/wait-for.js.map +1 -1
- package/build/within.d.ts +1 -1
- package/build/within.js.map +1 -1
- package/package.json +11 -10
- package/build/react-versions.d.ts +0 -1
- package/build/react-versions.js +0 -14
- package/build/react-versions.js.map +0 -1
- package/build/unsafe-render-sync.d.ts +0 -144
- package/build/unsafe-render-sync.js +0 -114
- package/build/unsafe-render-sync.js.map +0 -1
package/build/within.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"within.js","names":["_displayValue","require","_hintText","_labelText","_placeholderText","_role","_testId","_text","within","element","bindByTextQueries","bindByTestIdQueries","bindByDisplayValueQueries","bindByPlaceholderTextQueries","bindByLabelTextQueries","bindByHintTextQueries","bindByRoleQueries","getQueriesForElement","exports"],"sources":["../src/within.ts"],"sourcesContent":["import type { HostElement } from '
|
|
1
|
+
{"version":3,"file":"within.js","names":["_displayValue","require","_hintText","_labelText","_placeholderText","_role","_testId","_text","within","element","bindByTextQueries","bindByTestIdQueries","bindByDisplayValueQueries","bindByPlaceholderTextQueries","bindByLabelTextQueries","bindByHintTextQueries","bindByRoleQueries","getQueriesForElement","exports"],"sources":["../src/within.ts"],"sourcesContent":["import type { HostElement } from 'test-renderer';\n\nimport { bindByDisplayValueQueries } from './queries/display-value';\nimport { bindByHintTextQueries } from './queries/hint-text';\nimport { bindByLabelTextQueries } from './queries/label-text';\nimport { bindByPlaceholderTextQueries } from './queries/placeholder-text';\nimport { bindByRoleQueries } from './queries/role';\nimport { bindByTestIdQueries } from './queries/test-id';\nimport { bindByTextQueries } from './queries/text';\n\nexport function within(element: HostElement) {\n return {\n ...bindByTextQueries(element),\n ...bindByTestIdQueries(element),\n ...bindByDisplayValueQueries(element),\n ...bindByPlaceholderTextQueries(element),\n ...bindByLabelTextQueries(element),\n ...bindByHintTextQueries(element),\n ...bindByRoleQueries(element),\n };\n}\n\nexport const getQueriesForElement = within;\n"],"mappings":";;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEO,SAASO,MAAMA,CAACC,OAAoB,EAAE;EAC3C,OAAO;IACL,GAAG,IAAAC,uBAAiB,EAACD,OAAO,CAAC;IAC7B,GAAG,IAAAE,2BAAmB,EAACF,OAAO,CAAC;IAC/B,GAAG,IAAAG,uCAAyB,EAACH,OAAO,CAAC;IACrC,GAAG,IAAAI,6CAA4B,EAACJ,OAAO,CAAC;IACxC,GAAG,IAAAK,iCAAsB,EAACL,OAAO,CAAC;IAClC,GAAG,IAAAM,+BAAqB,EAACN,OAAO,CAAC;IACjC,GAAG,IAAAO,uBAAiB,EAACP,OAAO;EAC9B,CAAC;AACH;AAEO,MAAMQ,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGT,MAAM","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "14.0.0-
|
|
3
|
+
"version": "14.0.0-beta.0",
|
|
4
4
|
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -26,19 +26,20 @@
|
|
|
26
26
|
"clean": "del build",
|
|
27
27
|
"test": "jest",
|
|
28
28
|
"test:ci": "jest --maxWorkers=2",
|
|
29
|
-
"test:ci:coverage": "jest --maxWorkers=2 --collectCoverage=true
|
|
29
|
+
"test:ci:coverage": "jest --maxWorkers=2 --collectCoverage=true",
|
|
30
|
+
"test:codemods": "node scripts/test-codemods.mjs",
|
|
30
31
|
"typecheck": "tsc",
|
|
31
32
|
"lint": "eslint src --cache",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
33
|
+
"prettier": "prettier --check .",
|
|
34
|
+
"prettier:fix": "prettier --write .",
|
|
35
|
+
"validate": "yarn typecheck && yarn test && yarn lint && yarn prettier",
|
|
36
|
+
"validate:fix": "yarn prettier:fix && yarn lint --fix && yarn typecheck && yarn test -u",
|
|
34
37
|
"build:js": "babel src --out-dir build --extensions \".js,.ts,.jsx,.tsx\" --source-maps --ignore \"**/__tests__/**\"",
|
|
35
38
|
"build:ts": "tsc --build tsconfig.release.json",
|
|
36
39
|
"build": "yarn clean && yarn build:js && yarn build:ts",
|
|
37
40
|
"release": "release-it",
|
|
38
41
|
"release:rc": "release-it --preRelease=rc",
|
|
39
|
-
"release:
|
|
40
|
-
"prettier": "prettier --check .",
|
|
41
|
-
"prettier:write": "prettier --write ."
|
|
42
|
+
"release:beta": "release-it --preRelease=beta"
|
|
42
43
|
},
|
|
43
44
|
"files": [
|
|
44
45
|
"build/",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"jest": ">=29.0.0",
|
|
59
60
|
"react": ">=19.0.0",
|
|
60
61
|
"react-native": ">=0.78",
|
|
61
|
-
"
|
|
62
|
+
"test-renderer": "^0.14.0"
|
|
62
63
|
},
|
|
63
64
|
"peerDependenciesMeta": {
|
|
64
65
|
"jest": {
|
|
@@ -90,9 +91,9 @@
|
|
|
90
91
|
"react-native": "0.83.1",
|
|
91
92
|
"react-native-gesture-handler": "^2.29.1",
|
|
92
93
|
"release-it": "^19.0.6",
|
|
94
|
+
"test-renderer": "0.14.0",
|
|
93
95
|
"typescript": "^5.9.3",
|
|
94
|
-
"typescript-eslint": "^8.47.0"
|
|
95
|
-
"universal-test-renderer": "0.10.1"
|
|
96
|
+
"typescript-eslint": "^8.47.0"
|
|
96
97
|
},
|
|
97
98
|
"publishConfig": {
|
|
98
99
|
"registry": "https://registry.npmjs.org"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function checkReactVersionAtLeast(major: number, minor: number): boolean;
|
package/build/react-versions.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.checkReactVersionAtLeast = checkReactVersionAtLeast;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
-
function checkReactVersionAtLeast(major, minor) {
|
|
10
|
-
if (React.version === undefined) return false;
|
|
11
|
-
const [actualMajor, actualMinor] = React.version.split('.').map(Number);
|
|
12
|
-
return actualMajor > major || actualMajor === major && actualMinor >= minor;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=react-versions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-versions.js","names":["React","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","checkReactVersionAtLeast","major","minor","version","undefined","actualMajor","actualMinor","split","map","Number"],"sources":["../src/react-versions.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function checkReactVersionAtLeast(major: number, minor: number): boolean {\n if (React.version === undefined) return false;\n const [actualMajor, actualMinor] = React.version.split('.').map(Number);\n\n return actualMajor > major || (actualMajor === major && actualMinor >= minor);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAExB,SAASkB,wBAAwBA,CAACC,KAAa,EAAEC,KAAa,EAAW;EAC9E,IAAIxB,KAAK,CAACyB,OAAO,KAAKC,SAAS,EAAE,OAAO,KAAK;EAC7C,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAG5B,KAAK,CAACyB,OAAO,CAACI,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;EAEvE,OAAOJ,WAAW,GAAGJ,KAAK,IAAKI,WAAW,KAAKJ,KAAK,IAAIK,WAAW,IAAIJ,KAAM;AAC/E","ignoreList":[]}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { type HostElement, type JsonElement } from 'universal-test-renderer';
|
|
3
|
-
import type { DebugOptions } from './helpers/debug';
|
|
4
|
-
export interface RenderSyncOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
|
|
7
|
-
* reusable custom render functions for common data providers.
|
|
8
|
-
*/
|
|
9
|
-
wrapper?: React.ComponentType<any>;
|
|
10
|
-
createNodeMock?: (element: React.ReactElement) => object;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use `render` (async) instead. This function is provided for migration purposes only.
|
|
14
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
15
|
-
* to assert on the output.
|
|
16
|
-
*/
|
|
17
|
-
export declare function unsafe_renderSync<T>(component: React.ReactElement<T>, options?: RenderSyncOptions): {
|
|
18
|
-
rerender: (component: React.ReactElement) => void;
|
|
19
|
-
update: (component: React.ReactElement) => void;
|
|
20
|
-
unmount: () => void;
|
|
21
|
-
toJSON: () => JsonElement | null;
|
|
22
|
-
debug: DebugFunction;
|
|
23
|
-
container: HostElement;
|
|
24
|
-
root: HostElement | null;
|
|
25
|
-
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
26
|
-
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
27
|
-
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
28
|
-
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
29
|
-
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
30
|
-
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
31
|
-
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
32
|
-
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
33
|
-
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
34
|
-
queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
35
|
-
findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
36
|
-
findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
37
|
-
getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
38
|
-
getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
39
|
-
queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
40
|
-
queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
41
|
-
findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
42
|
-
findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
43
|
-
getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
44
|
-
getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
45
|
-
queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
46
|
-
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
47
|
-
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
48
|
-
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
49
|
-
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
50
|
-
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
51
|
-
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
52
|
-
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
53
|
-
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
54
|
-
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
55
|
-
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
56
|
-
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
57
|
-
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
58
|
-
queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
59
|
-
findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
60
|
-
findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
61
|
-
getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
62
|
-
getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
63
|
-
queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
64
|
-
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
65
|
-
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
66
|
-
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
67
|
-
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
68
|
-
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
69
|
-
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
70
|
-
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
71
|
-
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
72
|
-
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
73
|
-
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
74
|
-
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
75
|
-
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
76
|
-
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
77
|
-
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
78
|
-
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
79
|
-
};
|
|
80
|
-
export type RenderSyncResult = ReturnType<typeof unsafe_renderSync>;
|
|
81
|
-
export declare function renderInternal<T>(component: React.ReactElement<T>, options?: RenderSyncOptions): {
|
|
82
|
-
rerender: (component: React.ReactElement) => void;
|
|
83
|
-
update: (component: React.ReactElement) => void;
|
|
84
|
-
unmount: () => void;
|
|
85
|
-
toJSON: () => JsonElement | null;
|
|
86
|
-
debug: DebugFunction;
|
|
87
|
-
container: HostElement;
|
|
88
|
-
root: HostElement | null;
|
|
89
|
-
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
90
|
-
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
91
|
-
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
92
|
-
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
93
|
-
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
94
|
-
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
95
|
-
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
96
|
-
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
97
|
-
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
98
|
-
queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
99
|
-
findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
100
|
-
findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
101
|
-
getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
102
|
-
getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
103
|
-
queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
104
|
-
queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
105
|
-
findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
106
|
-
findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
107
|
-
getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
108
|
-
getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
109
|
-
queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
110
|
-
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
111
|
-
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
112
|
-
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
113
|
-
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
114
|
-
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
115
|
-
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
116
|
-
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
117
|
-
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
118
|
-
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
119
|
-
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
120
|
-
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
121
|
-
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
122
|
-
queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
123
|
-
findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
124
|
-
findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
125
|
-
getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
126
|
-
getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
127
|
-
queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
128
|
-
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
129
|
-
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
130
|
-
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
131
|
-
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
132
|
-
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
133
|
-
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
134
|
-
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
135
|
-
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
136
|
-
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
137
|
-
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
138
|
-
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
139
|
-
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
140
|
-
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
141
|
-
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
142
|
-
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
143
|
-
};
|
|
144
|
-
export type DebugFunction = (options?: DebugOptions) => void;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.renderInternal = renderInternal;
|
|
7
|
-
exports.unsafe_renderSync = unsafe_renderSync;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _universalTestRenderer = require("universal-test-renderer");
|
|
10
|
-
var _act = require("./act");
|
|
11
|
-
var _cleanup = require("./cleanup");
|
|
12
|
-
var _config = require("./config");
|
|
13
|
-
var _debug = require("./helpers/debug");
|
|
14
|
-
var _hostComponentNames = require("./helpers/host-component-names");
|
|
15
|
-
var _screen = require("./screen");
|
|
16
|
-
var _within = require("./within");
|
|
17
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use `render` (async) instead. This function is provided for migration purposes only.
|
|
20
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
21
|
-
* to assert on the output.
|
|
22
|
-
*/
|
|
23
|
-
function unsafe_renderSync(component, options = {}) {
|
|
24
|
-
return renderInternal(component, options);
|
|
25
|
-
}
|
|
26
|
-
function renderInternal(component, options) {
|
|
27
|
-
const {
|
|
28
|
-
wrapper: Wrapper,
|
|
29
|
-
createNodeMock
|
|
30
|
-
} = options || {};
|
|
31
|
-
const rendererOptions = {
|
|
32
|
-
textComponents: _hostComponentNames.HOST_TEXT_NAMES,
|
|
33
|
-
createNodeMock
|
|
34
|
-
};
|
|
35
|
-
const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
|
|
36
|
-
const renderer = (0, _universalTestRenderer.createRoot)(rendererOptions);
|
|
37
|
-
(0, _act.unsafe_act)(() => {
|
|
38
|
-
renderer.render(wrap(component));
|
|
39
|
-
});
|
|
40
|
-
const rerender = component => {
|
|
41
|
-
(0, _act.unsafe_act)(() => {
|
|
42
|
-
renderer.render(wrap(component));
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const rerenderAsync = async component => {
|
|
46
|
-
await (0, _act.act)(() => {
|
|
47
|
-
renderer.render(wrap(component));
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
const unmount = () => {
|
|
51
|
-
(0, _act.unsafe_act)(() => {
|
|
52
|
-
renderer.unmount();
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const unmountAsync = async () => {
|
|
56
|
-
await (0, _act.act)(() => {
|
|
57
|
-
renderer.unmount();
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
const toJSON = () => {
|
|
61
|
-
const json = renderer.container.toJSON();
|
|
62
|
-
if (json?.children?.length === 0) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {
|
|
66
|
-
return json.children[0];
|
|
67
|
-
}
|
|
68
|
-
return json;
|
|
69
|
-
};
|
|
70
|
-
(0, _cleanup.addToCleanupQueue)(unmountAsync);
|
|
71
|
-
const result = {
|
|
72
|
-
...(0, _within.getQueriesForElement)(renderer.container),
|
|
73
|
-
rerender,
|
|
74
|
-
update: rerender,
|
|
75
|
-
// alias for 'rerender'
|
|
76
|
-
unmount,
|
|
77
|
-
toJSON,
|
|
78
|
-
debug: makeDebug(renderer),
|
|
79
|
-
get container() {
|
|
80
|
-
return renderer.container;
|
|
81
|
-
},
|
|
82
|
-
get root() {
|
|
83
|
-
const firstChild = renderer.container.children[0];
|
|
84
|
-
if (typeof firstChild === 'string') {
|
|
85
|
-
throw new Error('Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.');
|
|
86
|
-
}
|
|
87
|
-
return firstChild;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
(0, _screen.setRenderResult)({
|
|
91
|
-
...result,
|
|
92
|
-
rerender: rerenderAsync,
|
|
93
|
-
update: rerenderAsync,
|
|
94
|
-
unmount: unmountAsync
|
|
95
|
-
});
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
function makeDebug(renderer) {
|
|
99
|
-
function debugImpl(options) {
|
|
100
|
-
const {
|
|
101
|
-
defaultDebugOptions
|
|
102
|
-
} = (0, _config.getConfig)();
|
|
103
|
-
const debugOptions = {
|
|
104
|
-
...defaultDebugOptions,
|
|
105
|
-
...options
|
|
106
|
-
};
|
|
107
|
-
const json = renderer.container.toJSON();
|
|
108
|
-
if (json) {
|
|
109
|
-
return (0, _debug.debug)(json, debugOptions);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return debugImpl;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=unsafe-render-sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unsafe-render-sync.js","names":["React","_interopRequireWildcard","require","_universalTestRenderer","_act","_cleanup","_config","_debug","_hostComponentNames","_screen","_within","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","unsafe_renderSync","component","options","renderInternal","wrapper","Wrapper","createNodeMock","rendererOptions","textComponents","HOST_TEXT_NAMES","wrap","element","createElement","renderer","createRoot","unsafe_act","render","rerender","rerenderAsync","act","unmount","unmountAsync","toJSON","json","container","children","length","addToCleanupQueue","result","getQueriesForElement","update","debug","makeDebug","root","firstChild","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions"],"sources":["../src/unsafe-render-sync.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n createRoot,\n type HostElement,\n type JsonElement,\n type Root,\n type RootOptions,\n} from 'universal-test-renderer';\n\nimport { act, unsafe_act } from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport type { DebugOptions } from './helpers/debug';\nimport { debug } from './helpers/debug';\nimport { HOST_TEXT_NAMES } from './helpers/host-component-names';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderSyncOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrapper?: React.ComponentType<any>;\n\n createNodeMock?: (element: React.ReactElement) => object;\n}\n\n/**\n * @deprecated Use `render` (async) instead. This function is provided for migration purposes only.\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport function unsafe_renderSync<T>(\n component: React.ReactElement<T>,\n options: RenderSyncOptions = {},\n) {\n return renderInternal(component, options);\n}\n\nexport type RenderSyncResult = ReturnType<typeof unsafe_renderSync>;\n\nexport function renderInternal<T>(component: React.ReactElement<T>, options?: RenderSyncOptions) {\n const { wrapper: Wrapper, createNodeMock } = options || {};\n\n const rendererOptions: RootOptions = {\n textComponents: HOST_TEXT_NAMES,\n createNodeMock,\n };\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n\n const renderer = createRoot(rendererOptions);\n\n unsafe_act(() => {\n renderer.render(wrap(component));\n });\n\n const rerender = (component: React.ReactElement) => {\n unsafe_act(() => {\n renderer.render(wrap(component));\n });\n };\n\n const rerenderAsync = async (component: React.ReactElement) => {\n await act(() => {\n renderer.render(wrap(component));\n });\n };\n\n const unmount = () => {\n unsafe_act(() => {\n renderer.unmount();\n });\n };\n\n const unmountAsync = async () => {\n await act(() => {\n renderer.unmount();\n });\n };\n\n const toJSON = (): JsonElement | null => {\n const json = renderer.container.toJSON();\n if (json?.children?.length === 0) {\n return null;\n }\n\n if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {\n return json.children[0];\n }\n\n return json;\n };\n\n addToCleanupQueue(unmountAsync);\n\n const result = {\n ...getQueriesForElement(renderer.container),\n rerender,\n update: rerender, // alias for 'rerender'\n unmount,\n toJSON,\n debug: makeDebug(renderer),\n get container(): HostElement {\n return renderer.container;\n },\n get root(): HostElement | null {\n const firstChild = renderer.container.children[0];\n if (typeof firstChild === 'string') {\n throw new Error(\n 'Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.',\n );\n }\n\n return firstChild;\n },\n };\n\n setRenderResult({\n ...result,\n rerender: rerenderAsync,\n update: rerenderAsync,\n unmount: unmountAsync,\n });\n\n return result;\n}\n\nexport type DebugFunction = (options?: DebugOptions) => void;\n\nfunction makeDebug(renderer: Root): DebugFunction {\n function debugImpl(options?: DebugOptions) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions = { ...defaultDebugOptions, ...options };\n const json = renderer.container.toJSON();\n if (json) {\n return debug(json, debugOptions);\n }\n }\n return debugImpl;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAQA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAAgD,SAAAD,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAA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