@testing-library/react-native 14.0.0-alpha.4 → 14.0.0-alpha.6

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 (148) hide show
  1. package/README.md +2 -2
  2. package/build/act.d.ts +1 -4
  3. package/build/act.js +5 -3
  4. package/build/act.js.map +1 -1
  5. package/build/cleanup.d.ts +3 -5
  6. package/build/cleanup.js +2 -8
  7. package/build/cleanup.js.map +1 -1
  8. package/build/fire-event.d.ts +3 -10
  9. package/build/fire-event.js +7 -29
  10. package/build/fire-event.js.map +1 -1
  11. package/build/helpers/accessibility.d.ts +1 -1
  12. package/build/helpers/accessibility.js.map +1 -1
  13. package/build/helpers/component-tree.d.ts +1 -1
  14. package/build/helpers/component-tree.js.map +1 -1
  15. package/build/helpers/debug.d.ts +1 -1
  16. package/build/helpers/debug.js.map +1 -1
  17. package/build/helpers/find-all.d.ts +1 -1
  18. package/build/helpers/find-all.js.map +1 -1
  19. package/build/helpers/format-element.d.ts +1 -1
  20. package/build/helpers/format-element.js.map +1 -1
  21. package/build/helpers/host-component-names.d.ts +2 -1
  22. package/build/helpers/host-component-names.js +2 -1
  23. package/build/helpers/host-component-names.js.map +1 -1
  24. package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
  25. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  26. package/build/helpers/matchers/match-accessibility-value.d.ts +1 -1
  27. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  28. package/build/helpers/matchers/match-label-text.d.ts +1 -1
  29. package/build/helpers/matchers/match-label-text.js.map +1 -1
  30. package/build/helpers/matchers/match-text-content.d.ts +1 -1
  31. package/build/helpers/matchers/match-text-content.js.map +1 -1
  32. package/build/helpers/pointer-events.d.ts +1 -1
  33. package/build/helpers/pointer-events.js.map +1 -1
  34. package/build/helpers/text-content.d.ts +1 -1
  35. package/build/helpers/text-content.js.map +1 -1
  36. package/build/helpers/text-input.d.ts +1 -1
  37. package/build/helpers/text-input.js.map +1 -1
  38. package/build/helpers/timers.d.ts +3 -1
  39. package/build/helpers/timers.js +3 -1
  40. package/build/helpers/timers.js.map +1 -1
  41. package/build/index.js +1 -1
  42. package/build/index.js.map +1 -1
  43. package/build/matchers/to-be-busy.d.ts +1 -1
  44. package/build/matchers/to-be-busy.js.map +1 -1
  45. package/build/matchers/to-be-checked.d.ts +1 -1
  46. package/build/matchers/to-be-checked.js.map +1 -1
  47. package/build/matchers/to-be-disabled.d.ts +1 -1
  48. package/build/matchers/to-be-disabled.js.map +1 -1
  49. package/build/matchers/to-be-empty-element.d.ts +1 -1
  50. package/build/matchers/to-be-empty-element.js.map +1 -1
  51. package/build/matchers/to-be-expanded.d.ts +1 -1
  52. package/build/matchers/to-be-expanded.js.map +1 -1
  53. package/build/matchers/to-be-on-the-screen.d.ts +1 -1
  54. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  55. package/build/matchers/to-be-partially-checked.d.ts +1 -1
  56. package/build/matchers/to-be-partially-checked.js.map +1 -1
  57. package/build/matchers/to-be-selected.d.ts +1 -1
  58. package/build/matchers/to-be-selected.js.map +1 -1
  59. package/build/matchers/to-be-visible.d.ts +1 -1
  60. package/build/matchers/to-be-visible.js.map +1 -1
  61. package/build/matchers/to-contain-element.d.ts +1 -1
  62. package/build/matchers/to-contain-element.js.map +1 -1
  63. package/build/matchers/to-have-accessibility-value.d.ts +1 -1
  64. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  65. package/build/matchers/to-have-accessible-name.d.ts +1 -1
  66. package/build/matchers/to-have-accessible-name.js.map +1 -1
  67. package/build/matchers/to-have-display-value.d.ts +1 -1
  68. package/build/matchers/to-have-display-value.js.map +1 -1
  69. package/build/matchers/to-have-prop.d.ts +1 -1
  70. package/build/matchers/to-have-prop.js.map +1 -1
  71. package/build/matchers/to-have-style.d.ts +1 -1
  72. package/build/matchers/to-have-style.js.map +1 -1
  73. package/build/matchers/to-have-text-content.d.ts +1 -1
  74. package/build/matchers/to-have-text-content.js.map +1 -1
  75. package/build/matchers/types.d.ts +1 -1
  76. package/build/matchers/types.js.map +1 -1
  77. package/build/matchers/utils.d.ts +1 -1
  78. package/build/matchers/utils.js.map +1 -1
  79. package/build/native-state.d.ts +1 -1
  80. package/build/native-state.js.map +1 -1
  81. package/build/pure.d.ts +10 -12
  82. package/build/pure.js +12 -45
  83. package/build/pure.js.map +1 -1
  84. package/build/queries/display-value.d.ts +1 -1
  85. package/build/queries/display-value.js.map +1 -1
  86. package/build/queries/hint-text.d.ts +1 -1
  87. package/build/queries/hint-text.js.map +1 -1
  88. package/build/queries/label-text.d.ts +1 -1
  89. package/build/queries/label-text.js.map +1 -1
  90. package/build/queries/make-queries.d.ts +1 -1
  91. package/build/queries/make-queries.js +3 -4
  92. package/build/queries/make-queries.js.map +1 -1
  93. package/build/queries/placeholder-text.d.ts +1 -1
  94. package/build/queries/placeholder-text.js.map +1 -1
  95. package/build/queries/role.d.ts +1 -1
  96. package/build/queries/role.js.map +1 -1
  97. package/build/queries/test-id.d.ts +1 -1
  98. package/build/queries/test-id.js.map +1 -1
  99. package/build/queries/text.d.ts +1 -1
  100. package/build/queries/text.js.map +1 -1
  101. package/build/render-hook.d.ts +0 -8
  102. package/build/render-hook.js +3 -42
  103. package/build/render-hook.js.map +1 -1
  104. package/build/render.d.ts +7 -77
  105. package/build/render.js +26 -42
  106. package/build/render.js.map +1 -1
  107. package/build/screen.js +1 -5
  108. package/build/screen.js.map +1 -1
  109. package/build/test-utils/json.d.ts +1 -1
  110. package/build/test-utils/json.js.map +1 -1
  111. package/build/tsconfig.release.tsbuildinfo +1 -1
  112. package/build/types.js +4 -0
  113. package/build/user-event/clear.d.ts +1 -1
  114. package/build/user-event/clear.js.map +1 -1
  115. package/build/user-event/index.d.ts +1 -1
  116. package/build/user-event/index.js.map +1 -1
  117. package/build/user-event/paste.d.ts +1 -1
  118. package/build/user-event/paste.js.map +1 -1
  119. package/build/user-event/press/press.d.ts +1 -1
  120. package/build/user-event/press/press.js +2 -3
  121. package/build/user-event/press/press.js.map +1 -1
  122. package/build/user-event/scroll/scroll-to.d.ts +1 -1
  123. package/build/user-event/scroll/scroll-to.js.map +1 -1
  124. package/build/user-event/setup/setup.d.ts +1 -1
  125. package/build/user-event/setup/setup.js.map +1 -1
  126. package/build/user-event/type/type.d.ts +1 -1
  127. package/build/user-event/type/type.js.map +1 -1
  128. package/build/user-event/utils/dispatch-event.d.ts +1 -1
  129. package/build/user-event/utils/dispatch-event.js +2 -5
  130. package/build/user-event/utils/dispatch-event.js.map +1 -1
  131. package/build/user-event/utils/text-range.js +4 -0
  132. package/build/wait-for-element-to-be-removed.d.ts +1 -1
  133. package/build/wait-for-element-to-be-removed.js +3 -4
  134. package/build/wait-for-element-to-be-removed.js.map +1 -1
  135. package/build/wait-for.d.ts +1 -1
  136. package/build/wait-for.js +6 -7
  137. package/build/wait-for.js.map +1 -1
  138. package/build/within.d.ts +1 -1
  139. package/build/within.js.map +1 -1
  140. package/package.json +18 -20
  141. package/build/index.flow.js +0 -378
  142. package/build/render-act.d.ts +0 -3
  143. package/build/render-act.js +0 -29
  144. package/build/render-act.js.map +0 -1
  145. package/build/render-async.d.ts +0 -83
  146. package/build/render-async.js +0 -96
  147. package/build/render-async.js.map +0 -1
  148. package/typings/index.flow.js +0 -378
