@testing-library/react-native 14.0.0-alpha.4 → 14.0.0-alpha.5
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/build/act.d.ts +2 -2
- package/build/act.js +6 -3
- package/build/act.js.map +1 -1
- package/build/cleanup.d.ts +3 -5
- package/build/cleanup.js +2 -8
- package/build/cleanup.js.map +1 -1
- package/build/fire-event.d.ts +9 -9
- package/build/fire-event.js +21 -16
- package/build/fire-event.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +1 -0
- package/build/helpers/host-component-names.js +2 -1
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/timers.d.ts +3 -1
- package/build/helpers/timers.js +3 -1
- package/build/helpers/timers.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/pure.d.ts +10 -10
- package/build/pure.js +37 -39
- package/build/pure.js.map +1 -1
- package/build/queries/make-queries.js +3 -4
- package/build/queries/make-queries.js.map +1 -1
- package/build/render-hook.d.ts +1 -1
- package/build/render-hook.js +11 -12
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +8 -77
- package/build/render.js +23 -40
- package/build/render.js.map +1 -1
- package/build/screen.js +1 -4
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/types.js +4 -0
- package/build/unsafe-render-sync.d.ts +144 -0
- package/build/{render-async.js → unsafe-render-sync.js} +49 -31
- package/build/unsafe-render-sync.js.map +1 -0
- package/build/user-event/press/press.js +2 -3
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/utils/dispatch-event.js +2 -5
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/user-event/utils/text-range.js +4 -0
- package/build/wait-for-element-to-be-removed.d.ts +1 -1
- package/build/wait-for-element-to-be-removed.js +3 -4
- package/build/wait-for-element-to-be-removed.js.map +1 -1
- package/build/wait-for.d.ts +1 -1
- package/build/wait-for.js +6 -7
- package/build/wait-for.js.map +1 -1
- package/package.json +9 -12
- package/build/index.flow.js +0 -378
- package/build/render-act.d.ts +0 -3
- package/build/render-act.js +0 -29
- package/build/render-act.js.map +0 -1
- package/build/render-async.d.ts +0 -83
- package/build/render-async.js.map +0 -1
- package/typings/index.flow.js +0 -378
|
@@ -8,8 +8,7 @@ var _errors = require("../helpers/errors");
|
|
|
8
8
|
var _formatElement = require("../helpers/format-element");
|
|
9
9
|
var _logger = require("../helpers/logger");
|
|
10
10
|
var _screen = require("../screen");
|
|
11
|
-
var _waitFor =
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var _waitFor = require("../wait-for");
|
|
13
12
|
const deprecatedKeys = ['timeout', 'interval', 'stackTraceError'];
|
|
14
13
|
|
|
15
14
|
// The WaitForOptions has been moved to the second option param of findBy* methods with the adding of TextMatchOptions
|
|
@@ -104,7 +103,7 @@ function makeQueries(queryAllByQuery, getMissingError, getMultipleError) {
|
|
|
104
103
|
} = {}) {
|
|
105
104
|
const stackTraceError = new _errors.ErrorWithStack('STACK_TRACE_ERROR', findAllFn);
|
|
106
105
|
const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);
|
|
107
|
-
return (0, _waitFor.
|
|
106
|
+
return (0, _waitFor.waitFor)(() => getAllByQuery(element, {
|
|
108
107
|
printElementTree: false
|
|
109
108
|
})(predicate, queryOptions), {
|
|
110
109
|
...deprecatedWaitForOptions,
|
|
@@ -121,7 +120,7 @@ function makeQueries(queryAllByQuery, getMissingError, getMultipleError) {
|
|
|
121
120
|
} = {}) {
|
|
122
121
|
const stackTraceError = new _errors.ErrorWithStack('STACK_TRACE_ERROR', findFn);
|
|
123
122
|
const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);
|
|
124
|
-
return (0, _waitFor.
|
|
123
|
+
return (0, _waitFor.waitFor)(() => getByQuery(element, {
|
|
125
124
|
printElementTree: false
|
|
126
125
|
})(predicate, queryOptions), {
|
|
127
126
|
...deprecatedWaitForOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-queries.js","names":["_errors","require","_formatElement","_logger","_screen","_waitFor","_interopRequireDefault","e","__esModule","default","deprecatedKeys","extractDeprecatedWaitForOptions","options","undefined","waitForOptions","timeout","interval","stackTraceError","forEach","key","option","logger","warn","toString","formatErrorMessage","message","printElementTree","screen","isDetached","json","toJSON","formatJson","appendElementTreeToError","error","oldMessage","stack","replace","makeQueries","queryAllByQuery","getMissingError","getMultipleError","getAllByQuery","element","getAllFn","predicate","results","length","errorMessage","ErrorWithStack","queryByQuery","singleQueryFn","getByQuery","getFn","findAllByQuery","findAllFn","queryOptions","onTimeout","deprecatedWaitForOptions","waitFor","findByQuery","findFn","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy"],"sources":["../../src/queries/make-queries.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { ErrorWithStack } from '../helpers/errors';\nimport { formatJson } from '../helpers/format-element';\nimport { logger } from '../helpers/logger';\nimport { screen } from '../screen';\nimport type { WaitForOptions } from '../wait-for';\nimport waitFor from '../wait-for';\n\nexport type GetByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement;\n\nexport type GetAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement[];\n\nexport type QueryByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement | null;\n\nexport type QueryAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement[];\n\nexport type FindByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions,\n) => Promise<HostElement>;\n\nexport type FindAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions,\n) => Promise<HostElement[]>;\n\ntype UnboundQuery<Query> = (element: HostElement) => Query;\n\nexport type UnboundQueries<Predicate, Options> = {\n getBy: UnboundQuery<GetByQuery<Predicate, Options>>;\n getAllBy: UnboundQuery<GetAllByQuery<Predicate, Options>>;\n queryBy: UnboundQuery<QueryByQuery<Predicate, Options>>;\n queryAllBy: UnboundQuery<QueryAllByQuery<Predicate, Options>>;\n findBy: UnboundQuery<FindByQuery<Predicate, Options>>;\n findAllBy: UnboundQuery<FindAllByQuery<Predicate, Options>>;\n};\n\nconst deprecatedKeys: (keyof WaitForOptions)[] = ['timeout', 'interval', 'stackTraceError'];\n\n// The WaitForOptions has been moved to the second option param of findBy* methods with the adding of TextMatchOptions\n// To make the migration easier and avoid a breaking change, keep reading this options from the first param but warn\nfunction extractDeprecatedWaitForOptions(options?: WaitForOptions) {\n if (!options) {\n return undefined;\n }\n\n const waitForOptions: WaitForOptions = {\n timeout: options.timeout,\n interval: options.interval,\n stackTraceError: options.stackTraceError,\n };\n\n deprecatedKeys.forEach((key) => {\n const option = options[key];\n if (option) {\n logger.warn(\n `Use of option \"${key}\" in a findBy* query options (2nd parameter) is deprecated. Please pass this option in the waitForOptions (3rd parameter).\nExample:\n\n findByText(text, {}, { ${key}: ${option.toString()} })`,\n );\n }\n });\n\n return waitForOptions;\n}\n\nfunction formatErrorMessage(message: string, printElementTree: boolean) {\n if (!printElementTree) {\n return message;\n }\n\n if (screen.isDetached) {\n return `${message}\\n\\nScreen is no longer attached. Check your test for \"findBy*\" or \"waitFor\" calls that have not been awaited.\\n\\nWe recommend enabling \"eslint-plugin-testing-library\" to catch these issues at build time:\\nhttps://callstack.github.io/react-native-testing-library/docs/start/quick-start#eslint-plugin`;\n }\n\n const json = screen.toJSON();\n if (!json) {\n return message;\n }\n\n return `${message}\\n\\n${formatJson(json)}`;\n}\n\nfunction appendElementTreeToError(error: Error) {\n const oldMessage = error.message;\n error.message = formatErrorMessage(oldMessage, true);\n\n // Required to make Jest print the element tree on error\n error.stack = error.stack?.replace(oldMessage, error.message);\n\n return error;\n}\n\nexport function makeQueries<Predicate, Options>(\n queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>,\n getMissingError: (predicate: Predicate, options?: Options) => string,\n getMultipleError: (predicate: Predicate, options?: Options) => string,\n): UnboundQueries<Predicate, Options> {\n function getAllByQuery(element: HostElement, { printElementTree = true } = {}) {\n return function getAllFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(element)(predicate, options);\n\n if (results.length === 0) {\n const errorMessage = formatErrorMessage(\n getMissingError(predicate, options),\n printElementTree,\n );\n throw new ErrorWithStack(errorMessage, getAllFn);\n }\n\n return results;\n };\n }\n\n function queryByQuery(element: HostElement, { printElementTree = true } = {}) {\n return function singleQueryFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(element)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(\n formatErrorMessage(getMultipleError(predicate, options), printElementTree),\n singleQueryFn,\n );\n }\n\n if (results.length === 0) {\n return null;\n }\n\n return results[0];\n };\n }\n\n function getByQuery(element: HostElement, { printElementTree = true } = {}) {\n return function getFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(element)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(getMultipleError(predicate, options), getFn);\n }\n\n if (results.length === 0) {\n const errorMessage = formatErrorMessage(\n getMissingError(predicate, options),\n printElementTree,\n );\n throw new ErrorWithStack(errorMessage, getFn);\n }\n\n return results[0];\n };\n }\n\n function findAllByQuery(element: HostElement) {\n return function findAllFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n {\n onTimeout = (error) => appendElementTreeToError(error),\n ...waitForOptions\n }: WaitForOptions = {},\n ) {\n const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findAllFn);\n const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);\n\n return waitFor(\n () => getAllByQuery(element, { printElementTree: false })(predicate, queryOptions),\n {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n stackTraceError,\n onTimeout,\n },\n );\n };\n }\n\n function findByQuery(element: HostElement) {\n return function findFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n {\n onTimeout = (error) => appendElementTreeToError(error),\n ...waitForOptions\n }: WaitForOptions = {},\n ) {\n const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findFn);\n const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);\n\n return waitFor(\n () => getByQuery(element, { printElementTree: false })(predicate, queryOptions),\n {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n stackTraceError,\n onTimeout,\n },\n );\n };\n }\n\n return {\n getBy: getByQuery,\n getAllBy: getAllByQuery,\n queryBy: queryByQuery,\n queryAllBy: queryAllByQuery,\n findBy: findByQuery,\n findAllBy: findAllByQuery,\n };\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAkC,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA+ClC,MAAMG,cAAwC,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC;;AAE3F;AACA;AACA,SAASC,+BAA+BA,CAACC,OAAwB,EAAE;EACjE,IAAI,CAACA,OAAO,EAAE;IACZ,OAAOC,SAAS;EAClB;EAEA,MAAMC,cAA8B,GAAG;IACrCC,OAAO,EAAEH,OAAO,CAACG,OAAO;IACxBC,QAAQ,EAAEJ,OAAO,CAACI,QAAQ;IAC1BC,eAAe,EAAEL,OAAO,CAACK;EAC3B,CAAC;EAEDP,cAAc,CAACQ,OAAO,CAAEC,GAAG,IAAK;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UAAU,CAACT,OAAO,EAAE;QAAEhB,gBAAgB,EAAE;MAAM,CAAC,CAAC,CAACkB,SAAS,EAAEW,YAAY,CAAC,EAC/E;QACE,GAAGE,wBAAwB;QAC3B,GAAG3C,cAAc;QACjBG,eAAe;QACfuC;MACF,CACF,CAAC;IACH,CAAC;EACH;EAEA,OAAO;IACLK,KAAK,EAAEV,UAAU;IACjBW,QAAQ,EAAErB,aAAa;IACvBsB,OAAO,EAAEd,YAAY;IACrBe,UAAU,EAAE1B,eAAe;IAC3B2B,MAAM,EAAEN,WAAW;IACnBO,SAAS,EAAEb;EACb,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"make-queries.js","names":["_errors","require","_formatElement","_logger","_screen","_waitFor","deprecatedKeys","extractDeprecatedWaitForOptions","options","undefined","waitForOptions","timeout","interval","stackTraceError","forEach","key","option","logger","warn","toString","formatErrorMessage","message","printElementTree","screen","isDetached","json","toJSON","formatJson","appendElementTreeToError","error","oldMessage","stack","replace","makeQueries","queryAllByQuery","getMissingError","getMultipleError","getAllByQuery","element","getAllFn","predicate","results","length","errorMessage","ErrorWithStack","queryByQuery","singleQueryFn","getByQuery","getFn","findAllByQuery","findAllFn","queryOptions","onTimeout","deprecatedWaitForOptions","waitFor","findByQuery","findFn","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy"],"sources":["../../src/queries/make-queries.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { ErrorWithStack } from '../helpers/errors';\nimport { formatJson } from '../helpers/format-element';\nimport { logger } from '../helpers/logger';\nimport { screen } from '../screen';\nimport type { WaitForOptions } from '../wait-for';\nimport { waitFor } from '../wait-for';\n\nexport type GetByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement;\n\nexport type GetAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement[];\n\nexport type QueryByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement | null;\n\nexport type QueryAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n) => HostElement[];\n\nexport type FindByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions,\n) => Promise<HostElement>;\n\nexport type FindAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions,\n) => Promise<HostElement[]>;\n\ntype UnboundQuery<Query> = (element: HostElement) => Query;\n\nexport type UnboundQueries<Predicate, Options> = {\n getBy: UnboundQuery<GetByQuery<Predicate, Options>>;\n getAllBy: UnboundQuery<GetAllByQuery<Predicate, Options>>;\n queryBy: UnboundQuery<QueryByQuery<Predicate, Options>>;\n queryAllBy: UnboundQuery<QueryAllByQuery<Predicate, Options>>;\n findBy: UnboundQuery<FindByQuery<Predicate, Options>>;\n findAllBy: UnboundQuery<FindAllByQuery<Predicate, Options>>;\n};\n\nconst deprecatedKeys: (keyof WaitForOptions)[] = ['timeout', 'interval', 'stackTraceError'];\n\n// The WaitForOptions has been moved to the second option param of findBy* methods with the adding of TextMatchOptions\n// To make the migration easier and avoid a breaking change, keep reading this options from the first param but warn\nfunction extractDeprecatedWaitForOptions(options?: WaitForOptions) {\n if (!options) {\n return undefined;\n }\n\n const waitForOptions: WaitForOptions = {\n timeout: options.timeout,\n interval: options.interval,\n stackTraceError: options.stackTraceError,\n };\n\n deprecatedKeys.forEach((key) => {\n const option = options[key];\n if (option) {\n logger.warn(\n `Use of option \"${key}\" in a findBy* query options (2nd parameter) is deprecated. Please pass this option in the waitForOptions (3rd parameter).\nExample:\n\n findByText(text, {}, { ${key}: ${option.toString()} })`,\n );\n }\n });\n\n return waitForOptions;\n}\n\nfunction formatErrorMessage(message: string, printElementTree: boolean) {\n if (!printElementTree) {\n return message;\n }\n\n if (screen.isDetached) {\n return `${message}\\n\\nScreen is no longer attached. Check your test for \"findBy*\" or \"waitFor\" calls that have not been awaited.\\n\\nWe recommend enabling \"eslint-plugin-testing-library\" to catch these issues at build time:\\nhttps://callstack.github.io/react-native-testing-library/docs/start/quick-start#eslint-plugin`;\n }\n\n const json = screen.toJSON();\n if (!json) {\n return message;\n }\n\n return `${message}\\n\\n${formatJson(json)}`;\n}\n\nfunction appendElementTreeToError(error: Error) {\n const oldMessage = error.message;\n error.message = formatErrorMessage(oldMessage, true);\n\n // Required to make Jest print the element tree on error\n error.stack = error.stack?.replace(oldMessage, error.message);\n\n return error;\n}\n\nexport function makeQueries<Predicate, Options>(\n queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>,\n getMissingError: (predicate: Predicate, options?: Options) => string,\n getMultipleError: (predicate: Predicate, options?: Options) => string,\n): UnboundQueries<Predicate, Options> {\n function getAllByQuery(element: HostElement, { printElementTree = true } = {}) {\n return function getAllFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(element)(predicate, options);\n\n if (results.length === 0) {\n const errorMessage = formatErrorMessage(\n getMissingError(predicate, options),\n printElementTree,\n );\n throw new ErrorWithStack(errorMessage, getAllFn);\n }\n\n return results;\n };\n }\n\n function queryByQuery(element: HostElement, { printElementTree = true } = {}) {\n return function singleQueryFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(element)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(\n formatErrorMessage(getMultipleError(predicate, options), printElementTree),\n singleQueryFn,\n );\n }\n\n if (results.length === 0) {\n return null;\n }\n\n return results[0];\n };\n }\n\n function getByQuery(element: HostElement, { printElementTree = true } = {}) {\n return function getFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(element)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(getMultipleError(predicate, options), getFn);\n }\n\n if (results.length === 0) {\n const errorMessage = formatErrorMessage(\n getMissingError(predicate, options),\n printElementTree,\n );\n throw new ErrorWithStack(errorMessage, getFn);\n }\n\n return results[0];\n };\n }\n\n function findAllByQuery(element: HostElement) {\n return function findAllFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n {\n onTimeout = (error) => appendElementTreeToError(error),\n ...waitForOptions\n }: WaitForOptions = {},\n ) {\n const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findAllFn);\n const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);\n\n return waitFor(\n () => getAllByQuery(element, { printElementTree: false })(predicate, queryOptions),\n {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n stackTraceError,\n onTimeout,\n },\n );\n };\n }\n\n function findByQuery(element: HostElement) {\n return function findFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n {\n onTimeout = (error) => appendElementTreeToError(error),\n ...waitForOptions\n }: WaitForOptions = {},\n ) {\n const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findFn);\n const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);\n\n return waitFor(\n () => getByQuery(element, { printElementTree: false })(predicate, queryOptions),\n {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n stackTraceError,\n onTimeout,\n },\n );\n };\n }\n\n return {\n getBy: getByQuery,\n getAllBy: getAllByQuery,\n queryBy: queryByQuery,\n queryAllBy: queryAllByQuery,\n findBy: findByQuery,\n findAllBy: findAllByQuery,\n };\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AA+CA,MAAMK,cAAwC,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC;;AAE3F;AACA;AACA,SAASC,+BAA+BA,CAACC,OAAwB,EAAE;EACjE,IAAI,CAACA,OAAO,EAAE;IACZ,OAAOC,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nB;IACW,CAAC,GAAG,CAAC,CAAC,EACtB;MACA,MAAMG,eAAe,GAAG,IAAI+B,sBAAc,CAAC,mBAAmB,EAAEY,MAAM,CAAC;MACvE,MAAMH,wBAAwB,GAAG9C,+BAA+B,CAAC4C,YAAY,CAAC;MAE9E,OAAO,IAAAG,gBAAO,EACZ,MAAMP,UAAU,CAACT,OAAO,EAAE;QAAEhB,gBAAgB,EAAE;MAAM,CAAC,CAAC,CAACkB,SAAS,EAAEW,YAAY,CAAC,EAC/E;QACE,GAAGE,wBAAwB;QAC3B,GAAG3C,cAAc;QACjBG,eAAe;QACfuC;MACF,CACF,CAAC;IACH,CAAC;EACH;EAEA,OAAO;IACLK,KAAK,EAAEV,UAAU;IACjBW,QAAQ,EAAErB,aAAa;IACvBsB,OAAO,EAAEd,YAAY;IACrBe,UAAU,EAAE1B,eAAe;IAC3B2B,MAAM,EAAEN,WAAW;IACnBO,SAAS,EAAEb;EACb,CAAC;AACH","ignoreList":[]}
|
package/build/render-hook.d.ts
CHANGED
|
@@ -24,4 +24,4 @@ export type RenderHookOptions<Props> = {
|
|
|
24
24
|
};
|
|
25
25
|
export declare function renderHook<Result, Props>(hookToRender: (props: Props) => Result, options?: RenderHookOptions<NoInfer<Props>>): Promise<RenderHookResult<Result, Props>>;
|
|
26
26
|
/** @deprecated - Use async `renderHook` instead. */
|
|
27
|
-
export declare function
|
|
27
|
+
export declare function unsafe_renderHookSync<Result, Props>(hookToRender: (props: Props) => Result, options?: RenderHookOptions<NoInfer<Props>>): RenderHookSyncResult<Result, Props>;
|
package/build/render-hook.js
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.deprecated_renderHookSync = deprecated_renderHookSync;
|
|
7
6
|
exports.renderHook = renderHook;
|
|
7
|
+
exports.unsafe_renderHookSync = unsafe_renderHookSync;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _render =
|
|
10
|
-
var
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _render = require("./render");
|
|
10
|
+
var _unsafeRenderSync = require("./unsafe-render-sync");
|
|
12
11
|
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); }
|
|
13
12
|
/** @deprecated - Use `renderHook` and `RenderHookResult` instead. */
|
|
14
13
|
|
|
@@ -28,25 +27,25 @@ async function renderHook(hookToRender, options) {
|
|
|
28
27
|
...renderOptions
|
|
29
28
|
} = options ?? {};
|
|
30
29
|
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} = await (0,
|
|
30
|
+
rerender: rerenderComponent,
|
|
31
|
+
unmount
|
|
32
|
+
} = await (0, _render.render)(
|
|
34
33
|
/*#__PURE__*/
|
|
35
|
-
// @ts-expect-error since option can be undefined, initialProps can be undefined when it
|
|
34
|
+
// @ts-expect-error since option can be undefined, initialProps can be undefined when it shouldn't be
|
|
36
35
|
React.createElement(HookContainer, {
|
|
37
36
|
hookProps: initialProps
|
|
38
37
|
}), renderOptions);
|
|
39
38
|
return {
|
|
40
39
|
result: result,
|
|
41
|
-
rerender: hookProps =>
|
|
40
|
+
rerender: hookProps => rerenderComponent(/*#__PURE__*/React.createElement(HookContainer, {
|
|
42
41
|
hookProps: hookProps
|
|
43
42
|
})),
|
|
44
|
-
unmount
|
|
43
|
+
unmount
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
/** @deprecated - Use async `renderHook` instead. */
|
|
49
|
-
function
|
|
48
|
+
function unsafe_renderHookSync(hookToRender, options) {
|
|
50
49
|
const result = /*#__PURE__*/React.createRef();
|
|
51
50
|
function HookContainer({
|
|
52
51
|
hookProps
|
|
@@ -64,7 +63,7 @@ function deprecated_renderHookSync(hookToRender, options) {
|
|
|
64
63
|
const {
|
|
65
64
|
rerender: rerenderComponent,
|
|
66
65
|
unmount
|
|
67
|
-
} = (0,
|
|
66
|
+
} = (0, _unsafeRenderSync.unsafe_renderSync)(
|
|
68
67
|
/*#__PURE__*/
|
|
69
68
|
// @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt
|
|
70
69
|
React.createElement(HookContainer, {
|
package/build/render-hook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-hook.js","names":["React","_interopRequireWildcard","require","_render","
|
|
1
|
+
{"version":3,"file":"render-hook.js","names":["React","_interopRequireWildcard","require","_render","_unsafeRenderSync","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","renderHook","hookToRender","options","result","createRef","HookContainer","hookProps","renderResult","useEffect","current","initialProps","renderOptions","rerender","rerenderComponent","unmount","render","createElement","unsafe_renderHookSync","unsafe_renderSync"],"sources":["../src/render-hook.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { render } from './render';\nimport type { RefObject } from './types';\nimport { unsafe_renderSync } from './unsafe-render-sync';\n\nexport type RenderHookResult<Result, Props> = {\n result: RefObject<Result>;\n rerender: (props: Props) => Promise<void>;\n unmount: () => Promise<void>;\n};\n\n/** @deprecated - Use `renderHook` and `RenderHookResult` instead. */\nexport type RenderHookSyncResult<Result, Props> = {\n result: RefObject<Result>;\n rerender: (props: Props) => void;\n unmount: () => void;\n};\n\nexport type RenderHookOptions<Props> = {\n /**\n * The initial props to pass to the hook.\n */\n initialProps?: Props;\n\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\nexport async function renderHook<Result, Props>(\n hookToRender: (props: Props) => Result,\n options?: RenderHookOptions<NoInfer<Props>>,\n): Promise<RenderHookResult<Result, Props>> {\n const result = React.createRef<Result>() as RefObject<Result>;\n\n function HookContainer({ hookProps }: { hookProps: Props }) {\n const renderResult = hookToRender(hookProps);\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { initialProps, ...renderOptions } = options ?? {};\n const { rerender: rerenderComponent, unmount } = await render(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it shouldn't be\n <HookContainer hookProps={initialProps} />,\n renderOptions,\n );\n\n return {\n result: result,\n rerender: (hookProps: Props) => rerenderComponent(<HookContainer hookProps={hookProps} />),\n unmount,\n };\n}\n\n/** @deprecated - Use async `renderHook` instead. */\nexport function unsafe_renderHookSync<Result, Props>(\n hookToRender: (props: Props) => Result,\n options?: RenderHookOptions<NoInfer<Props>>,\n): RenderHookSyncResult<Result, Props> {\n const result = React.createRef<Result>() as RefObject<Result>;\n\n function HookContainer({ hookProps }: { hookProps: Props }) {\n const renderResult = hookToRender(hookProps);\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { initialProps, ...renderOptions } = options ?? {};\n const { rerender: rerenderComponent, unmount } = unsafe_renderSync(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <HookContainer hookProps={initialProps} />,\n renderOptions,\n );\n\n return {\n result: result,\n rerender: (hookProps: Props) => rerenderComponent(<HookContainer hookProps={hookProps} />),\n unmount,\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAAyD,SAAAD,wBAAAI,CAAA,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AwC,aAAA,CAACX,aAAa;MAACC,SAAS,EAAEA;IAAU,CAAE,CAAC,CAAC;IAC1FQ;EACF,CAAC;AACH","ignoreList":[]}
|
package/build/render.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type HostElement, type JsonElement } from 'universal-test-renderer';
|
|
3
3
|
import type { DebugOptions } from './helpers/debug';
|
|
4
4
|
export interface RenderOptions {
|
|
5
5
|
/**
|
|
@@ -7,20 +7,17 @@ export interface RenderOptions {
|
|
|
7
7
|
* reusable custom render functions for common data providers.
|
|
8
8
|
*/
|
|
9
9
|
wrapper?: React.ComponentType<any>;
|
|
10
|
-
createNodeMock?: (element: React.ReactElement) =>
|
|
10
|
+
createNodeMock?: (element: React.ReactElement) => object;
|
|
11
11
|
}
|
|
12
|
-
export type RenderResult = ReturnType<typeof render
|
|
12
|
+
export type RenderResult = Awaited<ReturnType<typeof render>>;
|
|
13
13
|
/**
|
|
14
14
|
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
15
15
|
* to assert on the output.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
18
|
-
rerender: (component: React.ReactElement) => void
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
updateAsync: (component: React.ReactElement) => Promise<void>;
|
|
22
|
-
unmount: () => void;
|
|
23
|
-
unmountAsync: () => Promise<void>;
|
|
17
|
+
export declare function render<T>(element: React.ReactElement<T>, options?: RenderOptions): Promise<{
|
|
18
|
+
rerender: (component: React.ReactElement) => Promise<void>;
|
|
19
|
+
update: (component: React.ReactElement) => Promise<void>;
|
|
20
|
+
unmount: () => Promise<void>;
|
|
24
21
|
toJSON: () => JsonElement | null;
|
|
25
22
|
debug: DebugFunction;
|
|
26
23
|
container: HostElement;
|
|
@@ -79,71 +76,5 @@ export default function render<T>(component: React.ReactElement<T>, options?: Re
|
|
|
79
76
|
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
80
77
|
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
81
78
|
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
82
|
-
}
|
|
83
|
-
export declare function renderInternal<T>(component: React.ReactElement<T>, options?: RenderOptions): {
|
|
84
|
-
rerender: (component: React.ReactElement) => void;
|
|
85
|
-
rerenderAsync: (component: React.ReactElement) => Promise<void>;
|
|
86
|
-
update: (component: React.ReactElement) => void;
|
|
87
|
-
updateAsync: (component: React.ReactElement) => Promise<void>;
|
|
88
|
-
unmount: () => void;
|
|
89
|
-
unmountAsync: () => Promise<void>;
|
|
90
|
-
toJSON: () => JsonElement | null;
|
|
91
|
-
debug: DebugFunction;
|
|
92
|
-
container: HostElement;
|
|
93
|
-
root: HostElement | null;
|
|
94
|
-
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
95
|
-
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
96
|
-
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
97
|
-
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
98
|
-
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
99
|
-
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
100
|
-
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
101
|
-
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
102
|
-
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
103
|
-
queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
104
|
-
findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
105
|
-
findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
106
|
-
getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
107
|
-
getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
108
|
-
queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
109
|
-
queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
110
|
-
findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
111
|
-
findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
112
|
-
getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
113
|
-
getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
114
|
-
queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
115
|
-
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
116
|
-
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
117
|
-
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
118
|
-
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
119
|
-
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
120
|
-
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
121
|
-
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
122
|
-
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
123
|
-
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
124
|
-
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
125
|
-
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
126
|
-
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
127
|
-
queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
128
|
-
findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
129
|
-
findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
130
|
-
getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
131
|
-
getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
132
|
-
queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
133
|
-
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
134
|
-
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
135
|
-
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
136
|
-
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
137
|
-
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
138
|
-
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
139
|
-
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
140
|
-
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
141
|
-
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
142
|
-
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
143
|
-
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
144
|
-
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
145
|
-
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
146
|
-
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
147
|
-
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
148
|
-
};
|
|
79
|
+
}>;
|
|
149
80
|
export type DebugFunction = (options?: DebugOptions) => void;
|
package/build/render.js
CHANGED
|
@@ -3,56 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.renderInternal = renderInternal;
|
|
6
|
+
exports.render = render;
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
8
|
+
var _universalTestRenderer = require("universal-test-renderer");
|
|
9
|
+
var _act = require("./act");
|
|
10
10
|
var _cleanup = require("./cleanup");
|
|
11
11
|
var _config = require("./config");
|
|
12
12
|
var _debug = require("./helpers/debug");
|
|
13
|
-
var
|
|
13
|
+
var _hostComponentNames = require("./helpers/host-component-names");
|
|
14
14
|
var _screen = require("./screen");
|
|
15
15
|
var _within = require("./within");
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
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
17
|
/**
|
|
19
18
|
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
20
19
|
* to assert on the output.
|
|
21
20
|
*/
|
|
22
|
-
function render(
|
|
23
|
-
return renderInternal(component, options);
|
|
24
|
-
}
|
|
25
|
-
function renderInternal(component, options) {
|
|
21
|
+
async function render(element, options = {}) {
|
|
26
22
|
const {
|
|
27
|
-
wrapper: Wrapper
|
|
23
|
+
wrapper: Wrapper,
|
|
24
|
+
createNodeMock
|
|
28
25
|
} = options || {};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
|
|
33
|
-
const renderer = (0, _renderAct.renderWithAct)(wrap(component), rendererOptions);
|
|
34
|
-
return buildRenderResult(renderer, wrap);
|
|
35
|
-
}
|
|
36
|
-
function buildRenderResult(renderer, wrap) {
|
|
37
|
-
const rerender = component => {
|
|
38
|
-
void (0, _act.default)(() => {
|
|
39
|
-
renderer.render(wrap(component));
|
|
40
|
-
});
|
|
26
|
+
const rendererOptions = {
|
|
27
|
+
textComponents: _hostComponentNames.HOST_TEXT_NAMES,
|
|
28
|
+
createNodeMock
|
|
41
29
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
|
|
31
|
+
const renderer = (0, _universalTestRenderer.createRoot)(rendererOptions);
|
|
32
|
+
await (0, _act.act)(() => {
|
|
33
|
+
renderer.render(wrap(element));
|
|
34
|
+
});
|
|
35
|
+
const container = renderer.container;
|
|
36
|
+
const rerender = async component => {
|
|
37
|
+
await (0, _act.act)(() => {
|
|
45
38
|
renderer.render(wrap(component));
|
|
46
39
|
});
|
|
47
40
|
};
|
|
48
|
-
const unmount = () => {
|
|
49
|
-
|
|
50
|
-
renderer.unmount();
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
const unmountAsync = async () => {
|
|
54
|
-
// eslint-disable-next-line require-await
|
|
55
|
-
await (0, _act.default)(async () => {
|
|
41
|
+
const unmount = async () => {
|
|
42
|
+
await (0, _act.act)(() => {
|
|
56
43
|
renderer.unmount();
|
|
57
44
|
});
|
|
58
45
|
};
|
|
@@ -66,24 +53,20 @@ function buildRenderResult(renderer, wrap) {
|
|
|
66
53
|
}
|
|
67
54
|
return json;
|
|
68
55
|
};
|
|
69
|
-
(0, _cleanup.addToCleanupQueue)(
|
|
56
|
+
(0, _cleanup.addToCleanupQueue)(unmount);
|
|
70
57
|
const result = {
|
|
71
58
|
...(0, _within.getQueriesForElement)(renderer.container),
|
|
72
59
|
rerender,
|
|
73
|
-
rerenderAsync,
|
|
74
60
|
update: rerender,
|
|
75
|
-
// alias for
|
|
76
|
-
updateAsync: rerenderAsync,
|
|
77
|
-
// alias for `rerenderAsync`
|
|
61
|
+
// alias for `rerender`
|
|
78
62
|
unmount,
|
|
79
|
-
unmountAsync,
|
|
80
63
|
toJSON,
|
|
81
64
|
debug: makeDebug(renderer),
|
|
82
65
|
get container() {
|
|
83
66
|
return renderer.container;
|
|
84
67
|
},
|
|
85
68
|
get root() {
|
|
86
|
-
const firstChild =
|
|
69
|
+
const firstChild = container.children[0];
|
|
87
70
|
if (typeof firstChild === 'string') {
|
|
88
71
|
throw new Error('Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.');
|
|
89
72
|
}
|
package/build/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["React","_interopRequireWildcard","require","
|
|
1
|
+
{"version":3,"file":"render.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","render","element","options","wrapper","Wrapper","createNodeMock","rendererOptions","textComponents","HOST_TEXT_NAMES","wrap","createElement","renderer","createRoot","act","container","rerender","component","unmount","toJSON","json","children","length","addToCleanupQueue","result","getQueriesForElement","update","debug","makeDebug","root","firstChild","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions"],"sources":["../src/render.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 } 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 RenderOptions {\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\nexport type RenderResult = Awaited<ReturnType<typeof render>>;\n\n/**\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport async function render<T>(element: React.ReactElement<T>, options: RenderOptions = {}) {\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 const renderer = createRoot(rendererOptions);\n\n await act(() => {\n renderer.render(wrap(element));\n });\n\n const container = renderer.container;\n\n const rerender = async (component: React.ReactElement) => {\n await act(() => {\n renderer.render(wrap(component));\n });\n };\n\n const unmount = 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(unmount);\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 = 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;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,YAAAZ,uBAAA,YAAAA,CAAAU,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,OAA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E;MACR,OAAO,IAAAO,YAAK,EAACP,IAAI,EAAEgB,YAAY,CAAC;IAClC;EACF;EACA,OAAOH,SAAS;AAClB","ignoreList":[]}
|
package/build/screen.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.clearRenderResult = clearRenderResult;
|
|
7
7
|
exports.screen = void 0;
|
|
8
8
|
exports.setRenderResult = setRenderResult;
|
|
9
|
-
const SCREEN_ERROR = '`render`
|
|
9
|
+
const SCREEN_ERROR = '`render` function has not been called';
|
|
10
10
|
const notImplemented = () => {
|
|
11
11
|
throw new Error(SCREEN_ERROR);
|
|
12
12
|
};
|
|
@@ -20,11 +20,8 @@ const defaultScreen = {
|
|
|
20
20
|
},
|
|
21
21
|
debug: notImplemented,
|
|
22
22
|
rerender: notImplemented,
|
|
23
|
-
rerenderAsync: notImplemented,
|
|
24
23
|
update: notImplemented,
|
|
25
|
-
updateAsync: notImplemented,
|
|
26
24
|
unmount: notImplemented,
|
|
27
|
-
unmountAsync: notImplemented,
|
|
28
25
|
toJSON: notImplemented,
|
|
29
26
|
getByLabelText: notImplemented,
|
|
30
27
|
getAllByLabelText: notImplemented,
|
package/build/screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","defaultScreen","isDetached","container","root","debug","rerender","
|
|
1
|
+
{"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","defaultScreen","isDetached","container","root","debug","rerender","update","unmount","toJSON","getByLabelText","getAllByLabelText","queryByLabelText","queryAllByLabelText","findByLabelText","findAllByLabelText","getByHintText","getAllByHintText","queryByHintText","queryAllByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint","getByRole","getAllByRole","queryByRole","queryAllByRole","findByRole","findAllByRole","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","queryAllByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","queryAllByDisplayValue","findByDisplayValue","findAllByDisplayValue","getByTestId","getAllByTestId","queryByTestId","queryAllByTestId","findByTestId","findAllByTestId","getByText","getAllByText","queryByText","queryAllByText","findByText","findAllByText","screen","exports","setRenderResult","renderResult","clearRenderResult"],"sources":["../src/screen.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport type { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` function has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\ninterface Screen extends RenderResult {\n isDetached?: boolean;\n}\n\nconst defaultScreen: Screen = {\n isDetached: true,\n get container(): HostElement {\n throw new Error(SCREEN_ERROR);\n },\n get root(): HostElement | null {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplemented,\n rerender: notImplemented,\n update: notImplemented,\n unmount: notImplemented,\n toJSON: notImplemented,\n getByLabelText: notImplemented,\n getAllByLabelText: notImplemented,\n queryByLabelText: notImplemented,\n queryAllByLabelText: notImplemented,\n findByLabelText: notImplemented,\n findAllByLabelText: notImplemented,\n getByHintText: notImplemented,\n getAllByHintText: notImplemented,\n queryByHintText: notImplemented,\n queryAllByHintText: notImplemented,\n findByHintText: notImplemented,\n findAllByHintText: notImplemented,\n getByA11yHint: notImplemented,\n getAllByA11yHint: notImplemented,\n queryByA11yHint: notImplemented,\n queryAllByA11yHint: notImplemented,\n findByA11yHint: notImplemented,\n findAllByA11yHint: notImplemented,\n getByAccessibilityHint: notImplemented,\n getAllByAccessibilityHint: notImplemented,\n queryByAccessibilityHint: notImplemented,\n queryAllByAccessibilityHint: notImplemented,\n findByAccessibilityHint: notImplemented,\n findAllByAccessibilityHint: notImplemented,\n getByRole: notImplemented,\n getAllByRole: notImplemented,\n queryByRole: notImplemented,\n queryAllByRole: notImplemented,\n findByRole: notImplemented,\n findAllByRole: notImplemented,\n getByPlaceholderText: notImplemented,\n getAllByPlaceholderText: notImplemented,\n queryByPlaceholderText: notImplemented,\n queryAllByPlaceholderText: notImplemented,\n findByPlaceholderText: notImplemented,\n findAllByPlaceholderText: notImplemented,\n getByDisplayValue: notImplemented,\n getAllByDisplayValue: notImplemented,\n queryByDisplayValue: notImplemented,\n queryAllByDisplayValue: notImplemented,\n findByDisplayValue: notImplemented,\n findAllByDisplayValue: notImplemented,\n getByTestId: notImplemented,\n getAllByTestId: notImplemented,\n queryByTestId: notImplemented,\n queryAllByTestId: notImplemented,\n findByTestId: notImplemented,\n findAllByTestId: notImplemented,\n getByText: notImplemented,\n getAllByText: notImplemented,\n queryByText: notImplemented,\n queryAllByText: notImplemented,\n findByText: notImplemented,\n findAllByText: notImplemented,\n};\n\nexport let screen: Screen = defaultScreen;\n\nexport function setRenderResult(renderResult: RenderResult) {\n screen = renderResult;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"mappings":";;;;;;;;AAIA,MAAMA,YAAY,GAAG,uCAAuC;AAE5D,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3B,MAAM,IAAIC,KAAK,CAACF,YAAY,CAAC;AAC/B,CAAC;AAMD,MAAMG,aAAqB,GAAG;EAC5BC,UAAU,EAAE,IAAI;EAChB,IAAIC,SAASA,CAAA,EAAgB;IAC3B,MAAM,IAAIH,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACD,IAAIM,IAAIA,CAAA,EAAuB;IAC7B,MAAM,IAAIJ,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACDO,KAAK,EAAEN,cAAc;EACrBO,QAAQ,EAAEP,cAAc;EACxBQ,MAAM,EAAER,cAAc;EACtBS,OAAO,EAAET,cAAc;EACvBU,MAAM,EAAEV,cAAc;EACtBW,cAAc,EAAEX,cAAc;EAC9BY,iBAAiB,EA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;EACrCqD,WAAW,EAAErD,cAAc;EAC3BsD,cAAc,EAAEtD,cAAc;EAC9BuD,aAAa,EAAEvD,cAAc;EAC7BwD,gBAAgB,EAAExD,cAAc;EAChCyD,YAAY,EAAEzD,cAAc;EAC5B0D,eAAe,EAAE1D,cAAc;EAC/B2D,SAAS,EAAE3D,cAAc;EACzB4D,YAAY,EAAE5D,cAAc;EAC5B6D,WAAW,EAAE7D,cAAc;EAC3B8D,cAAc,EAAE9D,cAAc;EAC9B+D,UAAU,EAAE/D,cAAc;EAC1BgE,aAAa,EAAEhE;AACjB,CAAC;AAEM,IAAIiE,MAAc,GAAAC,OAAA,CAAAD,MAAA,GAAG/D,aAAa;AAElC,SAASiE,eAAeA,CAACC,YAA0B,EAAE;EAC1DF,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,YAAY;AACvB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAG/D,aAAa;AACxB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/event-handler.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-
|
|
1
|
+
{"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/event-handler.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-hook.tsx","../src/render.tsx","../src/screen.ts","../src/types.ts","../src/unsafe-render-sync.tsx","../src/wait-for-element-to-be-removed.ts","../src/wait-for.ts","../src/within.ts","../src/helpers/accessibility.ts","../src/helpers/component-tree.ts","../src/helpers/debug.ts","../src/helpers/errors.ts","../src/helpers/find-all.ts","../src/helpers/format-element.ts","../src/helpers/host-component-names.ts","../src/helpers/logger.ts","../src/helpers/map-props.ts","../src/helpers/object.ts","../src/helpers/pointer-events.ts","../src/helpers/text-content.ts","../src/helpers/text-input.ts","../src/helpers/timers.ts","../src/helpers/wrap-async.ts","../src/helpers/matchers/match-accessibility-state.ts","../src/helpers/matchers/match-accessibility-value.ts","../src/helpers/matchers/match-array-prop.ts","../src/helpers/matchers/match-label-text.ts","../src/helpers/matchers/match-object-prop.ts","../src/helpers/matchers/match-string-prop.ts","../src/helpers/matchers/match-text-content.ts","../src/matchers/extend-expect.ts","../src/matchers/index.ts","../src/matchers/to-be-busy.ts","../src/matchers/to-be-checked.ts","../src/matchers/to-be-disabled.ts","../src/matchers/to-be-empty-element.ts","../src/matchers/to-be-expanded.ts","../src/matchers/to-be-on-the-screen.ts","../src/matchers/to-be-partially-checked.ts","../src/matchers/to-be-selected.ts","../src/matchers/to-be-visible.ts","../src/matchers/to-contain-element.ts","../src/matchers/to-have-accessibility-value.ts","../src/matchers/to-have-accessible-name.ts","../src/matchers/to-have-display-value.ts","../src/matchers/to-have-prop.ts","../src/matchers/to-have-style.ts","../src/matchers/to-have-text-content.ts","../src/matchers/types.ts","../src/matchers/utils.ts","../src/queries/display-value.ts","../src/queries/hint-text.ts","../src/queries/label-text.ts","../src/queries/make-queries.ts","../src/queries/options.ts","../src/queries/placeholder-text.ts","../src/queries/role.ts","../src/queries/test-id.ts","../src/queries/text.ts","../src/test-utils/console.ts","../src/test-utils/events.ts","../src/test-utils/json.ts","../src/test-utils/version.ts","../src/user-event/clear.ts","../src/user-event/index.ts","../src/user-event/paste.ts","../src/user-event/event-builder/base.ts","../src/user-event/event-builder/common.ts","../src/user-event/event-builder/index.ts","../src/user-event/event-builder/scroll-view.ts","../src/user-event/event-builder/text-input.ts","../src/user-event/press/index.ts","../src/user-event/press/press.ts","../src/user-event/scroll/index.ts","../src/user-event/scroll/scroll-to.ts","../src/user-event/scroll/utils.ts","../src/user-event/setup/index.ts","../src/user-event/setup/setup.ts","../src/user-event/type/index.ts","../src/user-event/type/parse-keys.ts","../src/user-event/type/type.ts","../src/user-event/utils/content-size.ts","../src/user-event/utils/dispatch-event.ts","../src/user-event/utils/index.ts","../src/user-event/utils/text-range.ts","../src/user-event/utils/wait.ts"],"version":"5.9.3"}
|