@testing-library/react-native 13.2.0 → 14.0.0-alpha.1
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 +5 -4
- package/build/act.js +3 -6
- package/build/act.js.map +1 -1
- package/build/config.d.ts +0 -10
- package/build/config.js +1 -2
- package/build/config.js.map +1 -1
- package/build/event-handler.d.ts +2 -2
- package/build/event-handler.js.map +1 -1
- package/build/fire-event.d.ts +7 -7
- package/build/fire-event.js +26 -4
- package/build/fire-event.js.map +1 -1
- package/build/helpers/accessibility.d.ts +14 -14
- package/build/helpers/accessibility.js +2 -2
- package/build/helpers/accessibility.js.map +1 -1
- package/build/helpers/component-tree.d.ts +7 -31
- package/build/helpers/component-tree.js +15 -73
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/debug.d.ts +2 -2
- package/build/helpers/debug.js +5 -4
- package/build/helpers/debug.js.map +1 -1
- package/build/helpers/find-all.d.ts +2 -3
- package/build/helpers/find-all.js +5 -5
- package/build/helpers/find-all.js.map +1 -1
- package/build/helpers/format-element.d.ts +4 -4
- package/build/helpers/format-element.js +6 -7
- package/build/helpers/format-element.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +8 -8
- package/build/helpers/host-component-names.js +9 -7
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-state.d.ts +2 -2
- package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
- package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
- package/build/helpers/matchers/match-label-text.d.ts +2 -2
- package/build/helpers/matchers/match-label-text.js.map +1 -1
- package/build/helpers/matchers/match-text-content.d.ts +2 -2
- package/build/helpers/matchers/match-text-content.js.map +1 -1
- package/build/helpers/pointer-events.d.ts +2 -2
- package/build/helpers/pointer-events.js +1 -2
- package/build/helpers/pointer-events.js.map +1 -1
- package/build/helpers/text-content.d.ts +2 -2
- package/build/helpers/text-content.js.map +1 -1
- package/build/helpers/text-input.d.ts +3 -3
- package/build/helpers/text-input.js.map +1 -1
- package/build/helpers/wrap-async.d.ts +1 -0
- package/build/helpers/wrap-async.js +1 -0
- package/build/helpers/wrap-async.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.flow.js +0 -1
- package/build/index.js +11 -1
- package/build/index.js.map +1 -1
- package/build/matchers/to-be-busy.d.ts +2 -2
- package/build/matchers/to-be-busy.js.map +1 -1
- package/build/matchers/to-be-checked.d.ts +2 -2
- package/build/matchers/to-be-checked.js.map +1 -1
- package/build/matchers/to-be-disabled.d.ts +3 -3
- package/build/matchers/to-be-disabled.js +1 -2
- package/build/matchers/to-be-disabled.js.map +1 -1
- package/build/matchers/to-be-empty-element.d.ts +2 -2
- package/build/matchers/to-be-empty-element.js +2 -3
- package/build/matchers/to-be-empty-element.js.map +1 -1
- package/build/matchers/to-be-expanded.d.ts +3 -3
- package/build/matchers/to-be-expanded.js.map +1 -1
- package/build/matchers/to-be-on-the-screen.d.ts +2 -2
- package/build/matchers/to-be-on-the-screen.js +1 -1
- package/build/matchers/to-be-on-the-screen.js.map +1 -1
- package/build/matchers/to-be-partially-checked.d.ts +2 -2
- package/build/matchers/to-be-partially-checked.js.map +1 -1
- package/build/matchers/to-be-selected.d.ts +2 -2
- package/build/matchers/to-be-selected.js.map +1 -1
- package/build/matchers/to-be-visible.d.ts +2 -2
- package/build/matchers/to-be-visible.js +1 -2
- package/build/matchers/to-be-visible.js.map +1 -1
- package/build/matchers/to-contain-element.d.ts +2 -2
- package/build/matchers/to-contain-element.js +2 -1
- package/build/matchers/to-contain-element.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.d.ts +2 -2
- package/build/matchers/to-have-accessibility-value.js.map +1 -1
- package/build/matchers/to-have-accessible-name.d.ts +2 -2
- package/build/matchers/to-have-accessible-name.js.map +1 -1
- package/build/matchers/to-have-display-value.d.ts +2 -2
- package/build/matchers/to-have-display-value.js.map +1 -1
- package/build/matchers/to-have-prop.d.ts +2 -2
- package/build/matchers/to-have-prop.js.map +1 -1
- package/build/matchers/to-have-style.d.ts +2 -2
- package/build/matchers/to-have-style.js.map +1 -1
- package/build/matchers/to-have-text-content.d.ts +2 -2
- package/build/matchers/to-have-text-content.js.map +1 -1
- package/build/matchers/types.d.ts +2 -2
- package/build/matchers/types.js.map +1 -1
- package/build/matchers/utils.d.ts +3 -3
- package/build/matchers/utils.js +3 -4
- package/build/matchers/utils.js.map +1 -1
- package/build/native-state.d.ts +3 -3
- package/build/native-state.js.map +1 -1
- package/build/pure.d.ts +1 -1
- package/build/pure.js +2 -2
- package/build/pure.js.map +1 -1
- package/build/queries/display-value.d.ts +2 -2
- package/build/queries/display-value.js.map +1 -1
- package/build/queries/hint-text.d.ts +2 -2
- package/build/queries/hint-text.js.map +1 -1
- package/build/queries/label-text.d.ts +2 -2
- package/build/queries/label-text.js.map +1 -1
- package/build/queries/make-queries.d.ts +9 -9
- package/build/queries/make-queries.js.map +1 -1
- package/build/queries/placeholder-text.d.ts +2 -2
- package/build/queries/placeholder-text.js.map +1 -1
- package/build/queries/role.d.ts +2 -2
- package/build/queries/role.js.map +1 -1
- package/build/queries/test-id.d.ts +2 -2
- package/build/queries/test-id.js.map +1 -1
- package/build/queries/text.d.ts +2 -2
- package/build/queries/text.js.map +1 -1
- package/build/render-hook.js +1 -1
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +20 -121
- package/build/render.js +27 -67
- package/build/render.js.map +1 -1
- package/build/screen.js +1 -9
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/user-event/clear.d.ts +2 -2
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/index.d.ts +7 -7
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/paste.d.ts +2 -2
- package/build/user-event/paste.js.map +1 -1
- package/build/user-event/press/press.d.ts +3 -3
- package/build/user-event/press/press.js +1 -10
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/scroll/scroll-to.d.ts +2 -2
- package/build/user-event/scroll/scroll-to.js.map +1 -1
- package/build/user-event/setup/setup.d.ts +7 -7
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.d.ts +3 -3
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/dispatch-event.d.ts +2 -2
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/within.d.ts +20 -36
- package/build/within.js +3 -7
- package/build/within.js.map +1 -1
- package/package.json +8 -8
- package/typings/index.flow.js +0 -1
- package/build/helpers/ensure-peer-deps.d.ts +0 -3
- package/build/helpers/ensure-peer-deps.js +0 -32
- package/build/helpers/ensure-peer-deps.js.map +0 -1
- package/build/helpers/string-validation.d.ts +0 -2
- package/build/helpers/string-validation.js +0 -31
- package/build/helpers/string-validation.js.map +0 -1
- package/build/queries/unsafe-props.d.ts +0 -10
- package/build/queries/unsafe-props.js +0 -49
- package/build/queries/unsafe-props.js.map +0 -1
- package/build/queries/unsafe-type.d.ts +0 -10
- package/build/queries/unsafe-type.js +0 -49
- package/build/queries/unsafe-type.js.map +0 -1
- package/build/render-act.d.ts +0 -2
- package/build/render-act.js +0 -22
- package/build/render-act.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-tree.js","names":["
|
|
1
|
+
{"version":3,"file":"component-tree.js","names":["_universalTestRenderer","require","_screen","isValidElement","element","type","CONTAINER_TYPE","isElementMounted","getContainerElement","screen","container","current","parent","getHostSiblings","hostParent","children","filter","sibling"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\nimport { CONTAINER_TYPE } from 'universal-test-renderer';\n\nimport { screen } from '../screen';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isValidElement(element?: HostElement | null): element is HostElement {\n return typeof element?.type === 'string' && element.type !== CONTAINER_TYPE;\n}\n\nexport function isElementMounted(element: HostElement) {\n return getContainerElement(element) === screen.container;\n}\n\n/**\n * Returns the unsafe root element of the tree (probably composite).\n *\n * @param element The element start traversing from.\n * @returns The root element of the tree (host or composite).\n */\nexport function getContainerElement(element: HostElement) {\n let current: HostElement | null = element;\n while (current?.parent) {\n current = current.parent;\n }\n\n return current;\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(element: HostElement | null): HostElement[] {\n const hostParent = element?.parent ?? null;\n return (\n hostParent?.children.filter(\n (sibling): sibling is HostElement => typeof sibling === 'object' && sibling !== element,\n ) ?? []\n );\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAACC,OAA4B,EAA0B;EACnF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAID,OAAO,CAACC,IAAI,KAAKC,qCAAc;AAC7E;AAEO,SAASC,gBAAgBA,CAACH,OAAoB,EAAE;EACrD,OAAOI,mBAAmB,CAACJ,OAAO,CAAC,KAAKK,cAAM,CAACC,SAAS;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASF,mBAAmBA,CAACJ,OAAoB,EAAE;EACxD,IAAIO,OAA2B,GAAGP,OAAO;EACzC,OAAOO,OAAO,EAAEC,MAAM,EAAE;IACtBD,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAACT,OAA2B,EAAiB;EAC1E,MAAMU,UAAU,GAAGV,OAAO,EAAEQ,MAAM,IAAI,IAAI;EAC1C,OACEE,UAAU,EAAEC,QAAQ,CAACC,MAAM,CACxBC,OAAO,IAA6B,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAKb,OAClF,CAAC,IAAI,EAAE;AAEX","ignoreList":[]}
|
package/build/helpers/debug.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JsonNode } from 'universal-test-renderer';
|
|
2
2
|
import type { FormatElementOptions } from './format-element';
|
|
3
3
|
export type DebugOptions = {
|
|
4
4
|
message?: string;
|
|
@@ -6,4 +6,4 @@ export type DebugOptions = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Log pretty-printed deep test component instance
|
|
8
8
|
*/
|
|
9
|
-
export declare function debug(instance:
|
|
9
|
+
export declare function debug(instance: JsonNode | JsonNode[], options?: DebugOptions): void;
|
package/build/helpers/debug.js
CHANGED
|
@@ -9,10 +9,11 @@ var _logger = require("./logger");
|
|
|
9
9
|
/**
|
|
10
10
|
* Log pretty-printed deep test component instance
|
|
11
11
|
*/
|
|
12
|
-
function debug(instance, {
|
|
13
|
-
message
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
function debug(instance, options) {
|
|
13
|
+
const message = options?.message;
|
|
14
|
+
const formatOptions = {
|
|
15
|
+
mapProps: options?.mapProps
|
|
16
|
+
};
|
|
16
17
|
if (message) {
|
|
17
18
|
_logger.logger.info(`${message}\n\n`, (0, _formatElement.formatJson)(instance, formatOptions));
|
|
18
19
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","names":["_formatElement","require","_logger","debug","instance","message","formatOptions","logger","info","formatJson"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"debug.js","names":["_formatElement","require","_logger","debug","instance","options","message","formatOptions","mapProps","logger","info","formatJson"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\n\nimport type { FormatElementOptions } from './format-element';\nimport { formatJson } from './format-element';\nimport { logger } from './logger';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatElementOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(instance: JsonNode | JsonNode[], options?: DebugOptions) {\n const message = options?.message;\n const formatOptions = { mapProps: options?.mapProps };\n\n if (message) {\n logger.info(`${message}\\n\\n`, formatJson(instance, formatOptions));\n } else {\n logger.info(formatJson(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,SAASE,KAAKA,CAACC,QAA+B,EAAEC,OAAsB,EAAE;EAC7E,MAAMC,OAAO,GAAGD,OAAO,EAAEC,OAAO;EAChC,MAAMC,aAAa,GAAG;IAAEC,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC;EAErD,IAAIF,OAAO,EAAE;IACXG,cAAM,CAACC,IAAI,CAAC,GAAGJ,OAAO,MAAM,EAAE,IAAAK,yBAAU,EAACP,QAAQ,EAAEG,aAAa,CAAC,CAAC;EACpE,CAAC,MAAM;IACLE,cAAM,CAACC,IAAI,CAAC,IAAAC,yBAAU,EAACP,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAClD;AACF","ignoreList":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { HostTestInstance } from './component-tree';
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
3
2
|
interface FindAllOptions {
|
|
4
3
|
/** Match elements hidden from accessibility */
|
|
5
4
|
includeHiddenElements?: boolean;
|
|
@@ -7,5 +6,5 @@ interface FindAllOptions {
|
|
|
7
6
|
hidden?: boolean;
|
|
8
7
|
matchDeepestOnly?: boolean;
|
|
9
8
|
}
|
|
10
|
-
export declare function findAll(root:
|
|
9
|
+
export declare function findAll(root: HostElement, predicate: (element: HostElement) => boolean, options?: FindAllOptions): HostElement[];
|
|
11
10
|
export {};
|
|
@@ -21,21 +21,21 @@ function findAll(root, predicate, options) {
|
|
|
21
21
|
|
|
22
22
|
// Extracted from React Test Renderer
|
|
23
23
|
// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402
|
|
24
|
-
function findAllInternal(
|
|
24
|
+
function findAllInternal(node, predicate, options, indent = '') {
|
|
25
25
|
const results = [];
|
|
26
26
|
|
|
27
27
|
// Match descendants first but do not add them to results yet.
|
|
28
28
|
const matchingDescendants = [];
|
|
29
|
-
|
|
29
|
+
node.children.forEach(child => {
|
|
30
30
|
if (typeof child === 'string') {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
matchingDescendants.push(...findAllInternal(child, predicate, options));
|
|
33
|
+
matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));
|
|
34
34
|
});
|
|
35
35
|
if (
|
|
36
36
|
// When matchDeepestOnly = true: add current element only if no descendants match
|
|
37
|
-
(!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.
|
|
38
|
-
results.push(
|
|
37
|
+
(!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.isValidElement)(node) && predicate(node)) {
|
|
38
|
+
results.push(node);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Add matching descendants after element to preserve original tree walk order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-all.js","names":["_config","require","_accessibility","_componentTree","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","
|
|
1
|
+
{"version":3,"file":"find-all.js","names":["_config","require","_accessibility","_componentTree","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","node","indent","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","isValidElement"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessibility';\nimport { isValidElement } from './component-tree';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: FindAllOptions,\n): HostElement[] {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ?? options?.hidden ?? getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<HostElement>();\n return results.filter((element) => !isHiddenFromAccessibility(element, { cache }));\n}\n\n// Extracted from React Test Renderer\n// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402\nfunction findAllInternal(\n node: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: FindAllOptions,\n indent: string = '',\n): HostElement[] {\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n node.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n isValidElement(node) &&\n predicate(node)\n ) {\n results.push(node);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAaO,SAASG,OAAOA,CACrBC,IAAiB,EACjBC,SAA4C,EAC5CC,OAAwB,EACT;EACf,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAAIH,OAAO,EAAEI,MAAM,IAAI,IAAAC,iBAAS,EAAC,CAAC,EAAEC,4BAA4B;EAEhG,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAc,CAAC;EACxC,OAAOP,OAAO,CAACQ,MAAM,CAAEC,OAAO,IAAK,CAAC,IAAAC,wCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAAC;AACpF;;AAEA;AACA;AACA,SAASL,eAAeA,CACtBU,IAAiB,EACjBb,SAA4C,EAC5CC,OAAwB,EACxBa,MAAc,GAAG,EAAE,EACJ;EACf,MAAMZ,OAAsB,GAAG,EAAE;;EAEjC;EACA,MAAMa,mBAAkC,GAAG,EAAE;EAC7CF,IAAI,CAACG,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGhB,eAAe,CAACe,KAAK,EAAElB,SAAS,EAAEC,OAAO,EAAEa,MAAM,GAAG,IAAI,CAAC,CAAC;EACxF,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACb,OAAO,EAAEmB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/D,IAAAC,6BAAc,EAACT,IAAI,CAAC,IACpBb,SAAS,CAACa,IAAI,CAAC,EACf;IACAX,OAAO,CAACiB,IAAI,CAACN,IAAI,CAAC;EACpB;;EAEA;EACAX,OAAO,CAACiB,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOb,OAAO;AAChB","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostNode, JsonNode } from 'universal-test-renderer';
|
|
2
2
|
import type { MapPropsFunction } from './map-props';
|
|
3
3
|
export type FormatElementOptions = {
|
|
4
4
|
/** Minimize used space. */
|
|
@@ -13,6 +13,6 @@ export type FormatElementOptions = {
|
|
|
13
13
|
*
|
|
14
14
|
* @param element Element to format.
|
|
15
15
|
*/
|
|
16
|
-
export declare function formatElement(element:
|
|
17
|
-
export declare function formatElementList(elements:
|
|
18
|
-
export declare function formatJson(json:
|
|
16
|
+
export declare function formatElement(element: HostNode | null, { compact, highlight, mapProps }?: FormatElementOptions): string;
|
|
17
|
+
export declare function formatElementList(elements: HostNode[], options?: FormatElementOptions): string;
|
|
18
|
+
export declare function formatJson(json: JsonNode | JsonNode[], { compact, highlight, mapProps }?: FormatElementOptions): string;
|
|
@@ -23,22 +23,21 @@ function formatElement(element, {
|
|
|
23
23
|
if (element == null) {
|
|
24
24
|
return '(null)';
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const childrenToDisplay = typeof children === 'string' ? [children] : undefined;
|
|
26
|
+
if (typeof element === 'string') {
|
|
27
|
+
return element;
|
|
28
|
+
}
|
|
29
|
+
const childrenToDisplay = element.children.filter(child => typeof child === 'string');
|
|
31
30
|
return (0, _prettyFormat.default)({
|
|
32
31
|
// This prop is needed persuade the prettyFormat that the element is
|
|
33
32
|
// a ReactTestRendererJSON instance, so it is formatted as JSX.
|
|
34
33
|
$$typeof: Symbol.for('react.test.json'),
|
|
35
34
|
type: `${element.type}`,
|
|
36
|
-
props: mapProps ? mapProps(props) : props,
|
|
35
|
+
props: mapProps ? mapProps(element.props) : element.props,
|
|
37
36
|
children: childrenToDisplay
|
|
38
37
|
},
|
|
39
38
|
// See: https://www.npmjs.com/package/pretty-format#usage-with-options
|
|
40
39
|
{
|
|
41
|
-
plugins: [_prettyFormat.plugins.ReactTestComponent
|
|
40
|
+
plugins: [_prettyFormat.plugins.ReactTestComponent],
|
|
42
41
|
printFunctionName: false,
|
|
43
42
|
printBasicPrototype: false,
|
|
44
43
|
highlight: highlight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-element.js","names":["_prettyFormat","_interopRequireWildcard","require","_mapProps","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","formatElement","element","compact","highlight","mapProps","defaultMapProps","
|
|
1
|
+
{"version":3,"file":"format-element.js","names":["_prettyFormat","_interopRequireWildcard","require","_mapProps","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","formatElement","element","compact","highlight","mapProps","defaultMapProps","childrenToDisplay","children","filter","child","prettyFormat","$$typeof","Symbol","for","type","props","plugins","ReactTestComponent","printFunctionName","printBasicPrototype","min","formatElementList","elements","options","length","map","join","formatJson","json","getElementJsonPlugin","ReactElement","test","val","serialize","config","indentation","depth","refs","printer","newVal"],"sources":["../../src/helpers/format-element.ts"],"sourcesContent":["import type { NewPlugin } from 'pretty-format';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport type { HostNode, JsonNode } from 'universal-test-renderer';\n\nimport type { MapPropsFunction } from './map-props';\nimport { defaultMapProps } from './map-props';\n\nexport type FormatElementOptions = {\n /** Minimize used space. */\n compact?: boolean;\n\n /** Highlight the output. */\n highlight?: boolean;\n\n /** Filter or map props to display. */\n mapProps?: MapPropsFunction | null;\n};\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(\n element: HostNode | null,\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n if (element == null) {\n return '(null)';\n }\n\n if (typeof element === 'string') {\n return element;\n }\n\n const childrenToDisplay = element.children.filter((child) => typeof child === 'string');\n\n return prettyFormat(\n {\n // This prop is needed persuade the prettyFormat that the element is\n // a ReactTestRendererJSON instance, so it is formatted as JSX.\n $$typeof: Symbol.for('react.test.json'),\n type: `${element.type}`,\n props: mapProps ? mapProps(element.props) : element.props,\n children: childrenToDisplay,\n },\n // See: https://www.npmjs.com/package/pretty-format#usage-with-options\n {\n plugins: [plugins.ReactTestComponent],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: highlight,\n min: compact,\n },\n );\n}\n\nexport function formatElementList(elements: HostNode[], options?: FormatElementOptions) {\n if (elements.length === 0) {\n return '(no elements)';\n }\n\n return elements.map((element) => formatElement(element, options)).join('\\n');\n}\n\nexport function formatJson(\n json: JsonNode | JsonNode[],\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n return prettyFormat(json, {\n plugins: [getElementJsonPlugin(mapProps), plugins.ReactElement],\n highlight: highlight,\n printBasicPrototype: false,\n min: compact,\n });\n}\n\nfunction getElementJsonPlugin(mapProps?: MapPropsFunction | null): NewPlugin {\n return {\n test: (val) => plugins.ReactTestComponent.test(val),\n serialize: (val, config, indentation, depth, refs, printer) => {\n let newVal = val;\n if (mapProps && val.props) {\n newVal = { ...val, props: mapProps(val.props) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer,\n );\n },\n };\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
|
+
export declare const HOST_TEXT_NAMES: string[];
|
|
3
3
|
/**
|
|
4
4
|
* Checks if the given element is a host Text element.
|
|
5
5
|
* @param element The element to check.
|
|
6
6
|
*/
|
|
7
|
-
export declare function isHostText(element:
|
|
7
|
+
export declare function isHostText(element: HostElement | null): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Checks if the given element is a host TextInput element.
|
|
10
10
|
* @param element The element to check.
|
|
11
11
|
*/
|
|
12
|
-
export declare function isHostTextInput(element:
|
|
12
|
+
export declare function isHostTextInput(element: HostElement | null): boolean;
|
|
13
13
|
/**
|
|
14
14
|
* Checks if the given element is a host Image element.
|
|
15
15
|
* @param element The element to check.
|
|
16
16
|
*/
|
|
17
|
-
export declare function isHostImage(element:
|
|
17
|
+
export declare function isHostImage(element: HostElement | null): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Checks if the given element is a host Switch element.
|
|
20
20
|
* @param element The element to check.
|
|
21
21
|
*/
|
|
22
|
-
export declare function isHostSwitch(element:
|
|
22
|
+
export declare function isHostSwitch(element: HostElement | null): boolean;
|
|
23
23
|
/**
|
|
24
24
|
* Checks if the given element is a host ScrollView element.
|
|
25
25
|
* @param element The element to check.
|
|
26
26
|
*/
|
|
27
|
-
export declare function isHostScrollView(element:
|
|
27
|
+
export declare function isHostScrollView(element: HostElement | null): boolean;
|
|
28
28
|
/**
|
|
29
29
|
* Checks if the given element is a host Modal element.
|
|
30
30
|
* @param element The element to check.
|
|
31
31
|
*/
|
|
32
|
-
export declare function isHostModal(element:
|
|
32
|
+
export declare function isHostModal(element: HostElement | null): boolean;
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.HOST_TEXT_NAMES = void 0;
|
|
6
7
|
exports.isHostImage = isHostImage;
|
|
7
8
|
exports.isHostModal = isHostModal;
|
|
8
9
|
exports.isHostScrollView = isHostScrollView;
|
|
9
10
|
exports.isHostSwitch = isHostSwitch;
|
|
10
11
|
exports.isHostText = isHostText;
|
|
11
12
|
exports.isHostTextInput = isHostTextInput;
|
|
12
|
-
|
|
13
|
+
var _componentTree = require("./component-tree");
|
|
14
|
+
const HOST_TEXT_NAMES = exports.HOST_TEXT_NAMES = ['Text', 'RCTText'];
|
|
13
15
|
const HOST_TEXT_INPUT_NAMES = ['TextInput'];
|
|
14
16
|
const HOST_IMAGE_NAMES = ['Image'];
|
|
15
17
|
const HOST_SWITCH_NAMES = ['RCTSwitch'];
|
|
@@ -21,7 +23,7 @@ const HOST_MODAL_NAMES = ['Modal'];
|
|
|
21
23
|
* @param element The element to check.
|
|
22
24
|
*/
|
|
23
25
|
function isHostText(element) {
|
|
24
|
-
return
|
|
26
|
+
return (0, _componentTree.isValidElement)(element) && HOST_TEXT_NAMES.includes(element.type);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/**
|
|
@@ -29,7 +31,7 @@ function isHostText(element) {
|
|
|
29
31
|
* @param element The element to check.
|
|
30
32
|
*/
|
|
31
33
|
function isHostTextInput(element) {
|
|
32
|
-
return
|
|
34
|
+
return (0, _componentTree.isValidElement)(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
/**
|
|
@@ -37,7 +39,7 @@ function isHostTextInput(element) {
|
|
|
37
39
|
* @param element The element to check.
|
|
38
40
|
*/
|
|
39
41
|
function isHostImage(element) {
|
|
40
|
-
return
|
|
42
|
+
return (0, _componentTree.isValidElement)(element) && HOST_IMAGE_NAMES.includes(element.type);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -45,7 +47,7 @@ function isHostImage(element) {
|
|
|
45
47
|
* @param element The element to check.
|
|
46
48
|
*/
|
|
47
49
|
function isHostSwitch(element) {
|
|
48
|
-
return
|
|
50
|
+
return (0, _componentTree.isValidElement)(element) && HOST_SWITCH_NAMES.includes(element.type);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/**
|
|
@@ -53,7 +55,7 @@ function isHostSwitch(element) {
|
|
|
53
55
|
* @param element The element to check.
|
|
54
56
|
*/
|
|
55
57
|
function isHostScrollView(element) {
|
|
56
|
-
return
|
|
58
|
+
return (0, _componentTree.isValidElement)(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
/**
|
|
@@ -61,6 +63,6 @@ function isHostScrollView(element) {
|
|
|
61
63
|
* @param element The element to check.
|
|
62
64
|
*/
|
|
63
65
|
function isHostModal(element) {
|
|
64
|
-
return
|
|
66
|
+
return (0, _componentTree.isValidElement)(element) && HOST_MODAL_NAMES.includes(element.type);
|
|
65
67
|
}
|
|
66
68
|
//# sourceMappingURL=host-component-names.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-component-names.js","names":["HOST_TEXT_NAMES","HOST_TEXT_INPUT_NAMES","HOST_IMAGE_NAMES","HOST_SWITCH_NAMES","HOST_SCROLL_VIEW_NAMES","HOST_MODAL_NAMES","isHostText","element","
|
|
1
|
+
{"version":3,"file":"host-component-names.js","names":["_componentTree","require","HOST_TEXT_NAMES","exports","HOST_TEXT_INPUT_NAMES","HOST_IMAGE_NAMES","HOST_SWITCH_NAMES","HOST_SCROLL_VIEW_NAMES","HOST_MODAL_NAMES","isHostText","element","isValidElement","includes","type","isHostTextInput","isHostImage","isHostSwitch","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { isValidElement } from './component-tree';\n\nexport const HOST_TEXT_NAMES = ['Text', 'RCTText'];\nconst HOST_TEXT_INPUT_NAMES = ['TextInput'];\nconst HOST_IMAGE_NAMES = ['Image'];\nconst HOST_SWITCH_NAMES = ['RCTSwitch'];\nconst HOST_SCROLL_VIEW_NAMES = ['RCTScrollView'];\nconst HOST_MODAL_NAMES = ['Modal'];\n\n/**\n * Checks if the given element is a host Text element.\n * @param element The element to check.\n */\nexport function isHostText(element: HostElement | null) {\n return isValidElement(element) && HOST_TEXT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host TextInput element.\n * @param element The element to check.\n */\nexport function isHostTextInput(element: HostElement | null) {\n return isValidElement(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Image element.\n * @param element The element to check.\n */\nexport function isHostImage(element: HostElement | null) {\n return isValidElement(element) && HOST_IMAGE_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Switch element.\n * @param element The element to check.\n */\nexport function isHostSwitch(element: HostElement | null) {\n return isValidElement(element) && HOST_SWITCH_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host ScrollView element.\n * @param element The element to check.\n */\nexport function isHostScrollView(element: HostElement | null) {\n return isValidElement(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Modal element.\n * @param element The element to check.\n */\nexport function isHostModal(element: HostElement | null) {\n return isValidElement(element) && HOST_MODAL_NAMES.includes(element.type);\n}\n"],"mappings":";;;;;;;;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAClD,MAAME,qBAAqB,GAAG,CAAC,WAAW,CAAC;AAC3C,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;AAClC,MAAMC,iBAAiB,GAAG,CAAC,WAAW,CAAC;AACvC,MAAMC,sBAAsB,GAAG,CAAC,eAAe,CAAC;AAChD,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;;AAElC;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,OAA2B,EAAE;EACtD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIR,eAAe,CAACU,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACJ,OAA2B,EAAE;EAC3D,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIN,qBAAqB,CAACQ,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAChF;;AAEA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAACL,OAA2B,EAAE;EACvD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIL,gBAAgB,CAACO,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAACN,OAA2B,EAAE;EACxD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIJ,iBAAiB,CAACM,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC5E;;AAEA;AACA;AACA;AACA;AACO,SAASI,gBAAgBA,CAACP,OAA2B,EAAE;EAC5D,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIH,sBAAsB,CAACK,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AACjF;;AAEA;AACA;AACA;AACA;AACO,SAASK,WAAWA,CAACR,OAA2B,EAAE;EACvD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIF,gBAAgB,CAACI,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
2
|
export interface AccessibilityStateMatcher {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
selected?: boolean;
|
|
@@ -6,4 +6,4 @@ export interface AccessibilityStateMatcher {
|
|
|
6
6
|
busy?: boolean;
|
|
7
7
|
expanded?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare function matchAccessibilityState(node:
|
|
9
|
+
export declare function matchAccessibilityState(node: HostElement, matcher: AccessibilityStateMatcher): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-accessibility-state.js","names":["_accessibility","require","matchAccessibilityState","node","matcher","busy","undefined","computeAriaBusy","checked","computeAriaChecked","disabled","computeAriaDisabled","expanded","computeAriaExpanded","selected","computeAriaSelected"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"match-accessibility-state.js","names":["_accessibility","require","matchAccessibilityState","node","matcher","busy","undefined","computeAriaBusy","checked","computeAriaChecked","disabled","computeAriaDisabled","expanded","computeAriaExpanded","selected","computeAriaSelected"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport {\n computeAriaBusy,\n computeAriaChecked,\n computeAriaDisabled,\n computeAriaExpanded,\n computeAriaSelected,\n} from '../accessibility';\n\n// This type is the same as AccessibilityState from `react-native` package\n// It is re-declared here due to issues with migration from `@types/react-native` to\n// built in `react-native` types.\n// See: https://github.com/callstack/react-native-testing-library/issues/1351\nexport interface AccessibilityStateMatcher {\n disabled?: boolean;\n selected?: boolean;\n checked?: boolean | 'mixed';\n busy?: boolean;\n expanded?: boolean;\n}\n\nexport function matchAccessibilityState(node: HostElement, matcher: AccessibilityStateMatcher) {\n if (matcher.busy !== undefined && matcher.busy !== computeAriaBusy(node)) {\n return false;\n }\n if (matcher.checked !== undefined && matcher.checked !== computeAriaChecked(node)) {\n return false;\n }\n if (matcher.disabled !== undefined && matcher.disabled !== computeAriaDisabled(node)) {\n return false;\n }\n if (matcher.expanded !== undefined && matcher.expanded !== computeAriaExpanded(node)) {\n return false;\n }\n if (matcher.selected !== undefined && matcher.selected !== computeAriaSelected(node)) {\n return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;;AASO,SAASC,uBAAuBA,CAACC,IAAiB,EAAEC,OAAkC,EAAE;EAC7F,IAAIA,OAAO,CAACC,IAAI,KAAKC,SAAS,IAAIF,OAAO,CAACC,IAAI,KAAK,IAAAE,8BAAe,EAACJ,IAAI,CAAC,EAAE;IACxE,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACI,OAAO,KAAKF,SAAS,IAAIF,OAAO,CAACI,OAAO,KAAK,IAAAC,iCAAkB,EAACN,IAAI,CAAC,EAAE;IACjF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACM,QAAQ,KAAKJ,SAAS,IAAIF,OAAO,CAACM,QAAQ,KAAK,IAAAC,kCAAmB,EAACR,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACQ,QAAQ,KAAKN,SAAS,IAAIF,OAAO,CAACQ,QAAQ,KAAK,IAAAC,kCAAmB,EAACV,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACU,QAAQ,KAAKR,SAAS,IAAIF,OAAO,CAACU,QAAQ,KAAK,IAAAC,kCAAmB,EAACZ,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
2
|
import type { TextMatch } from '../../matches';
|
|
3
3
|
export interface AccessibilityValueMatcher {
|
|
4
4
|
min?: number;
|
|
@@ -6,4 +6,4 @@ export interface AccessibilityValueMatcher {
|
|
|
6
6
|
now?: number;
|
|
7
7
|
text?: TextMatch;
|
|
8
8
|
}
|
|
9
|
-
export declare function matchAccessibilityValue(node:
|
|
9
|
+
export declare function matchAccessibilityValue(node: HostElement, matcher: AccessibilityValueMatcher): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-accessibility-value.js","names":["_accessibility","require","_matchStringProp","matchAccessibilityValue","node","matcher","value","computeAriaValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/match-accessibility-value.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"match-accessibility-value.js","names":["_accessibility","require","_matchStringProp","matchAccessibilityValue","node","matcher","value","computeAriaValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/match-accessibility-value.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport type { TextMatch } from '../../matches';\nimport { computeAriaValue } from '../accessibility';\nimport { matchStringProp } from './match-string-prop';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: HostElement,\n matcher: AccessibilityValueMatcher,\n): boolean {\n const value = computeAriaValue(node);\n return (\n (matcher.min === undefined || matcher.min === value?.min) &&\n (matcher.max === undefined || matcher.max === value?.max) &&\n (matcher.now === undefined || matcher.now === value?.now) &&\n (matcher.text === undefined || matchStringProp(value?.text, matcher.text))\n );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AASO,SAASE,uBAAuBA,CACrCC,IAAiB,EACjBC,OAAkC,EACzB;EACT,MAAMC,KAAK,GAAG,IAAAC,+BAAgB,EAACH,IAAI,CAAC;EACpC,OACE,CAACC,OAAO,CAACG,GAAG,KAAKC,SAAS,IAAIJ,OAAO,CAACG,GAAG,KAAKF,KAAK,EAAEE,GAAG,MACvDH,OAAO,CAACK,GAAG,KAAKD,SAAS,IAAIJ,OAAO,CAACK,GAAG,KAAKJ,KAAK,EAAEI,GAAG,CAAC,KACxDL,OAAO,CAACM,GAAG,KAAKF,SAAS,IAAIJ,OAAO,CAACM,GAAG,KAAKL,KAAK,EAAEK,GAAG,CAAC,KACxDN,OAAO,CAACO,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACP,KAAK,EAAEM,IAAI,EAAEP,OAAO,CAACO,IAAI,CAAC,CAAC;AAE9E","ignoreList":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
2
|
import type { TextMatch, TextMatchOptions } from '../../matches';
|
|
3
|
-
export declare function matchAccessibilityLabel(element:
|
|
3
|
+
export declare function matchAccessibilityLabel(element: HostElement, expectedLabel: TextMatch, options?: TextMatchOptions): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-label-text.js","names":["_matches","require","_accessibility","matchAccessibilityLabel","element","expectedLabel","options","matches","computeAriaLabel","normalizer","exact"],"sources":["../../../src/helpers/matchers/match-label-text.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"match-label-text.js","names":["_matches","require","_accessibility","matchAccessibilityLabel","element","expectedLabel","options","matches","computeAriaLabel","normalizer","exact"],"sources":["../../../src/helpers/matchers/match-label-text.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport type { TextMatch, TextMatchOptions } from '../../matches';\nimport { matches } from '../../matches';\nimport { computeAriaLabel } from '../accessibility';\n\nexport function matchAccessibilityLabel(\n element: HostElement,\n expectedLabel: TextMatch,\n options?: TextMatchOptions,\n) {\n return matches(expectedLabel, computeAriaLabel(element), options?.normalizer, options?.exact);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,SAASE,uBAAuBA,CACrCC,OAAoB,EACpBC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,OAAO,IAAAC,gBAAO,EAACF,aAAa,EAAE,IAAAG,+BAAgB,EAACJ,OAAO,CAAC,EAAEE,OAAO,EAAEG,UAAU,EAAEH,OAAO,EAAEI,KAAK,CAAC;AAC/F","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
2
|
import type { TextMatch, TextMatchOptions } from '../../matches';
|
|
3
3
|
/**
|
|
4
4
|
* Matches the given node's text content against string or regex matcher.
|
|
@@ -7,4 +7,4 @@ import type { TextMatch, TextMatchOptions } from '../../matches';
|
|
|
7
7
|
* @param text - The string or regex to match.
|
|
8
8
|
* @returns - Whether the node's text content matches the given string or regex.
|
|
9
9
|
*/
|
|
10
|
-
export declare function matchTextContent(node:
|
|
10
|
+
export declare function matchTextContent(node: HostElement, text: TextMatch, options?: TextMatchOptions): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-text-content.js","names":["_matches","require","_textContent","matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/match-text-content.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"match-text-content.js","names":["_matches","require","_textContent","matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/match-text-content.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport type { TextMatch, TextMatchOptions } from '../../matches';\nimport { matches } from '../../matches';\nimport { getTextContent } from '../text-content';\n\n/**\n * Matches the given node's text content against string or regex matcher.\n *\n * @param node - Node which text content will be matched\n * @param text - The string or regex to match.\n * @returns - Whether the node's text content matches the given string or regex.\n */\nexport function matchTextContent(\n node: HostElement,\n text: TextMatch,\n options: TextMatchOptions = {},\n) {\n const textContent = getTextContent(node);\n const { exact, normalizer } = options;\n return matches(text, textContent, normalizer, exact);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAC9BC,IAAiB,EACjBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,MAAMC,WAAW,GAAG,IAAAC,2BAAc,EAACJ,IAAI,CAAC;EACxC,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGJ,OAAO;EACrC,OAAO,IAAAK,gBAAO,EAACN,IAAI,EAAEE,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AACtD","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
2
|
/**
|
|
3
3
|
* pointerEvents controls whether the View can be the target of touch events.
|
|
4
4
|
* 'auto': The View and its children can be the target of touch events.
|
|
@@ -6,4 +6,4 @@ import type { ReactTestInstance } from 'react-test-renderer';
|
|
|
6
6
|
* 'box-none': The View is never the target of touch events but its subviews can be
|
|
7
7
|
* 'box-only': The view can be the target of touch events but its subviews cannot be
|
|
8
8
|
* see the official react native doc https://reactnative.dev/docs/view#pointerevents */
|
|
9
|
-
export declare const isPointerEventEnabled: (element:
|
|
9
|
+
export declare const isPointerEventEnabled: (element: HostElement, isParent?: boolean) => boolean;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isPointerEventEnabled = void 0;
|
|
7
|
-
var _componentTree = require("./component-tree");
|
|
8
7
|
/**
|
|
9
8
|
* pointerEvents controls whether the View can be the target of touch events.
|
|
10
9
|
* 'auto': The View and its children can be the target of touch events.
|
|
@@ -17,7 +16,7 @@ const isPointerEventEnabled = (element, isParent) => {
|
|
|
17
16
|
if (element?.props.pointerEvents === 'none' || parentCondition) {
|
|
18
17
|
return false;
|
|
19
18
|
}
|
|
20
|
-
const hostParent =
|
|
19
|
+
const hostParent = element.parent;
|
|
21
20
|
if (!hostParent) return true;
|
|
22
21
|
return isPointerEventEnabled(hostParent, true);
|
|
23
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointer-events.js","names":["
|
|
1
|
+
{"version":3,"file":"pointer-events.js","names":["isPointerEventEnabled","element","isParent","parentCondition","props","pointerEvents","hostParent","parent","exports"],"sources":["../../src/helpers/pointer-events.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\n/**\n * pointerEvents controls whether the View can be the target of touch events.\n * 'auto': The View and its children can be the target of touch events.\n * 'none': The View is never the target of touch events.\n * 'box-none': The View is never the target of touch events but its subviews can be\n * 'box-only': The view can be the target of touch events but its subviews cannot be\n * see the official react native doc https://reactnative.dev/docs/view#pointerevents */\nexport const isPointerEventEnabled = (element: HostElement, isParent?: boolean): boolean => {\n const parentCondition = isParent\n ? element?.props.pointerEvents === 'box-only'\n : element?.props.pointerEvents === 'box-none';\n\n if (element?.props.pointerEvents === 'none' || parentCondition) {\n return false;\n }\n\n const hostParent = element.parent;\n if (!hostParent) return true;\n\n return isPointerEventEnabled(hostParent, true);\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAGA,CAACC,OAAoB,EAAEC,QAAkB,KAAc;EAC1F,MAAMC,eAAe,GAAGD,QAAQ,GAC5BD,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,UAAU,GAC3CJ,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,UAAU;EAE/C,IAAIJ,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,MAAM,IAAIF,eAAe,EAAE;IAC9D,OAAO,KAAK;EACd;EAEA,MAAMG,UAAU,GAAGL,OAAO,CAACM,MAAM;EACjC,IAAI,CAACD,UAAU,EAAE,OAAO,IAAI;EAE5B,OAAON,qBAAqB,CAACM,UAAU,EAAE,IAAI,CAAC;AAChD,CAAC;AAACE,OAAA,CAAAR,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function getTextContent(element:
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
|
+
export declare function getTextContent(element: HostElement | string | null): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-content.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/text-content.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"text-content.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/text-content.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nexport function getTextContent(element: HostElement | string | null): string {\n if (!element) {\n return '';\n }\n\n if (typeof element === 'string') {\n return element;\n }\n\n const result: string[] = [];\n element.children?.forEach((child) => {\n result.push(getTextContent(child));\n });\n\n return result.join('');\n}\n"],"mappings":";;;;;;AAEO,SAASA,cAAcA,CAACC,OAAoC,EAAU;EAC3E,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO,EAAE;EACX;EAEA,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;EAChB;EAEA,MAAMC,MAAgB,GAAG,EAAE;EAC3BD,OAAO,CAACE,QAAQ,EAAEC,OAAO,CAAEC,KAAK,IAAK;IACnCH,MAAM,CAACI,IAAI,CAACN,cAAc,CAACK,KAAK,CAAC,CAAC;EACpC,CAAC,CAAC;EAEF,OAAOH,MAAM,CAACK,IAAI,CAAC,EAAE,CAAC;AACxB","ignoreList":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function isEditableTextInput(element:
|
|
3
|
-
export declare function getTextInputValue(element:
|
|
1
|
+
import type { HostElement } from 'universal-test-renderer';
|
|
2
|
+
export declare function isEditableTextInput(element: HostElement): boolean;
|
|
3
|
+
export declare function getTextInputValue(element: HostElement): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.js","names":["_nativeState","require","_hostComponentNames","isEditableTextInput","element","isHostTextInput","props","editable","getTextInputValue","Error","type","value","nativeState","valueForElement","get","defaultValue"],"sources":["../../src/helpers/text-input.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"text-input.js","names":["_nativeState","require","_hostComponentNames","isEditableTextInput","element","isHostTextInput","props","editable","getTextInputValue","Error","type","value","nativeState","valueForElement","get","defaultValue"],"sources":["../../src/helpers/text-input.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { nativeState } from '../native-state';\nimport { isHostTextInput } from './host-component-names';\n\nexport function isEditableTextInput(element: HostElement) {\n return isHostTextInput(element) && element.props.editable !== false;\n}\n\nexport function getTextInputValue(element: HostElement) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return (\n element.props.value ??\n nativeState.valueForElement.get(element) ??\n element.props.defaultValue ??\n ''\n );\n}\n"],"mappings":";;;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEO,SAASE,mBAAmBA,CAACC,OAAoB,EAAE;EACxD,OAAO,IAAAC,mCAAe,EAACD,OAAO,CAAC,IAAIA,OAAO,CAACE,KAAK,CAACC,QAAQ,KAAK,KAAK;AACrE;AAEO,SAASC,iBAAiBA,CAACJ,OAAoB,EAAE;EACtD,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,KAAK,CAAC,kDAAkDL,OAAO,CAACM,IAAI,IAAI,CAAC;EACrF;EAEA,OACEN,OAAO,CAACE,KAAK,CAACK,KAAK,IACnBC,wBAAW,CAACC,eAAe,CAACC,GAAG,CAACV,OAAO,CAAC,IACxCA,OAAO,CAACE,KAAK,CAACS,YAAY,IAC1B,EAAE;AAEN","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.
|
|
3
|
+
* See: https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/pure.js#L37
|
|
3
4
|
*
|
|
4
5
|
* @param callback Async callback to run
|
|
5
6
|
* @returns Result of the callback
|
|
@@ -10,6 +10,7 @@ var _flushMicroTasks = require("../flush-micro-tasks");
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.
|
|
13
|
+
* See: https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/pure.js#L37
|
|
13
14
|
*
|
|
14
15
|
* @param callback Async callback to run
|
|
15
16
|
* @returns Result of the callback
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-async.js","names":["_act","require","_flushMicroTasks","wrapAsync","callback","previousActEnvironment","getIsReactActEnvironment","setReactActEnvironment","result","flushMicroTasks"],"sources":["../../src/helpers/wrap-async.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from '../act';\nimport { flushMicroTasks } from '../flush-micro-tasks';\n\n/**\n * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.\n *\n * @param callback Async callback to run\n * @returns Result of the callback\n */\nexport async function wrapAsync<Result>(callback: () => Promise<Result>): Promise<Result> {\n const previousActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(false);\n\n try {\n const result = await callback();\n // Flush the microtask queue before restoring the `act` environment\n await flushMicroTasks();\n return result;\n } finally {\n setReactActEnvironment(previousActEnvironment);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAHA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,SAASA,CAASC,QAA+B,EAAmB;EACxF,MAAMC,sBAAsB,GAAG,IAAAC,6BAAwB,EAAC,CAAC;EACzD,IAAAC,2BAAsB,EAAC,KAAK,CAAC;EAE7B,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;IAC/B;IACA,MAAM,IAAAK,gCAAe,EAAC,CAAC;IACvB,OAAOD,MAAM;EACf,CAAC,SAAS;IACR,IAAAD,2BAAsB,EAACF,sBAAsB,CAAC;EAChD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"wrap-async.js","names":["_act","require","_flushMicroTasks","wrapAsync","callback","previousActEnvironment","getIsReactActEnvironment","setReactActEnvironment","result","flushMicroTasks"],"sources":["../../src/helpers/wrap-async.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from '../act';\nimport { flushMicroTasks } from '../flush-micro-tasks';\n\n/**\n * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.\n * See: https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/pure.js#L37\n *\n * @param callback Async callback to run\n * @returns Result of the callback\n */\nexport async function wrapAsync<Result>(callback: () => Promise<Result>): Promise<Result> {\n const previousActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(false);\n\n try {\n const result = await callback();\n // Flush the microtask queue before restoring the `act` environment\n await flushMicroTasks();\n return result;\n } finally {\n setReactActEnvironment(previousActEnvironment);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAHA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,SAASA,CAASC,QAA+B,EAAmB;EACxF,MAAMC,sBAAsB,GAAG,IAAAC,6BAAwB,EAAC,CAAC;EACzD,IAAAC,2BAAsB,EAAC,KAAK,CAAC;EAE7B,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;IAC/B;IACA,MAAM,IAAAK,gCAAe,EAAC,CAAC;IACvB,OAAOD,MAAM;EACf,CAAC,SAAS;IACR,IAAAD,2BAAsB,EAACF,sBAAsB,CAAC;EAChD;AACF","ignoreList":[]}
|
package/build/index.d.ts
CHANGED
package/build/index.flow.js
CHANGED
|
@@ -310,7 +310,6 @@ declare module '@testing-library/react-native' {
|
|
|
310
310
|
declare interface RenderOptions {
|
|
311
311
|
wrapper?: React.ComponentType<any>;
|
|
312
312
|
createNodeMock?: (element: React.Element<any>) => any;
|
|
313
|
-
unstable_validateStringsRenderedWithinText?: boolean;
|
|
314
313
|
unstable_isConcurrent?: boolean;
|
|
315
314
|
unstable_strictMode?: boolean;
|
|
316
315
|
unstable_concurrentUpdatesByDefault?: boolean;
|