@@ -1,96 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = renderAsync;
7
- var React = _interopRequireWildcard(require("react"));
8
- var _act = _interopRequireDefault(require("./act"));
9
- var _cleanup = require("./cleanup");
10
- var _config = require("./config");
11
- var _debug = require("./helpers/debug");
12
- var _errors = require("./helpers/errors");
13
- var _renderAct = require("./render-act");
14
- var _screen = require("./screen");
15
- var _within = require("./within");
16
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
- * Renders test component deeply using React Test Renderer and exposes helpers
20
- * to assert on the output.
21
- */
22
- async function renderAsync(component, options = {}) {
23
- const {
24
- wrapper: Wrapper
25
- } = options || {};
26
-
27
- // TODO allow passing some options
28
- const rendererOptions = {};
29
- const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
30
- const renderer = await (0, _renderAct.renderWithAsyncAct)(wrap(component), rendererOptions);
31
- return buildRenderResult(renderer, wrap);
32
- }
33
- function buildRenderResult(renderer, wrap) {
34
- const container = renderer.container;
35
- const rerender = _component => {
36
- throw new _errors.ErrorWithStack('"rerender(...)" is not supported when using "renderAsync" use "await rerenderAsync(...)" instead', rerender);
37
- };
38
- const rerenderAsync = async component => {
39
- // eslint-disable-next-line require-await
40
- await (0, _act.default)(async () => {
41
- renderer.render(wrap(component));
42
- });
43
- };
44
- const unmount = () => {
45
- throw new _errors.ErrorWithStack('"unmount()" is not supported when using "renderAsync" use "await unmountAsync()" instead', unmount);
46
- };
47
- const unmountAsync = async () => {
48
- // eslint-disable-next-line require-await
49
- await (0, _act.default)(async () => {
50
- renderer.unmount();
51
- });
52
- };
53
- (0, _cleanup.addToCleanupQueue)(unmountAsync);
54
- const result = {
55
- ...(0, _within.getQueriesForElement)(renderer.container),
56
- rerender,
57
- rerenderAsync,
58
- update: rerender,
59
- // alias for `rerender`
60
- updateAsync: rerenderAsync,
61
- // alias for `rerenderAsync`
62
- unmount,
63
- unmountAsync,
64
- toJSON: () => renderer.container.toJSON(),
65
- debug: makeDebug(renderer),
66
- get container() {
67
- return renderer.container;
68
- },
69
- get root() {
70
- const firstChild = container.children[0];
71
- if (typeof firstChild === 'string') {
72
- throw new Error('Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.');
73
- }
74
- return firstChild;
75
- }
76
- };
77
- (0, _screen.setRenderResult)(result);
78
- return result;
79
- }
80
- function makeDebug(renderer) {
81
- function debugImpl(options) {
82
- const {
83
- defaultDebugOptions
84
- } = (0, _config.getConfig)();
85
- const debugOptions = {
86
- ...defaultDebugOptions,
87
- ...options
88
- };
89
- const json = renderer.container.toJSON();
90
- if (json) {
91
- return (0, _debug.debug)(json, debugOptions);
92
- }
93
- }
94
- return debugImpl;
95
- }
96
- //# sourceMappingURL=render-async.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-async.js","names":["React","_interopRequireWildcard","require","_act","_interopRequireDefault","_cleanup","_config","_debug","_errors","_renderAct","_screen","_within","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","renderAsync","component","options","wrapper","Wrapper","rendererOptions","wrap","element","createElement","renderer","renderWithAsyncAct","buildRenderResult","container","rerender","_component","ErrorWithStack","rerenderAsync","act","render","unmount","unmountAsync","addToCleanupQueue","result","getQueriesForElement","update","updateAsync","toJSON","debug","makeDebug","root","firstChild","children","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions","json"],"sources":["../src/render-async.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { HostElement, Root, RootOptions } from 'universal-test-renderer';\n\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport type { DebugOptions } from './helpers/debug';\nimport { debug } from './helpers/debug';\nimport { ErrorWithStack } from './helpers/errors';\nimport { renderWithAsyncAct } from './render-act';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderAsyncOptions {\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) => unknown;\n}\n\nexport type RenderAsyncResult = ReturnType<typeof renderAsync>;\n\n/**\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport default async function renderAsync<T>(\n component: React.ReactElement<T>,\n options: RenderAsyncOptions = {},\n) {\n const { wrapper: Wrapper } = options || {};\n\n // TODO allow passing some options\n const rendererOptions: RootOptions = {};\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = await renderWithAsyncAct(wrap(component), rendererOptions);\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: Root,\n wrap: (element: React.ReactElement) => React.JSX.Element,\n) {\n const container = renderer.container;\n\n const rerender = (_component: React.ReactElement) => {\n throw new ErrorWithStack(\n '\"rerender(...)\" is not supported when using \"renderAsync\" use \"await rerenderAsync(...)\" instead',\n rerender,\n );\n };\n const rerenderAsync = async (component: React.ReactElement) => {\n // eslint-disable-next-line require-await\n await act(async () => {\n renderer.render(wrap(component));\n });\n };\n\n const unmount = () => {\n throw new ErrorWithStack(\n '\"unmount()\" is not supported when using \"renderAsync\" use \"await unmountAsync()\" instead',\n unmount,\n );\n };\n const unmountAsync = async () => {\n // eslint-disable-next-line require-await\n await act(async () => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmountAsync);\n\n const result = {\n ...getQueriesForElement(renderer.container),\n rerender,\n rerenderAsync,\n update: rerender, // alias for `rerender`\n updateAsync: rerenderAsync, // alias for `rerenderAsync`\n unmount,\n unmountAsync,\n toJSON: () => renderer.container.toJSON(),\n debug: makeDebug(renderer),\n get container(): HostElement {\n return renderer.container;\n },\n get root(): HostElement | null {\n const firstChild = 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(result);\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;AAGA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAAgD,SAAAE,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YAAAA,CAAAW,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS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,YAAY,GAAG;MAAE,GAAGF,mBAAmB;MAAE,GAAGjC;IAAQ,CAAC;IAC3D,MAAMoC,IAAI,GAAG7B,QAAQ,CAACG,SAAS,CAACc,MAAM,CAAC,CAAC;IACxC,IAAIY,IAAI,EAAE;MACR,OAAO,IAAAX,YAAK,EAACW,IAAI,EAAED,YAAY,CAAC;IAClC;EACF;EACA,OAAOH,SAAS;AAClB","ignoreList":[]}
@@ -1,378 +0,0 @@
1
- // @flow
2
- import * as React from 'react';
3
-
4
- type GetReturn = ReactTestInstance;
5
- type GetAllReturn = Array<ReactTestInstance>;
6
- type QueryReturn = ReactTestInstance | null;
7
- type QueryAllReturn = Array<ReactTestInstance> | [];
8
- type FindReturn = Promise<ReactTestInstance>;
9
- type FindAllReturn = Promise<ReactTestInstance[]>;
10
-
11
- type CommonQueryOptions = {
12
- includeHiddenElements?: boolean,
13
- hidden?: boolean,
14
- };
15
-
16
- type TextMatch = string | RegExp;
17
-
18
- declare type NormalizerFn = (textToNormalize: string) => string;
19
- declare type NormalizerConfig = {
20
- trim?: boolean,
21
- collapseWhitespace?: boolean,
22
- };
23
- declare type TextMatchOptions = {
24
- exact?: boolean,
25
- normalizer?: NormalizerFn,
26
- };
27
- declare type A11yRole =
28
- | 'none'
29
- | 'button'
30
- | 'link'
31
- | 'search'
32
- | 'image'
33
- | 'keyboardkey'
34
- | 'text'
35
- | 'adjustable'
36
- | 'imagebutton'
37
- | 'header'
38
- | 'summary'
39
- | 'alert'
40
- | 'checkbox'
41
- | 'combobox'
42
- | 'menu'
43
- | 'menubar'
44
- | 'menuitem'
45
- | 'progressbar'
46
- | 'radio'
47
- | 'radiogroup'
48
- | 'scrollbar'
49
- | 'spinbutton'
50
- | 'switch'
51
- | 'tab'
52
- | 'tablist'
53
- | 'timer'
54
- | 'toolbar';
55
-
56
- declare type A11yState = {|
57
- disabled?: boolean,
58
- selected?: boolean,
59
- checked?: boolean | 'mixed',
60
- busy?: boolean,
61
- expanded?: boolean,
62
- |};
63
-
64
- declare type A11yValue = {
65
- min?: number,
66
- max?: number,
67
- now?: number,
68
- text?: TextMatch,
69
- };
70
-
71
- type WaitForOptions = {
72
- timeout?: number,
73
- interval?: number,
74
- onTimeout?: (error: Error) => Error,
75
- };
76
-
77
- type WaitForFunction = <T = any>(expectation: () => T, options?: WaitForOptions) => Promise<T>;
78
-
79
- type ByTextOptions = CommonQueryOptions & TextMatchOptions;
80
-
81
- interface ByTextQueries {
82
- getByText: (text: TextMatch, options?: ByTextOptions) => ReactTestInstance;
83
- getAllByText: (text: TextMatch, options?: ByTextOptions) => Array<ReactTestInstance>;
84
- queryByText: (name: TextMatch, options?: ByTextOptions) => ReactTestInstance | null;
85
- queryAllByText: (text: TextMatch, options?: ByTextOptions) => Array<ReactTestInstance> | [];
86
- findByText: (
87
- text: TextMatch,
88
- queryOptions?: ByTextOptions,
89
- waitForOptions?: WaitForOptions,
90
- ) => FindReturn;
91
- findAllByText: (
92
- text: TextMatch,
93
- queryOptions?: ByTextOptions,
94
- waitForOptions?: WaitForOptions,
95
- ) => FindAllReturn;
96
- }
97
-
98
- type ByTestIdOptions = CommonQueryOptions & TextMatchOptions;
99
-
100
- interface ByTestIdQueries {
101
- getByTestId: (testID: TextMatch, options?: ByTestIdOptions) => ReactTestInstance;
102
- getAllByTestId: (testID: TextMatch, options?: ByTestIdOptions) => Array<ReactTestInstance>;
103
- queryByTestId: (testID: TextMatch, options?: ByTestIdOptions) => ReactTestInstance | null;
104
- queryAllByTestId: (testID: TextMatch, options?: ByTestIdOptions) => Array<ReactTestInstance> | [];
105
- findByTestId: (
106
- testID: TextMatch,
107
- queryOptions?: ByTestIdOptions,
108
- waitForOptions?: WaitForOptions,
109
- ) => FindReturn;
110
- findAllByTestId: (
111
- testID: TextMatch,
112
- queryOptions?: ByTestIdOptions,
113
- waitForOptions?: WaitForOptions,
114
- ) => FindAllReturn;
115
- }
116
-
117
- type ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;
118
-
119
- interface ByDisplayValueQueries {
120
- getByDisplayValue: (value: TextMatch, options?: ByDisplayValueOptions) => ReactTestInstance;
121
- getAllByDisplayValue: (
122
- value: TextMatch,
123
- options?: ByDisplayValueOptions,
124
- ) => Array<ReactTestInstance>;
125
- queryByDisplayValue: (
126
- value: TextMatch,
127
- options?: ByDisplayValueOptions,
128
- ) => ReactTestInstance | null;
129
- queryAllByDisplayValue: (
130
- value: TextMatch,
131
- options?: ByDisplayValueOptions,
132
- ) => Array<ReactTestInstance> | [];
133
- findByDisplayValue: (
134
- value: TextMatch,
135
- queryOptions?: ByDisplayValueOptions,
136
- waitForOptions?: WaitForOptions,
137
- ) => FindReturn;
138
- findAllByDisplayValue: (
139
- value: TextMatch,
140
- queryOptions?: ByDisplayValueOptions,
141
- waitForOptions?: WaitForOptions,
142
- ) => FindAllReturn;
143
- }
144
-
145
- type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;
146
-
147
- interface ByPlaceholderTextQueries {
148
- getByPlaceholderText: (
149
- placeholder: TextMatch,
150
- options?: ByPlaceholderTextOptions,
151
- ) => ReactTestInstance;
152
- getAllByPlaceholderText: (
153
- placeholder: TextMatch,
154
- options?: ByPlaceholderTextOptions,
155
- ) => Array<ReactTestInstance>;
156
- queryByPlaceholderText: (
157
- placeholder: TextMatch,
158
- options?: ByPlaceholderTextOptions,
159
- ) => ReactTestInstance | null;
160
- queryAllByPlaceholderText: (
161
- placeholder: TextMatch,
162
- options?: ByPlaceholderTextOptions,
163
- ) => Array<ReactTestInstance> | [];
164
- findByPlaceholderText: (
165
- placeholder: TextMatch,
166
- queryOptions?: ByPlaceholderTextOptions,
167
- waitForOptions?: WaitForOptions,
168
- ) => FindReturn;
169
- findAllByPlaceholderText: (
170
- placeholder: TextMatch,
171
- queryOptions?: ByPlaceholderTextOptions,
172
- waitForOptions?: WaitForOptions,
173
- ) => FindAllReturn;
174
- }
175
-
176
- interface UnsafeByTypeQueries {
177
- UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;
178
- UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
179
- UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
180
- UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance> | [];
181
- }
182
-
183
- interface UnsafeByPropsQueries {
184
- UNSAFE_getByProps: (props: { [string]: any }) => ReactTestInstance;
185
- UNSAFE_getAllByProps: (props: { [string]: any }) => Array<ReactTestInstance>;
186
- UNSAFE_queryByProps: (props: { [string]: any }) => ReactTestInstance | null;
187
- UNSAFE_queryAllByProps: (props: { [string]: any }) => Array<ReactTestInstance> | [];
188
- }
189
-
190
- type ByRoleOptions = CommonQueryOptions & {
191
- ...A11yState,
192
- name?: string,
193
- value?: A11yValue,
194
- };
195
-
196
- type ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;
197
- type ByHintTextOptions = CommonQueryOptions & TextMatchOptions;
198
-
199
- interface A11yAPI {
200
- // Label
201
- getByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => GetReturn;
202
- getAllByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => GetAllReturn;
203
- queryByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => QueryReturn;
204
- queryAllByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => QueryAllReturn;
205
- findByLabelText: (
206
- matcher: TextMatch,
207
- queryOptions?: ByLabelTextOptions,
208
- waitForOptions?: WaitForOptions,
209
- ) => FindReturn;
210
- findAllByLabelText: (
211
- matcher: TextMatch,
212
- queryOptions?: ByLabelTextOptions,
213
- waitForOptions?: WaitForOptions,
214
- ) => FindAllReturn;
215
-
216
- // Hint
217
- getByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => GetReturn;
218
- getByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => GetReturn;
219
- getAllByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => GetAllReturn;
220
- getAllByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => GetAllReturn;
221
- queryByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => QueryReturn;
222
- queryByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => QueryReturn;
223
- queryAllByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => QueryAllReturn;
224
- queryAllByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => QueryAllReturn;
225
- findByA11yHint: (
226
- matcher: TextMatch,
227
- queryOptions?: ByHintTextOptions,
228
- waitForOptions?: WaitForOptions,
229
- ) => FindReturn;
230
- findByHintText: (
231
- matcher: TextMatch,
232
- queryOptions?: ByHintTextOptions,
233
- waitForOptions?: WaitForOptions,
234
- ) => FindReturn;
235
- findAllByA11yHint: (
236
- matcher: TextMatch,
237
- queryOptions?: ByHintTextOptions,
238
- waitForOptions?: WaitForOptions,
239
- ) => FindAllReturn;
240
- findAllByHintText: (
241
- matcher: TextMatch,
242
- queryOptions?: ByHintTextOptions,
243
- waitForOptions?: WaitForOptions,
244
- ) => FindAllReturn;
245
-
246
- // Role
247
- getByRole: (matcher: A11yRole | RegExp, role?: ByRoleOptions) => GetReturn;
248
- getAllByRole: (matcher: A11yRole | RegExp, options?: ByRoleOptions) => GetAllReturn;
249
- queryByRole: (matcher: A11yRole | RegExp, options?: ByRoleOptions) => QueryReturn;
250
- queryAllByRole: (matcher: A11yRole | RegExp, options?: ByRoleOptions) => QueryAllReturn;
251
- findByRole: (
252
- matcher: A11yRole | RegExp,
253
- queryOptions?: ByRoleOptions,
254
- waitForOptions?: WaitForOptions,
255
- ) => FindReturn;
256
- findAllByRole: (
257
- matcher: A11yRole | RegExp,
258
- queryOptions?: ByRoleOptions,
259
- waitForOptions?: WaitForOptions,
260
- ) => FindAllReturn;
261
- }
262
-
263
- interface Thenable {
264
- then: (resolve: () => any, reject?: () => any) => any;
265
- }
266
-
267
- type MapPropsFunction = (
268
- props: { [string]: mixed },
269
- node: ReactTestRendererJSON,
270
- ) => { [string]: mixed };
271
-
272
- type DebugOptions = {
273
- message?: string,
274
- mapProps?: MapPropsFunction,
275
- };
276
-
277
- type Queries = ByTextQueries &
278
- ByTestIdQueries &
279
- ByDisplayValueQueries &
280
- ByPlaceholderTextQueries &
281
- UnsafeByTypeQueries &
282
- UnsafeByPropsQueries &
283
- A11yAPI;
284
-
285
- type FireEventFunction = (
286
- element: ReactTestInstance,
287
- eventName: string,
288
- ...data: Array<any>
289
- ) => any;
290
-
291
- type FireEventAPI = FireEventFunction & {
292
- press: (element: ReactTestInstance, ...data: Array<any>) => any,
293
- changeText: (element: ReactTestInstance, ...data: Array<any>) => any,
294
- scroll: (element: ReactTestInstance, ...data: Array<any>) => any,
295
- };
296
-
297
- declare module '@testing-library/react-native' {
298
- declare interface RenderResult extends Queries {
299
- update(nextElement: React.Element<any>): void;
300
- rerender(nextElement: React.Element<any>): void;
301
- unmount(nextElement?: React.Element<any>): void;
302
- toJSON(): ReactTestRendererJSON[] | ReactTestRendererJSON | null;
303
- debug(options?: DebugOptions): void;
304
- root: ReactTestInstance;
305
- UNSAFE_root: ReactTestInstance;
306
- }
307
-
308
- declare type RenderAPI = RenderResult;
309
-
310
- declare interface RenderOptions {
311
- wrapper?: React.ComponentType<any>;
312
- createNodeMock?: (element: React.Element<any>) => any;
313
- unstable_validateStringsRenderedWithinText?: boolean;
314
- unstable_isConcurrent?: boolean;
315
- unstable_strictMode?: boolean;
316
- unstable_concurrentUpdatesByDefault?: boolean;
317
- }
318
-
319
- declare export var render: (
320
- component: React.Element<any>,
321
- options?: RenderOptions,
322
- ) => RenderResult;
323
-
324
- declare export var screen: RenderResult;
325
-
326
- declare export var cleanup: () => void;
327
- declare export var fireEvent: FireEventAPI;
328
-
329
- declare export var waitFor: WaitForFunction;
330
-
331
- declare type WaitForElementToBeRemovedFunction = <T = any>(
332
- expectation: () => T,
333
- options?: WaitForOptions,
334
- ) => Promise<T>;
335
-
336
- declare export var waitForElementToBeRemoved: WaitForElementToBeRemovedFunction;
337
-
338
- declare interface Config {
339
- asyncUtilTimeout: number;
340
- defaultIncludeHiddenElements: boolean;
341
- defaultDebugOptions?: $Shape<DebugOptions>;
342
- }
343
-
344
- declare interface ConfigAliasOptions {
345
- /** Alias to `defaultIncludeHiddenElements` for RTL compatibility */
346
- defaultHidden: boolean;
347
- }
348
-
349
- declare export var configure: (options: $Shape<Config & ConfigAliasOptions>) => void;
350
- declare export var resetToDefaults: () => void;
351
-
352
- declare export var act: (callback: () => void) => Thenable;
353
- declare export var within: (instance: ReactTestInstance) => Queries;
354
- declare export var getQueriesForElement: (element: ReactTestInstance) => Queries;
355
-
356
- declare export var getDefaultNormalizer: (normalizerConfig?: NormalizerConfig) => NormalizerFn;
357
-
358
- declare export var isHiddenFromAccessibility: (element: ReactTestInstance | null) => boolean;
359
- declare export var isInaccessible: (element: ReactTestInstance | null) => boolean;
360
-
361
- declare type RenderHookResult<Result, Props> = {
362
- rerender: (props: Props) => void,
363
- result: { current: Result },
364
- unmount: () => void,
365
- };
366
-
367
- declare type RenderHookOptions<Props> = {
368
- initialProps?: Props,
369
- wrapper?: React.ComponentType<any>,
370
- };
371
-
372
- declare type RenderHookFunction = <Result, Props>(
373
- renderCallback: (props: Props) => Result,
374
- options?: RenderHookOptions<Props>,
375
- ) => RenderHookResult<Result, Props>;
376
-
377
- declare export var renderHook: RenderHookFunction;
378
- }