@testing-library/react-native 12.0.0-rc.2 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/act.js.map +1 -1
  2. package/build/cleanup.js.map +1 -1
  3. package/build/config.js.map +1 -1
  4. package/build/fireEvent.js.map +1 -1
  5. package/build/flushMicroTasks.js.map +1 -1
  6. package/build/helpers/accessiblity.js.map +1 -1
  7. package/build/helpers/component-tree.js.map +1 -1
  8. package/build/helpers/debugDeep.js.map +1 -1
  9. package/build/helpers/debugShallow.js.map +1 -1
  10. package/build/helpers/deprecation.js.map +1 -1
  11. package/build/helpers/errors.js.map +1 -1
  12. package/build/helpers/filterNodeByType.js.map +1 -1
  13. package/build/helpers/findAll.js.map +1 -1
  14. package/build/helpers/format.js.map +1 -1
  15. package/build/helpers/getTextContent.js.map +1 -1
  16. package/build/helpers/host-component-names.js.map +1 -1
  17. package/build/helpers/matchers/accessibilityState.js.map +1 -1
  18. package/build/helpers/matchers/accessibilityValue.js.map +1 -1
  19. package/build/helpers/matchers/matchArrayProp.js.map +1 -1
  20. package/build/helpers/matchers/matchLabelText.js.map +1 -1
  21. package/build/helpers/matchers/matchObjectProp.js.map +1 -1
  22. package/build/helpers/matchers/matchStringProp.js.map +1 -1
  23. package/build/helpers/matchers/matchTextContent.js.map +1 -1
  24. package/build/helpers/query-name.js.map +1 -1
  25. package/build/helpers/stringValidation.js.map +1 -1
  26. package/build/helpers/timers.js.map +1 -1
  27. package/build/index.js.map +1 -1
  28. package/build/matches.js.map +1 -1
  29. package/build/pure.js.map +1 -1
  30. package/build/queries/a11yState.js.map +1 -1
  31. package/build/queries/a11yValue.js.map +1 -1
  32. package/build/queries/displayValue.js.map +1 -1
  33. package/build/queries/hintText.js.map +1 -1
  34. package/build/queries/labelText.js.map +1 -1
  35. package/build/queries/makeQueries.js.map +1 -1
  36. package/build/queries/placeholderText.js.map +1 -1
  37. package/build/queries/role.js.map +1 -1
  38. package/build/queries/testId.js.map +1 -1
  39. package/build/queries/text.js.map +1 -1
  40. package/build/queries/unsafeProps.js.map +1 -1
  41. package/build/queries/unsafeType.js.map +1 -1
  42. package/build/react-versions.js.map +1 -1
  43. package/build/render.js.map +1 -1
  44. package/build/renderHook.js.map +1 -1
  45. package/build/screen.js.map +1 -1
  46. package/build/shallow.js.map +1 -1
  47. package/build/waitFor.js.map +1 -1
  48. package/build/waitForElementToBeRemoved.js.map +1 -1
  49. package/build/within.js.map +1 -1
  50. package/package.json +1 -1
package/build/act.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"act.js","names":["setIsReactActEnvironment","isReactActEnvironment","globalThis","IS_REACT_ACT_ENVIRONMENT","getIsReactActEnvironment","withGlobalActEnvironment","actImplementation","callback","previousActEnvironment","callbackNeedsToBeAwaited","actResult","result","then","thenable","resolve","reject","returnValue","error","act","checkReactVersionAtLeast","reactTestRendererAct"],"sources":["../src/act.ts"],"sourcesContent":["// This file and the act() implementation is sourced from react-testing-library\n// https://github.com/testing-library/react-testing-library/blob/c80809a956b0b9f3289c4a6fa8b5e8cc72d6ef6d/src/act-compat.js\nimport { act as reactTestRendererAct } from 'react-test-renderer';\nimport { checkReactVersionAtLeast } from './react-versions';\n\ntype ReactAct = typeof reactTestRendererAct;\n\n// See https://github.com/reactwg/react-18/discussions/102 for more context on global.IS_REACT_ACT_ENVIRONMENT\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nfunction setIsReactActEnvironment(isReactActEnvironment: boolean | undefined) {\n globalThis.IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment;\n}\n\nfunction getIsReactActEnvironment() {\n return globalThis.IS_REACT_ACT_ENVIRONMENT;\n}\n\nfunction withGlobalActEnvironment(actImplementation: ReactAct) {\n return (callback: Parameters<ReactAct>[0]) => {\n const previousActEnvironment = getIsReactActEnvironment();\n setIsReactActEnvironment(true);\n\n // this code is riddled with eslint disabling comments because this doesn't use real promises but eslint thinks we do\n try {\n // The return value of `act` is always a thenable.\n let callbackNeedsToBeAwaited = false;\n const actResult = actImplementation(() => {\n const result = callback();\n if (\n result !== null &&\n typeof result === 'object' &&\n // @ts-expect-error this should be a promise or thenable\n // eslint-disable-next-line promise/prefer-await-to-then\n typeof result.then === 'function'\n ) {\n callbackNeedsToBeAwaited = true;\n }\n return result;\n });\n\n if (callbackNeedsToBeAwaited) {\n const thenable = actResult;\n return {\n then: (\n resolve: (value: never) => never,\n reject: (value: never) => never\n ) => {\n // eslint-disable-next-line\n thenable.then(\n // eslint-disable-next-line promise/always-return\n (returnValue) => {\n setIsReactActEnvironment(previousActEnvironment);\n resolve(returnValue);\n },\n (error) => {\n setIsReactActEnvironment(previousActEnvironment);\n reject(error);\n }\n );\n },\n };\n } else {\n setIsReactActEnvironment(previousActEnvironment);\n return actResult;\n }\n } catch (error) {\n // Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT\n // or if we have to await the callback first.\n setIsReactActEnvironment(previousActEnvironment);\n throw error;\n }\n };\n}\n\nconst act: ReactAct = checkReactVersionAtLeast(18, 0)\n ? (withGlobalActEnvironment(reactTestRendererAct) as ReactAct)\n : reactTestRendererAct;\n\nexport default act;\nexport {\n setIsReactActEnvironment as setReactActEnvironment,\n getIsReactActEnvironment,\n};\n"],"mappings":";;;;;;;;AAEA;AACA;AAHA;AACA;;AAWA,SAASA,wBAAwB,CAACC,qBAA0C,EAAE;EAC5EC,UAAU,CAACC,wBAAwB,GAAGF,qBAAqB;AAC7D;AAEA,SAASG,wBAAwB,GAAG;EAClC,OAAOF,UAAU,CAACC,wBAAwB;AAC5C;AAEA,SAASE,wBAAwB,CAACC,iBAA2B,EAAE;EAC7D,OAAQC,QAAiC,IAAK;IAC5C,MAAMC,sBAAsB,GAAGJ,wBAAwB,EAAE;IACzDJ,wBAAwB,CAAC,IAAI,CAAC;;IAE9B;IACA,IAAI;MACF;MACA,IAAIS,wBAAwB,GAAG,KAAK;MACpC,MAAMC,SAAS,GAAGJ,iBAAiB,CAAC,MAAM;QACxC,MAAMK,MAAM,GAAGJ,QAAQ,EAAE;QACzB,IACEI,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ;QAC1B;QACA;QACA,OAAOA,MAAM,CAACC,IAAI,KAAK,UAAU,EACjC;UACAH,wBAAwB,GAAG,IAAI;QACjC;QACA,OAAOE,MAAM;MACf,CAAC,CAAC;MAEF,IAAIF,wBAAwB,EAAE;QAC5B,MAAMI,QAAQ,GAAGH,SAAS;QAC1B,OAAO;UACLE,IAAI,EAAE,CACJE,OAAgC,EAChCC,MAA+B,KAC5B;YACH;YACAF,QAAQ,CAACD,IAAI;YACX;YACCI,WAAW,IAAK;cACfhB,wBAAwB,CAACQ,sBAAsB,CAAC;cAChDM,OAAO,CAACE,WAAW,CAAC;YACtB,CAAC,EACAC,KAAK,IAAK;cACTjB,wBAAwB,CAACQ,sBAAsB,CAAC;cAChDO,MAAM,CAACE,KAAK,CAAC;YACf,CAAC,CACF;UACH;QACF,CAAC;MACH,CAAC,MAAM;QACLjB,wBAAwB,CAACQ,sBAAsB,CAAC;QAChD,OAAOE,SAAS;MAClB;IACF,CAAC,CAAC,OAAOO,KAAK,EAAE;MACd;MACA;MACAjB,wBAAwB,CAACQ,sBAAsB,CAAC;MAChD,MAAMS,KAAK;IACb;EACF,CAAC;AACH;AAEA,MAAMC,GAAa,GAAG,IAAAC,uCAAwB,EAAC,EAAE,EAAE,CAAC,CAAC,GAChDd,wBAAwB,CAACe,sBAAoB,CAAC,GAC/CA,sBAAoB;AAAC,eAEVF,GAAG;AAAA"}
1
+ {"version":3,"file":"act.js","names":["_reactTestRenderer","require","_reactVersions","setIsReactActEnvironment","isReactActEnvironment","globalThis","IS_REACT_ACT_ENVIRONMENT","getIsReactActEnvironment","withGlobalActEnvironment","actImplementation","callback","previousActEnvironment","callbackNeedsToBeAwaited","actResult","result","then","thenable","resolve","reject","returnValue","error","act","checkReactVersionAtLeast","reactTestRendererAct","_default","exports","default"],"sources":["../src/act.ts"],"sourcesContent":["// This file and the act() implementation is sourced from react-testing-library\n// https://github.com/testing-library/react-testing-library/blob/c80809a956b0b9f3289c4a6fa8b5e8cc72d6ef6d/src/act-compat.js\nimport { act as reactTestRendererAct } from 'react-test-renderer';\nimport { checkReactVersionAtLeast } from './react-versions';\n\ntype ReactAct = typeof reactTestRendererAct;\n\n// See https://github.com/reactwg/react-18/discussions/102 for more context on global.IS_REACT_ACT_ENVIRONMENT\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nfunction setIsReactActEnvironment(isReactActEnvironment: boolean | undefined) {\n globalThis.IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment;\n}\n\nfunction getIsReactActEnvironment() {\n return globalThis.IS_REACT_ACT_ENVIRONMENT;\n}\n\nfunction withGlobalActEnvironment(actImplementation: ReactAct) {\n return (callback: Parameters<ReactAct>[0]) => {\n const previousActEnvironment = getIsReactActEnvironment();\n setIsReactActEnvironment(true);\n\n // this code is riddled with eslint disabling comments because this doesn't use real promises but eslint thinks we do\n try {\n // The return value of `act` is always a thenable.\n let callbackNeedsToBeAwaited = false;\n const actResult = actImplementation(() => {\n const result = callback();\n if (\n result !== null &&\n typeof result === 'object' &&\n // @ts-expect-error this should be a promise or thenable\n // eslint-disable-next-line promise/prefer-await-to-then\n typeof result.then === 'function'\n ) {\n callbackNeedsToBeAwaited = true;\n }\n return result;\n });\n\n if (callbackNeedsToBeAwaited) {\n const thenable = actResult;\n return {\n then: (\n resolve: (value: never) => never,\n reject: (value: never) => never\n ) => {\n // eslint-disable-next-line\n thenable.then(\n // eslint-disable-next-line promise/always-return\n (returnValue) => {\n setIsReactActEnvironment(previousActEnvironment);\n resolve(returnValue);\n },\n (error) => {\n setIsReactActEnvironment(previousActEnvironment);\n reject(error);\n }\n );\n },\n };\n } else {\n setIsReactActEnvironment(previousActEnvironment);\n return actResult;\n }\n } catch (error) {\n // Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT\n // or if we have to await the callback first.\n setIsReactActEnvironment(previousActEnvironment);\n throw error;\n }\n };\n}\n\nconst act: ReactAct = checkReactVersionAtLeast(18, 0)\n ? (withGlobalActEnvironment(reactTestRendererAct) as ReactAct)\n : reactTestRendererAct;\n\nexport default act;\nexport {\n setIsReactActEnvironment as setReactActEnvironment,\n getIsReactActEnvironment,\n};\n"],"mappings":";;;;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAHA;AACA;;AAWA,SAASE,wBAAwBA,CAACC,qBAA0C,EAAE;EAC5EC,UAAU,CAACC,wBAAwB,GAAGF,qBAAqB;AAC7D;AAEA,SAASG,wBAAwBA,CAAA,EAAG;EAClC,OAAOF,UAAU,CAACC,wBAAwB;AAC5C;AAEA,SAASE,wBAAwBA,CAACC,iBAA2B,EAAE;EAC7D,OAAQC,QAAiC,IAAK;IAC5C,MAAMC,sBAAsB,GAAGJ,wBAAwB,EAAE;IACzDJ,wBAAwB,CAAC,IAAI,CAAC;;IAE9B;IACA,IAAI;MACF;MACA,IAAIS,wBAAwB,GAAG,KAAK;MACpC,MAAMC,SAAS,GAAGJ,iBAAiB,CAAC,MAAM;QACxC,MAAMK,MAAM,GAAGJ,QAAQ,EAAE;QACzB,IACEI,MAAM,KAAK,IAAI,IACf,OAAOA,MAAM,KAAK,QAAQ;QAC1B;QACA;QACA,OAAOA,MAAM,CAACC,IAAI,KAAK,UAAU,EACjC;UACAH,wBAAwB,GAAG,IAAI;QACjC;QACA,OAAOE,MAAM;MACf,CAAC,CAAC;MAEF,IAAIF,wBAAwB,EAAE;QAC5B,MAAMI,QAAQ,GAAGH,SAAS;QAC1B,OAAO;UACLE,IAAI,EAAEA,CACJE,OAAgC,EAChCC,MAA+B,KAC5B;YACH;YACAF,QAAQ,CAACD,IAAI;YACX;YACCI,WAAW,IAAK;cACfhB,wBAAwB,CAACQ,sBAAsB,CAAC;cAChDM,OAAO,CAACE,WAAW,CAAC;YACtB,CAAC,EACAC,KAAK,IAAK;cACTjB,wBAAwB,CAACQ,sBAAsB,CAAC;cAChDO,MAAM,CAACE,KAAK,CAAC;YACf,CAAC,CACF;UACH;QACF,CAAC;MACH,CAAC,MAAM;QACLjB,wBAAwB,CAACQ,sBAAsB,CAAC;QAChD,OAAOE,SAAS;MAClB;IACF,CAAC,CAAC,OAAOO,KAAK,EAAE;MACd;MACA;MACAjB,wBAAwB,CAACQ,sBAAsB,CAAC;MAChD,MAAMS,KAAK;IACb;EACF,CAAC;AACH;AAEA,MAAMC,GAAa,GAAG,IAAAC,uCAAwB,EAAC,EAAE,EAAE,CAAC,CAAC,GAChDd,wBAAwB,CAACe,sBAAoB,CAAC,GAC/CA,sBAAoB;AAAC,IAAAC,QAAA,GAEVH,GAAG;AAAAI,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup.js","names":["cleanupQueue","Set","cleanup","clearRenderResult","forEach","fn","clear","addToCleanupQueue","add"],"sources":["../src/cleanup.ts"],"sourcesContent":["import * as React from 'react';\nimport { clearRenderResult } from './screen';\n\ntype CleanUpFunction = (nextElement?: React.ReactElement<any>) => void;\nlet cleanupQueue = new Set<CleanUpFunction>();\n\nexport default function cleanup() {\n clearRenderResult();\n cleanupQueue.forEach((fn) => fn());\n cleanupQueue.clear();\n}\n\nexport function addToCleanupQueue(fn: CleanUpFunction) {\n cleanupQueue.add(fn);\n}\n"],"mappings":";;;;;;;AACA;AAGA,IAAIA,YAAY,GAAG,IAAIC,GAAG,EAAmB;AAE9B,SAASC,OAAO,GAAG;EAChC,IAAAC,yBAAiB,GAAE;EACnBH,YAAY,CAACI,OAAO,CAAEC,EAAE,IAAKA,EAAE,EAAE,CAAC;EAClCL,YAAY,CAACM,KAAK,EAAE;AACtB;AAEO,SAASC,iBAAiB,CAACF,EAAmB,EAAE;EACrDL,YAAY,CAACQ,GAAG,CAACH,EAAE,CAAC;AACtB"}
1
+ {"version":3,"file":"cleanup.js","names":["_screen","require","cleanupQueue","Set","cleanup","clearRenderResult","forEach","fn","clear","addToCleanupQueue","add"],"sources":["../src/cleanup.ts"],"sourcesContent":["import * as React from 'react';\nimport { clearRenderResult } from './screen';\n\ntype CleanUpFunction = (nextElement?: React.ReactElement<any>) => void;\nlet cleanupQueue = new Set<CleanUpFunction>();\n\nexport default function cleanup() {\n clearRenderResult();\n cleanupQueue.forEach((fn) => fn());\n cleanupQueue.clear();\n}\n\nexport function addToCleanupQueue(fn: CleanUpFunction) {\n cleanupQueue.add(fn);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAGA,IAAIC,YAAY,GAAG,IAAIC,GAAG,EAAmB;AAE9B,SAASC,OAAOA,CAAA,EAAG;EAChC,IAAAC,yBAAiB,GAAE;EACnBH,YAAY,CAACI,OAAO,CAAEC,EAAE,IAAKA,EAAE,EAAE,CAAC;EAClCL,YAAY,CAACM,KAAK,EAAE;AACtB;AAEO,SAASC,iBAAiBA,CAACF,EAAmB,EAAE;EACrDL,YAAY,CAACQ,GAAG,CAACH,EAAE,CAAC;AACtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","config","configure","options","defaultHidden","restOptions","configureInternal","option","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { DebugOptions } from './helpers/debugDeep';\n\n/**\n * Global configuration options for React Native Testing Library.\n */\n\nexport type Config = {\n /** Default timeout, in ms, for `waitFor` and `findBy*` queries. */\n asyncUtilTimeout: number;\n\n /** Default value for `includeHiddenElements` query option. */\n defaultIncludeHiddenElements: boolean;\n\n /** Default options for `debug` helper. */\n defaultDebugOptions?: Partial<DebugOptions>;\n};\n\nexport type ConfigAliasOptions = {\n /** RTL-compatibility alias to `defaultIncludeHiddenElements` */\n defaultHidden: boolean;\n};\n\nexport type HostComponentNames = {\n text: string;\n textInput: string;\n};\n\nexport type InternalConfig = Config & {\n /** Names for key React Native host components. */\n hostComponentNames?: HostComponentNames;\n};\n\nconst defaultConfig: InternalConfig = {\n asyncUtilTimeout: 1000,\n defaultIncludeHiddenElements: false,\n};\n\nlet config = { ...defaultConfig };\n\n/**\n * Configure global options for React Native Testing Library.\n */\nexport function configure(options: Partial<Config & ConfigAliasOptions>) {\n const { defaultHidden, ...restOptions } = options;\n\n const defaultIncludeHiddenElements =\n restOptions.defaultIncludeHiddenElements ??\n defaultHidden ??\n config.defaultIncludeHiddenElements;\n\n config = {\n ...config,\n ...restOptions,\n defaultIncludeHiddenElements,\n };\n}\n\nexport function configureInternal(option: Partial<InternalConfig>) {\n config = {\n ...config,\n ...option,\n };\n}\n\nexport function resetToDefaults() {\n config = { ...defaultConfig };\n}\n\nexport function getConfig() {\n return config;\n}\n"],"mappings":";;;;;;;;;AAEA;AACA;AACA;;AA4BA,MAAMA,aAA6B,GAAG;EACpCC,gBAAgB,EAAE,IAAI;EACtBC,4BAA4B,EAAE;AAChC,CAAC;AAED,IAAIC,MAAM,GAAG;EAAE,GAAGH;AAAc,CAAC;;AAEjC;AACA;AACA;AACO,SAASI,SAAS,CAACC,OAA6C,EAAE;EACvE,MAAM;IAAEC,aAAa;IAAE,GAAGC;EAAY,CAAC,GAAGF,OAAO;EAEjD,MAAMH,4BAA4B,GAChCK,WAAW,CAACL,4BAA4B,IACxCI,aAAa,IACbH,MAAM,CAACD,4BAA4B;EAErCC,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGI,WAAW;IACdL;EACF,CAAC;AACH;AAEO,SAASM,iBAAiB,CAACC,MAA+B,EAAE;EACjEN,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGM;EACL,CAAC;AACH;AAEO,SAASC,eAAe,GAAG;EAChCP,MAAM,GAAG;IAAE,GAAGH;EAAc,CAAC;AAC/B;AAEO,SAASW,SAAS,GAAG;EAC1B,OAAOR,MAAM;AACf"}
1
+ {"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","config","configure","options","defaultHidden","restOptions","configureInternal","option","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { DebugOptions } from './helpers/debugDeep';\n\n/**\n * Global configuration options for React Native Testing Library.\n */\n\nexport type Config = {\n /** Default timeout, in ms, for `waitFor` and `findBy*` queries. */\n asyncUtilTimeout: number;\n\n /** Default value for `includeHiddenElements` query option. */\n defaultIncludeHiddenElements: boolean;\n\n /** Default options for `debug` helper. */\n defaultDebugOptions?: Partial<DebugOptions>;\n};\n\nexport type ConfigAliasOptions = {\n /** RTL-compatibility alias to `defaultIncludeHiddenElements` */\n defaultHidden: boolean;\n};\n\nexport type HostComponentNames = {\n text: string;\n textInput: string;\n};\n\nexport type InternalConfig = Config & {\n /** Names for key React Native host components. */\n hostComponentNames?: HostComponentNames;\n};\n\nconst defaultConfig: InternalConfig = {\n asyncUtilTimeout: 1000,\n defaultIncludeHiddenElements: false,\n};\n\nlet config = { ...defaultConfig };\n\n/**\n * Configure global options for React Native Testing Library.\n */\nexport function configure(options: Partial<Config & ConfigAliasOptions>) {\n const { defaultHidden, ...restOptions } = options;\n\n const defaultIncludeHiddenElements =\n restOptions.defaultIncludeHiddenElements ??\n defaultHidden ??\n config.defaultIncludeHiddenElements;\n\n config = {\n ...config,\n ...restOptions,\n defaultIncludeHiddenElements,\n };\n}\n\nexport function configureInternal(option: Partial<InternalConfig>) {\n config = {\n ...config,\n ...option,\n };\n}\n\nexport function resetToDefaults() {\n config = { ...defaultConfig };\n}\n\nexport function getConfig() {\n return config;\n}\n"],"mappings":";;;;;;;;;AAEA;AACA;AACA;;AA4BA,MAAMA,aAA6B,GAAG;EACpCC,gBAAgB,EAAE,IAAI;EACtBC,4BAA4B,EAAE;AAChC,CAAC;AAED,IAAIC,MAAM,GAAG;EAAE,GAAGH;AAAc,CAAC;;AAEjC;AACA;AACA;AACO,SAASI,SAASA,CAACC,OAA6C,EAAE;EACvE,MAAM;IAAEC,aAAa;IAAE,GAAGC;EAAY,CAAC,GAAGF,OAAO;EAEjD,MAAMH,4BAA4B,GAChCK,WAAW,CAACL,4BAA4B,IACxCI,aAAa,IACbH,MAAM,CAACD,4BAA4B;EAErCC,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGI,WAAW;IACdL;EACF,CAAC;AACH;AAEO,SAASM,iBAAiBA,CAACC,MAA+B,EAAE;EACjEN,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGM;EACL,CAAC;AACH;AAEO,SAASC,eAAeA,CAAA,EAAG;EAChCP,MAAM,GAAG;IAAE,GAAGH;EAAc,CAAC;AAC/B;AAEO,SAASW,SAASA,CAAA,EAAG;EAC1B,OAAOR,MAAM;AACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"fireEvent.js","names":["isTextInput","element","filterNodeByType","TextInput","getHostComponentNames","textInput","isTouchResponder","isHostElement","props","onStartShouldSetResponder","isPointerEventEnabled","isParent","parentCondition","pointerEvents","parent","isTouchEvent","eventName","isEventEnabled","touchResponder","editable","touchStart","touchMove","onMoveShouldSetResponder","undefined","findEventHandler","callsite","nearestTouchResponder","handler","getEventHandler","eventHandlerName","toEventHandlerName","invokeEvent","data","returnValue","act","charAt","toUpperCase","slice","pressHandler","changeTextHandler","scrollHandler","fireEvent","press","changeText","scroll"],"sources":["../src/fireEvent.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { TextInput } from 'react-native';\nimport act from './act';\nimport { isHostElement } from './helpers/component-tree';\nimport { filterNodeByType } from './helpers/filterNodeByType';\nimport { getHostComponentNames } from './helpers/host-component-names';\n\ntype EventHandler = (...args: any) => unknown;\n\nconst isTextInput = (element?: ReactTestInstance) => {\n if (!element) {\n return false;\n }\n\n // We have to test if the element type is either the TextInput component\n // (which would if it is a composite component) or the string\n // TextInput (which would be true if it is a host component)\n // All queries return host components but since fireEvent bubbles up\n // it would trigger the parent prop without the composite component check\n return (\n filterNodeByType(element, TextInput) ||\n filterNodeByType(element, getHostComponentNames().textInput)\n );\n};\n\nconst isTouchResponder = (element?: ReactTestInstance) => {\n if (!isHostElement(element)) return false;\n\n return !!element?.props.onStartShouldSetResponder || isTextInput(element);\n};\n\nconst isPointerEventEnabled = (\n element?: ReactTestInstance,\n isParent?: boolean\n): 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 if (!element?.parent) return true;\n\n return isPointerEventEnabled(element.parent, true);\n};\n\nconst isTouchEvent = (eventName?: string) => {\n return eventName === 'press';\n};\n\nconst isEventEnabled = (\n element?: ReactTestInstance,\n touchResponder?: ReactTestInstance,\n eventName?: string\n) => {\n if (isTextInput(element)) return element?.props.editable !== false;\n if (!isPointerEventEnabled(element) && isTouchEvent(eventName)) return false;\n\n const touchStart = touchResponder?.props.onStartShouldSetResponder?.();\n const touchMove = touchResponder?.props.onMoveShouldSetResponder?.();\n\n if (touchStart || touchMove) return true;\n\n return touchStart === undefined && touchMove === undefined;\n};\n\nconst findEventHandler = (\n element: ReactTestInstance,\n eventName: string,\n callsite?: any,\n nearestTouchResponder?: ReactTestInstance\n): EventHandler | null => {\n const touchResponder = isTouchResponder(element)\n ? element\n : nearestTouchResponder;\n\n const handler = getEventHandler(element, eventName);\n if (handler && isEventEnabled(element, touchResponder, eventName))\n return handler;\n\n if (element.parent === null || element.parent.parent === null) {\n return null;\n }\n\n return findEventHandler(element.parent, eventName, callsite, touchResponder);\n};\n\nconst getEventHandler = (\n element: ReactTestInstance,\n eventName: string\n): EventHandler | undefined => {\n const eventHandlerName = toEventHandlerName(eventName);\n if (typeof element.props[eventHandlerName] === 'function') {\n return element.props[eventHandlerName];\n }\n\n if (typeof element.props[eventName] === 'function') {\n return element.props[eventName];\n }\n\n return undefined;\n};\n\nconst invokeEvent = (\n element: ReactTestInstance,\n eventName: string,\n callsite?: any,\n ...data: Array<any>\n) => {\n const handler = findEventHandler(element, eventName, callsite);\n\n if (!handler) {\n return;\n }\n\n let returnValue;\n\n act(() => {\n returnValue = handler(...data);\n });\n\n return returnValue;\n};\n\nconst toEventHandlerName = (eventName: string) =>\n `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;\n\nconst pressHandler = (element: ReactTestInstance, ...data: Array<any>): void =>\n invokeEvent(element, 'press', pressHandler, ...data);\nconst changeTextHandler = (\n element: ReactTestInstance,\n ...data: Array<any>\n): void => invokeEvent(element, 'changeText', changeTextHandler, ...data);\nconst scrollHandler = (element: ReactTestInstance, ...data: Array<any>): void =>\n invokeEvent(element, 'scroll', scrollHandler, ...data);\n\nconst fireEvent = (\n element: ReactTestInstance,\n eventName: string,\n ...data: Array<any>\n): void => invokeEvent(element, eventName, fireEvent, ...data);\n\nfireEvent.press = pressHandler;\nfireEvent.changeText = changeTextHandler;\nfireEvent.scroll = scrollHandler;\n\nexport default fireEvent;\n"],"mappings":";;;;;;AACA;AACA;AACA;AACA;AACA;AAAuE;AAIvE,MAAMA,WAAW,GAAIC,OAA2B,IAAK;EACnD,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO,KAAK;EACd;;EAEA;EACA;EACA;EACA;EACA;EACA,OACE,IAAAC,kCAAgB,EAACD,OAAO,EAAEE,sBAAS,CAAC,IACpC,IAAAD,kCAAgB,EAACD,OAAO,EAAE,IAAAG,yCAAqB,GAAE,CAACC,SAAS,CAAC;AAEhE,CAAC;AAED,MAAMC,gBAAgB,GAAIL,OAA2B,IAAK;EACxD,IAAI,CAAC,IAAAM,4BAAa,EAACN,OAAO,CAAC,EAAE,OAAO,KAAK;EAEzC,OAAO,CAAC,CAACA,OAAO,EAAEO,KAAK,CAACC,yBAAyB,IAAIT,WAAW,CAACC,OAAO,CAAC;AAC3E,CAAC;AAED,MAAMS,qBAAqB,GAAG,CAC5BT,OAA2B,EAC3BU,QAAkB,KACN;EACZ,MAAMC,eAAe,GAAGD,QAAQ,GAC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AMC,YAAY,GAAG,CAACrC,OAA0B,EAAE,GAAG+B,IAAgB,KACnED,WAAW,CAAC9B,OAAO,EAAE,OAAO,EAAEqC,YAAY,EAAE,GAAGN,IAAI,CAAC;AACtD,MAAMO,iBAAiB,GAAG,CACxBtC,OAA0B,EAC1B,GAAG+B,IAAgB,KACVD,WAAW,CAAC9B,OAAO,EAAE,YAAY,EAAEsC,iBAAiB,EAAE,GAAGP,IAAI,CAAC;AACzE,MAAMQ,aAAa,GAAG,CAACvC,OAA0B,EAAE,GAAG+B,IAAgB,KACpED,WAAW,CAAC9B,OAAO,EAAE,QAAQ,EAAEuC,aAAa,EAAE,GAAGR,IAAI,CAAC;AAExD,MAAMS,SAAS,GAAG,CAChBxC,OAA0B,EAC1Be,SAAiB,EACjB,GAAGgB,IAAgB,KACVD,WAAW,CAAC9B,OAAO,EAAEe,SAAS,EAAEyB,SAAS,EAAE,GAAGT,IAAI,CAAC;AAE9DS,SAAS,CAACC,KAAK,GAAGJ,YAAY;AAC9BG,SAAS,CAACE,UAAU,GAAGJ,iBAAiB;AACxCE,SAAS,CAACG,MAAM,GAAGJ,aAAa;AAAC,eAElBC,SAAS;AAAA"}
1
+ {"version":3,"file":"fireEvent.js","names":["_reactNative","require","_act","_interopRequireDefault","_componentTree","_filterNodeByType","_hostComponentNames","obj","__esModule","default","isTextInput","element","filterNodeByType","TextInput","getHostComponentNames","textInput","isTouchResponder","isHostElement","props","onStartShouldSetResponder","isPointerEventEnabled","isParent","parentCondition","pointerEvents","parent","isTouchEvent","eventName","isEventEnabled","touchResponder","editable","touchStart","touchMove","onMoveShouldSetResponder","undefined","findEventHandler","callsite","nearestTouchResponder","handler","getEventHandler","eventHandlerName","toEventHandlerName","invokeEvent","data","returnValue","act","charAt","toUpperCase","slice","pressHandler","changeTextHandler","scrollHandler","fireEvent","press","changeText","scroll","_default","exports"],"sources":["../src/fireEvent.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { TextInput } from 'react-native';\nimport act from './act';\nimport { isHostElement } from './helpers/component-tree';\nimport { filterNodeByType } from './helpers/filterNodeByType';\nimport { getHostComponentNames } from './helpers/host-component-names';\n\ntype EventHandler = (...args: any) => unknown;\n\nconst isTextInput = (element?: ReactTestInstance) => {\n if (!element) {\n return false;\n }\n\n // We have to test if the element type is either the TextInput component\n // (which would if it is a composite component) or the string\n // TextInput (which would be true if it is a host component)\n // All queries return host components but since fireEvent bubbles up\n // it would trigger the parent prop without the composite component check\n return (\n filterNodeByType(element, TextInput) ||\n filterNodeByType(element, getHostComponentNames().textInput)\n );\n};\n\nconst isTouchResponder = (element?: ReactTestInstance) => {\n if (!isHostElement(element)) return false;\n\n return !!element?.props.onStartShouldSetResponder || isTextInput(element);\n};\n\nconst isPointerEventEnabled = (\n element?: ReactTestInstance,\n isParent?: boolean\n): 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 if (!element?.parent) return true;\n\n return isPointerEventEnabled(element.parent, true);\n};\n\nconst isTouchEvent = (eventName?: string) => {\n return eventName === 'press';\n};\n\nconst isEventEnabled = (\n element?: ReactTestInstance,\n touchResponder?: ReactTestInstance,\n eventName?: string\n) => {\n if (isTextInput(element)) return element?.props.editable !== false;\n if (!isPointerEventEnabled(element) && isTouchEvent(eventName)) return false;\n\n const touchStart = touchResponder?.props.onStartShouldSetResponder?.();\n const touchMove = touchResponder?.props.onMoveShouldSetResponder?.();\n\n if (touchStart || touchMove) return true;\n\n return touchStart === undefined && touchMove === undefined;\n};\n\nconst findEventHandler = (\n element: ReactTestInstance,\n eventName: string,\n callsite?: any,\n nearestTouchResponder?: ReactTestInstance\n): EventHandler | null => {\n const touchResponder = isTouchResponder(element)\n ? element\n : nearestTouchResponder;\n\n const handler = getEventHandler(element, eventName);\n if (handler && isEventEnabled(element, touchResponder, eventName))\n return handler;\n\n if (element.parent === null || element.parent.parent === null) {\n return null;\n }\n\n return findEventHandler(element.parent, eventName, callsite, touchResponder);\n};\n\nconst getEventHandler = (\n element: ReactTestInstance,\n eventName: string\n): EventHandler | undefined => {\n const eventHandlerName = toEventHandlerName(eventName);\n if (typeof element.props[eventHandlerName] === 'function') {\n return element.props[eventHandlerName];\n }\n\n if (typeof element.props[eventName] === 'function') {\n return element.props[eventName];\n }\n\n return undefined;\n};\n\nconst invokeEvent = (\n element: ReactTestInstance,\n eventName: string,\n callsite?: any,\n ...data: Array<any>\n) => {\n const handler = findEventHandler(element, eventName, callsite);\n\n if (!handler) {\n return;\n }\n\n let returnValue;\n\n act(() => {\n returnValue = handler(...data);\n });\n\n return returnValue;\n};\n\nconst toEventHandlerName = (eventName: string) =>\n `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;\n\nconst pressHandler = (element: ReactTestInstance, ...data: Array<any>): void =>\n invokeEvent(element, 'press', pressHandler, ...data);\nconst changeTextHandler = (\n element: ReactTestInstance,\n ...data: Array<any>\n): void => invokeEvent(element, 'changeText', changeTextHandler, ...data);\nconst scrollHandler = (element: ReactTestInstance, ...data: Array<any>): void =>\n invokeEvent(element, 'scroll', scrollHandler, ...data);\n\nconst fireEvent = (\n element: ReactTestInstance,\n eventName: string,\n ...data: Array<any>\n): void => invokeEvent(element, eventName, fireEvent, ...data);\n\nfireEvent.press = pressHandler;\nfireEvent.changeText = changeTextHandler;\nfireEvent.scroll = scrollHandler;\n\nexport default fireEvent;\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AAAuE,SAAAE,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIvE,MAAMG,WAAW,GA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;AACxCE,SAAS,CAACG,MAAM,GAAGJ,aAAa;AAAC,IAAAK,QAAA,GAElBJ,SAAS;AAAAK,OAAA,CAAA/C,OAAA,GAAA8C,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"flushMicroTasks.js","names":["flushMicroTasks","then","resolve","setImmediate"],"sources":["../src/flushMicroTasks.ts"],"sourcesContent":["import { setImmediate } from './helpers/timers';\n\ntype Thenable<T> = { then: (callback: () => T) => unknown };\n\nexport function flushMicroTasks<T>(): Thenable<T> {\n return {\n // using \"thenable\" instead of a Promise, because otherwise it breaks when\n // using \"modern\" fake timers\n then(resolve) {\n setImmediate(resolve);\n },\n };\n}\n"],"mappings":";;;;;;AAAA;AAIO,SAASA,eAAe,GAAmB;EAChD,OAAO;IACL;IACA;IACAC,IAAI,CAACC,OAAO,EAAE;MACZ,IAAAC,oBAAY,EAACD,OAAO,CAAC;IACvB;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"flushMicroTasks.js","names":["_timers","require","flushMicroTasks","then","resolve","setImmediate"],"sources":["../src/flushMicroTasks.ts"],"sourcesContent":["import { setImmediate } from './helpers/timers';\n\ntype Thenable<T> = { then: (callback: () => T) => unknown };\n\nexport function flushMicroTasks<T>(): Thenable<T> {\n return {\n // using \"thenable\" instead of a Promise, because otherwise it breaks when\n // using \"modern\" fake timers\n then(resolve) {\n setImmediate(resolve);\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIO,SAASC,eAAeA,CAAA,EAAmB;EAChD,OAAO;IACL;IACA;IACAC,IAAIA,CAACC,OAAO,EAAE;MACZ,IAAAC,oBAAY,EAACD,OAAO,CAAC;IACvB;EACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"accessiblity.js","names":["accessibilityStateKeys","accessiblityValueKeys","isHiddenFromAccessibility","element","cache","current","isCurrentSubtreeInaccessible","get","undefined","isSubtreeInaccessible","set","parent","isInaccessible","props","accessibilityElementsHidden","importantForAccessibility","flatStyle","StyleSheet","flatten","style","display","hostSiblings","getHostSiblings","some","sibling","accessibilityViewIsModal","isAccessibilityElement","accessible","isHostElementForType","Text","TextInput","Switch"],"sources":["../../src/helpers/accessiblity.ts"],"sourcesContent":["import {\n AccessibilityState,\n AccessibilityValue,\n StyleSheet,\n Switch,\n Text,\n TextInput,\n} from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { getHostSiblings, isHostElementForType } from './component-tree';\n\ntype IsInaccessibleOptions = {\n cache?: WeakMap<ReactTestInstance, boolean>;\n};\n\nexport const accessibilityStateKeys: (keyof AccessibilityState)[] = [\n 'disabled',\n 'selected',\n 'checked',\n 'busy',\n 'expanded',\n];\n\nexport const accessiblityValueKeys: (keyof AccessibilityValue)[] = [\n 'min',\n 'max',\n 'now',\n 'text',\n];\n\nexport function isHiddenFromAccessibility(\n element: ReactTestInstance | null,\n { cache }: IsInaccessibleOptions = {}\n): boolean {\n if (element == null) {\n return true;\n }\n\n let current: ReactTestInstance | null = element;\n while (current) {\n let isCurrentSubtreeInaccessible = cache?.get(current);\n\n if (isCurrentSubtreeInaccessible === undefined) {\n isCurrentSubtreeInaccessible = isSubtreeInaccessible(current);\n cache?.set(current, isCurrentSubtreeInaccessible);\n }\n\n if (isCurrentSubtreeInaccessible) {\n return true;\n }\n\n current = current.parent;\n }\n\n return false;\n}\n\n/** RTL-compatitibility alias for `isHiddenFromAccessibility` */\nexport const isInaccessible = isHiddenFromAccessibility;\n\nfunction isSubtreeInaccessible(element: ReactTestInstance): boolean {\n // Null props can happen for React.Fragments\n if (element.props == null) {\n return false;\n }\n\n // iOS: accessibilityElementsHidden\n // See: https://reactnative.dev/docs/accessibility#accessibilityelementshidden-ios\n if (element.props.accessibilityElementsHidden) {\n return true;\n }\n\n // Android: importantForAccessibility\n // See: https://reactnative.dev/docs/accessibility#importantforaccessibility-android\n if (element.props.importantForAccessibility === 'no-hide-descendants') {\n return true;\n }\n\n // Note that `opacity: 0` is not treated as inaccessible on iOS\n const flatStyle = StyleSheet.flatten(element.props.style) ?? {};\n if (flatStyle.display === 'none') return true;\n\n // iOS: accessibilityViewIsModal\n // See: https://reactnative.dev/docs/accessibility#accessibilityviewismodal-ios\n const hostSiblings = getHostSiblings(element);\n if (hostSiblings.some((sibling) => sibling.props.accessibilityViewIsModal)) {\n return true;\n }\n\n return false;\n}\n\nexport function isAccessibilityElement(\n element: ReactTestInstance | null\n): boolean {\n if (element == null) {\n return false;\n }\n\n if (element.props.accessible !== undefined) {\n return element.props.accessible;\n }\n\n return (\n isHostElementForType(element, Text) ||\n isHostElementForType(element, TextInput) ||\n isHostElementForType(element, Switch)\n );\n}\n"],"mappings":";;;;;;;;;AAAA;AASA;AAMO,MAAMA,sBAAoD,GAAG,CAClE,UAAU,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,UAAU,CACX;AAAC;AAEK,MAAMC,qBAAmD,GAAG,CACjE,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,CACP;AAAC;AAEK,SAASC,yBAAyB,CACvCC,OAAiC,EACjC;EAAEC;AAA6B,CAAC,GAAG,CAAC,CAAC,EAC5B;EACT,IAAID,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIE,OAAiC,GAAGF,OAAO;EAC/C,OAAOE,OAAO,EAAE;IACd,IAAIC,4BAA4B,GAAGF,KAAK,EAAEG,GAAG,CAACF,OAAO,CAAC;IAEtD,IAAIC,4BAA4B,KAAKE,SAAS,EAAE;MAC9CF,4BAA4B,GAAGG,qBAAqB,CAACJ,OAAO,CAAC;MAC7DD,KAAK,EAAEM,GAAG,CAACL,OAAO,EAAEC,4BAA4B,CAAC;IACnD;IAEA,IAAIA,4BAA4B,EAAE;MAChC,OAAO,IAAI;IACb;IAEAD,OAAO,GAAGA,OAAO,CAACM,MAAM;EAC1B;EAEA,OAAO,KAAK;AACd;;AAEA;AACO,MAAMC,cAAc,GAAGV,yBAAyB;AAAC;AAExD,SAASO,qBAAqB,CAACN,OAA0B,EAAW;EAClE;EACA,IAAIA,OAAO,CAACU,KAAK,IAAI,IAAI,EAAE;IACzB,OAAO,KAAK;EACd;;EAEA;EACA;EACA,IAAIV,OAAO,CAACU,KAAK,CAACC,2BAA2B,EAAE;IAC7C,OAAO,IAAI;EACb;;EAEA;EACA;EACA,IAAIX,OAAO,CAACU,KAAK,CAACE,yBAAyB,KAAK,qBAAqB,EAAE;IACrE,OAAO,IAAI;EACb;;EAEA;EACA,MAAMC,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACf,OAAO,CAACU,KAAK,CAACM,KAAK,CAAC,IAAI,CAAC,CAAC;EAC/D,IAAIH,SAAS,CAACI,OAAO,KAAK,MAAM,EAAE,OAAO,IAAI;;EAE7C;EACA;EACA,MAAMC,YAAY,GAAG,IAAAC,8BAAe,EAACnB,OAAO,CAAC;EAC7C,IAAIkB,YAAY,CAACE,IAAI,CAAEC,OAAO,IAAKA,OAAO,CAACX,KAAK,CAACY,wBAAwB,CAAC,EAAE;IAC1E,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd;AAEO,SAASC,sBAAsB,CACpCvB,OAAiC,EACxB;EACT,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,KAAK;EACd;EAEA,IAAIA,OAAO,CAACU,KAAK,CAACc,UAAU,KAAKnB,SAAS,EAAE;IAC1C,OAAOL,OAAO,CAACU,KAAK,CAACc,UAAU;EACjC;EAEA,OACE,IAAAC,mCAAoB,EAACzB,OAAO,EAAE0B,iBAAI,CAAC,IACnC,IAAAD,mCAAoB,EAACzB,OAAO,EAAE2B,sBAAS,CAAC,IACxC,IAAAF,mCAAoB,EAACzB,OAAO,EAAE4B,mBAAM,CAAC;AAEzC"}
1
+ {"version":3,"file":"accessiblity.js","names":["_reactNative","require","_componentTree","accessibilityStateKeys","exports","accessiblityValueKeys","isHiddenFromAccessibility","element","cache","current","isCurrentSubtreeInaccessible","get","undefined","isSubtreeInaccessible","set","parent","isInaccessible","props","accessibilityElementsHidden","importantForAccessibility","flatStyle","StyleSheet","flatten","style","display","hostSiblings","getHostSiblings","some","sibling","accessibilityViewIsModal","isAccessibilityElement","accessible","isHostElementForType","Text","TextInput","Switch"],"sources":["../../src/helpers/accessiblity.ts"],"sourcesContent":["import {\n AccessibilityState,\n AccessibilityValue,\n StyleSheet,\n Switch,\n Text,\n TextInput,\n} from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { getHostSiblings, isHostElementForType } from './component-tree';\n\ntype IsInaccessibleOptions = {\n cache?: WeakMap<ReactTestInstance, boolean>;\n};\n\nexport const accessibilityStateKeys: (keyof AccessibilityState)[] = [\n 'disabled',\n 'selected',\n 'checked',\n 'busy',\n 'expanded',\n];\n\nexport const accessiblityValueKeys: (keyof AccessibilityValue)[] = [\n 'min',\n 'max',\n 'now',\n 'text',\n];\n\nexport function isHiddenFromAccessibility(\n element: ReactTestInstance | null,\n { cache }: IsInaccessibleOptions = {}\n): boolean {\n if (element == null) {\n return true;\n }\n\n let current: ReactTestInstance | null = element;\n while (current) {\n let isCurrentSubtreeInaccessible = cache?.get(current);\n\n if (isCurrentSubtreeInaccessible === undefined) {\n isCurrentSubtreeInaccessible = isSubtreeInaccessible(current);\n cache?.set(current, isCurrentSubtreeInaccessible);\n }\n\n if (isCurrentSubtreeInaccessible) {\n return true;\n }\n\n current = current.parent;\n }\n\n return false;\n}\n\n/** RTL-compatitibility alias for `isHiddenFromAccessibility` */\nexport const isInaccessible = isHiddenFromAccessibility;\n\nfunction isSubtreeInaccessible(element: ReactTestInstance): boolean {\n // Null props can happen for React.Fragments\n if (element.props == null) {\n return false;\n }\n\n // iOS: accessibilityElementsHidden\n // See: https://reactnative.dev/docs/accessibility#accessibilityelementshidden-ios\n if (element.props.accessibilityElementsHidden) {\n return true;\n }\n\n // Android: importantForAccessibility\n // See: https://reactnative.dev/docs/accessibility#importantforaccessibility-android\n if (element.props.importantForAccessibility === 'no-hide-descendants') {\n return true;\n }\n\n // Note that `opacity: 0` is not treated as inaccessible on iOS\n const flatStyle = StyleSheet.flatten(element.props.style) ?? {};\n if (flatStyle.display === 'none') return true;\n\n // iOS: accessibilityViewIsModal\n // See: https://reactnative.dev/docs/accessibility#accessibilityviewismodal-ios\n const hostSiblings = getHostSiblings(element);\n if (hostSiblings.some((sibling) => sibling.props.accessibilityViewIsModal)) {\n return true;\n }\n\n return false;\n}\n\nexport function isAccessibilityElement(\n element: ReactTestInstance | null\n): boolean {\n if (element == null) {\n return false;\n }\n\n if (element.props.accessible !== undefined) {\n return element.props.accessible;\n }\n\n return (\n isHostElementForType(element, Text) ||\n isHostElementForType(element, TextInput) ||\n isHostElementForType(element, Switch)\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,IAAAC,cAAA,GAAAD,OAAA;AAMO,MAAME,sBAAoD,GAAG,CAClE,UAAU,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,UAAU,CACX;AAACC,OAAA,CAAAD,sBAAA,GAAAA,sBAAA;AAEK,MAAME,qBAAmD,GAAG,CACjE,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,CACP;AAACD,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAEK,SAASC,yBAAyBA,CACvCC,OAAiC,EACjC;EAAEC;AAA6B,CAAC,GAAG,CAAC,CAAC,EAC5B;EACT,IAAID,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIE,OAAiC,GAAGF,OAAO;EAC/C,OAAOE,OAAO,EAAE;IACd,IAAIC,4BAA4B,GAAGF,KAAK,EAAEG,GAAG,CAACF,OAAO,CAAC;IAEtD,IAAIC,4BAA4B,KAAKE,SAAS,EAAE;MAC9CF,4BAA4B,GAAGG,qBAAqB,CAACJ,OAAO,CAAC;MAC7DD,KAAK,EAAEM,GAAG,CAACL,OAAO,EAAEC,4BAA4B,CAAC;IACnD;IAEA,IAAIA,4BAA4B,EAAE;MAChC,OAAO,IA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AAM,CAAC;AAEzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"component-tree.js","names":["isHostElement","element","type","getHostParent","current","parent","getHostChildren","hostChildren","children","forEach","child","push","getHostSelf","hostSelves","getHostSelves","length","Error","getHostSiblings","hostParent","filter","sibling","includes","getCompositeParentOfType","isHostElementForType"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isHostElement(element?: ReactTestInstance | null): boolean {\n return typeof element?.type === 'string';\n}\n\n/**\n * Returns first host ancestor for given element.\n * @param element The element start traversing from.\n */\nexport function getHostParent(\n element: ReactTestInstance | null\n): ReactTestInstance | null {\n if (element == null) {\n return null;\n }\n\n let current = element.parent;\n while (current) {\n if (isHostElement(current)) {\n return current;\n }\n\n current = current.parent;\n }\n\n return null;\n}\n\n/**\n * Returns host children for given element.\n * @param element The element start traversing from.\n */\nexport function getHostChildren(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n if (element == null) {\n return [];\n }\n\n const hostChildren: ReactTestInstance[] = [];\n\n element.children.forEach((child) => {\n if (typeof child !== 'object') {\n return;\n }\n\n if (isHostElement(child)) {\n hostChildren.push(child);\n } else {\n hostChildren.push(...getHostChildren(child));\n }\n });\n\n return hostChildren;\n}\n\n/**\n * Return a single host element that represent the passed host or composite element.\n *\n * @param element The element start traversing from.\n * @throws Error if the passed element is a composite element and has no host children or has more than one host child.\n * @returns If the passed element is a host element, it will return itself, if the passed element is a composite\n * element, it will return a single host descendant.\n */\nexport function getHostSelf(\n element: ReactTestInstance | null\n): ReactTestInstance {\n const hostSelves = getHostSelves(element);\n\n if (hostSelves.length === 0) {\n throw new Error(`Expected exactly one host element, but found none.`);\n }\n\n if (hostSelves.length > 1) {\n throw new Error(\n `Expected exactly one host element, but found ${hostSelves.length}.`\n );\n }\n\n return hostSelves[0];\n}\n\n/**\n * Return the array of host elements that represent the passed element.\n *\n * @param element The element start traversing from.\n * @returns If the passed element is a host element, it will return an array containing only that element,\n * if the passed element is a composite element, it will return an array containing its host children (zero, one or many).\n */\nexport function getHostSelves(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n return typeof element?.type === 'string'\n ? [element]\n : getHostChildren(element);\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n const hostParent = getHostParent(element);\n const hostSelves = getHostSelves(element);\n return getHostChildren(hostParent).filter(\n (sibling) => !hostSelves.includes(sibling)\n );\n}\n\nexport function getCompositeParentOfType(\n element: ReactTestInstance,\n type: React.ComponentType\n) {\n let current = element.parent;\n\n while (!isHostElement(current)) {\n // We're at the root of the tree\n if (!current) {\n return null;\n }\n\n if (current.type === type) {\n return current;\n }\n current = current.parent;\n }\n\n return null;\n}\n\n/**\n * Note: this function should be generally used for core React Native types like `View`, `Text`, `TextInput`, etc.\n */\nexport function isHostElementForType(\n element: ReactTestInstance,\n type: React.ComponentType\n) {\n // Not a host element\n if (!isHostElement(element)) return false;\n\n return getCompositeParentOfType(element, type) !== null;\n}\n"],"mappings":";;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,aAAa,CAACC,OAAkC,EAAW;EACzE,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ;AAC1C;;AAEA;AACA;AACA;AACA;AACO,SAASC,aAAa,CAC3BF,OAAiC,EACP;EAC1B,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIG,OAAO,GAAGH,OAAO,CAACI,MAAM;EAC5B,OAAOD,OAAO,EAAE;IACd,IAAIJ,aAAa,CAACI,OAAO,CAAC,EAAE;MAC1B,OAAOA,OAAO;IAChB;IAEAA,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAe,CAC7BL,OAAiC,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,MAAM,CACtCC,OAAO,IAAK,CAACP,UAAU,CAACQ,QAAQ,CAACD,OAAO,CAAC,CAC3C;AACH;AAEO,SAASE,wBAAwB,CACtCrB,OAA0B,EAC1BC,IAAyB,EACzB;EACA,IAAIE,OAAO,GAAGH,OAAO,CAACI,MAAM;EAE5B,OAAO,CAACL,aAAa,CAACI,OAAO,CAAC,EAAE;IAC9B;IACA,IAAI,CAACA,OAAO,EAAE;MACZ,OAAO,IAAI;IACb;IAEA,IAAIA,OAAO,CAACF,IAAI,KAAKA,IAAI,EAAE;MACzB,OAAOE,OAAO;IAChB;IACAA,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACO,SAASkB,oBAAoB,CAClCtB,OAA0B,EAC1BC,IAAyB,EACzB;EACA;EACA,IAAI,CAACF,aAAa,CAACC,OAAO,CAAC,EAAE,OAAO,KAAK;EAEzC,OAAOqB,wBAAwB,CAACrB,OAAO,EAAEC,IAAI,CAAC,KAAK,IAAI;AACzD"}
1
+ {"version":3,"file":"component-tree.js","names":["isHostElement","element","type","getHostParent","current","parent","getHostChildren","hostChildren","children","forEach","child","push","getHostSelf","hostSelves","getHostSelves","length","Error","getHostSiblings","hostParent","filter","sibling","includes","getCompositeParentOfType","isHostElementForType"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isHostElement(element?: ReactTestInstance | null): boolean {\n return typeof element?.type === 'string';\n}\n\n/**\n * Returns first host ancestor for given element.\n * @param element The element start traversing from.\n */\nexport function getHostParent(\n element: ReactTestInstance | null\n): ReactTestInstance | null {\n if (element == null) {\n return null;\n }\n\n let current = element.parent;\n while (current) {\n if (isHostElement(current)) {\n return current;\n }\n\n current = current.parent;\n }\n\n return null;\n}\n\n/**\n * Returns host children for given element.\n * @param element The element start traversing from.\n */\nexport function getHostChildren(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n if (element == null) {\n return [];\n }\n\n const hostChildren: ReactTestInstance[] = [];\n\n element.children.forEach((child) => {\n if (typeof child !== 'object') {\n return;\n }\n\n if (isHostElement(child)) {\n hostChildren.push(child);\n } else {\n hostChildren.push(...getHostChildren(child));\n }\n });\n\n return hostChildren;\n}\n\n/**\n * Return a single host element that represent the passed host or composite element.\n *\n * @param element The element start traversing from.\n * @throws Error if the passed element is a composite element and has no host children or has more than one host child.\n * @returns If the passed element is a host element, it will return itself, if the passed element is a composite\n * element, it will return a single host descendant.\n */\nexport function getHostSelf(\n element: ReactTestInstance | null\n): ReactTestInstance {\n const hostSelves = getHostSelves(element);\n\n if (hostSelves.length === 0) {\n throw new Error(`Expected exactly one host element, but found none.`);\n }\n\n if (hostSelves.length > 1) {\n throw new Error(\n `Expected exactly one host element, but found ${hostSelves.length}.`\n );\n }\n\n return hostSelves[0];\n}\n\n/**\n * Return the array of host elements that represent the passed element.\n *\n * @param element The element start traversing from.\n * @returns If the passed element is a host element, it will return an array containing only that element,\n * if the passed element is a composite element, it will return an array containing its host children (zero, one or many).\n */\nexport function getHostSelves(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n return typeof element?.type === 'string'\n ? [element]\n : getHostChildren(element);\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n const hostParent = getHostParent(element);\n const hostSelves = getHostSelves(element);\n return getHostChildren(hostParent).filter(\n (sibling) => !hostSelves.includes(sibling)\n );\n}\n\nexport function getCompositeParentOfType(\n element: ReactTestInstance,\n type: React.ComponentType\n) {\n let current = element.parent;\n\n while (!isHostElement(current)) {\n // We're at the root of the tree\n if (!current) {\n return null;\n }\n\n if (current.type === type) {\n return current;\n }\n current = current.parent;\n }\n\n return null;\n}\n\n/**\n * Note: this function should be generally used for core React Native types like `View`, `Text`, `TextInput`, etc.\n */\nexport function isHostElementForType(\n element: ReactTestInstance,\n type: React.ComponentType\n) {\n // Not a host element\n if (!isHostElement(element)) return false;\n\n return getCompositeParentOfType(element, type) !== null;\n}\n"],"mappings":";;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,OAAkC,EAAW;EACzE,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ;AAC1C;;AAEA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAC3BF,OAAiC,EACP;EAC1B,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIG,OAAO,GAAGH,OAAO,CAACI,MAAM;EAC5B,OAAOD,OAAO,EAAE;IACd,IAAIJ,aAAa,CAACI,OAAO,CAAC,EAAE;MAC1B,OAAOA,OAAO;IAChB;IAEAA,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BL,OAAiC,EACZ;EACrB,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,EAAE;EACX;EAEA,MAAMM,YAAiC,GAAG,EAAE;EAE5CN,OAAO,CAACO,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAClC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IAEA,IAAIV,aAAa,CAACU,KAAK,CAAC,EAAE;MACxBH,YAAY,CAACI,IAAI,CAACD,KAAK,CAAC;IAC1B,CAAC,MAAM;MACLH,YAAY,CAACI,IAAI,CAAC,GAAGL,eAAe,CAACI,KAAK,CAAC,CAAC;IAC9C;EACF,CAAC,CAAC;EAEF,OAAOH,YAAY;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,WAAWA,CACzBX,OAAiC,EACd;EACnB,MAAMY,UAAU,GAAGC,aAAa,CAACb,OAAO,CAAC;EAEzC,IAAIY,UAAU,CAACE,MAAM,KAAK,CAAC,E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OAAO,EAAEC,IAAI,CAAC,KAAK,IAAI;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"debugDeep.js","names":["debugDeep","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debugDeep.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport default function debugDeep(\n instance: ReactTestRendererJSON | ReactTestRendererJSON[],\n options?: DebugOptions | string\n) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions =\n typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA;AAAiD;AAMjD;AACA;AACA;AACe,SAASA,SAAS,CAC/BC,QAAyD,EACzDC,OAA+B,EAC/B;EACA,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GACjB,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE3E,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAE,GAAEL,OAAQ,MAAK,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF"}
1
+ {"version":3,"file":"debugDeep.js","names":["_format","_interopRequireDefault","require","obj","__esModule","default","debugDeep","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debugDeep.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport default function debugDeep(\n instance: ReactTestRendererJSON | ReactTestRendererJSON[],\n options?: DebugOptions | string\n) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions =\n typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMjD;AACA;AACA;AACe,SAASG,SAASA,CAC/BC,QAAyD,EACzDC,OAA+B,EAC/B;EACA,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GACjB,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE3E,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAE,GAAEL,OAAQ,MAAK,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"debugShallow.js","names":["debugShallow","instance","message","output","shallowInternal","console","log","format"],"sources":["../../src/helpers/debugShallow.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport { shallowInternal } from '../shallow';\nimport format from './format';\n\n/**\n * Log pretty-printed shallow test component instance\n */\nexport default function debugShallow(\n instance: ReactTestInstance | React.ReactElement<any>,\n message?: string\n) {\n const { output } = shallowInternal(instance);\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(output));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(output));\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AAA8B;AAE9B;AACA;AACA;AACe,SAASA,YAAY,CAClCC,QAAqD,EACrDC,OAAgB,EAChB;EACA,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,wBAAe,EAACH,QAAQ,CAAC;EAE5C,IAAIC,OAAO,EAAE;IACX;IACAG,OAAO,CAACC,GAAG,CAAE,GAAEJ,OAAQ,MAAK,EAAE,IAAAK,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC/C,CAAC,MAAM;IACL;IACAE,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC7B;AACF"}
1
+ {"version":3,"file":"debugShallow.js","names":["_shallow","require","_format","_interopRequireDefault","obj","__esModule","default","debugShallow","instance","message","output","shallowInternal","console","log","format"],"sources":["../../src/helpers/debugShallow.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport { shallowInternal } from '../shallow';\nimport format from './format';\n\n/**\n * Log pretty-printed shallow test component instance\n */\nexport default function debugShallow(\n instance: ReactTestInstance | React.ReactElement<any>,\n message?: string\n) {\n const { output } = shallowInternal(instance);\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(output));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(output));\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8B,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9B;AACA;AACA;AACe,SAASG,YAAYA,CAClCC,QAAqD,EACrDC,OAAgB,EAChB;EACA,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,wBAAe,EAACH,QAAQ,CAAC;EAE5C,IAAIC,OAAO,EAAE;IACX;IACAG,OAAO,CAACC,GAAG,CAAE,GAAEJ,OAAQ,MAAK,EAAE,IAAAK,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC/C,CAAC,MAAM;IACL;IACAE,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC7B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"deprecation.js","names":["deprecateQueries","queriesObject","recommendation","result","Object","keys","forEach","queryName","queryFn","deprecateQuery","formattedRecommendation","replace","getQueryPrefix","wrapper","args","errorMessage","console","warn"],"sources":["../../src/helpers/deprecation.ts"],"sourcesContent":["import { getQueryPrefix } from './query-name';\n\nexport function deprecateQueries<Queries extends Record<string, any>>(\n queriesObject: Queries,\n recommendation: string\n): Queries {\n const result = {} as Queries;\n Object.keys(queriesObject).forEach((queryName) => {\n const queryFn = queriesObject[queryName];\n // @ts-expect-error: generic typing is hard\n result[queryName] = deprecateQuery(queryFn, queryName, recommendation);\n });\n\n return result;\n}\n\nfunction deprecateQuery<QueryFn extends (...args: any) => any>(\n queryFn: QueryFn,\n queryName: string,\n recommendation: string\n): QueryFn {\n const formattedRecommendation = recommendation.replace(\n /{queryPrefix}/g,\n getQueryPrefix(queryName)\n );\n\n // @ts-expect-error: generic typing is hard\n const wrapper: QueryFn = (...args: any) => {\n const errorMessage = `${queryName}(...) is deprecated and will be removed in the future.\\n\\n${formattedRecommendation}`;\n // eslint-disable-next-line no-console\n console.warn(errorMessage);\n return queryFn(...args);\n };\n\n return wrapper;\n}\n"],"mappings":";;;;;;AAAA;AAEO,SAASA,gBAAgB,CAC9BC,aAAsB,EACtBC,cAAsB,EACb;EACT,MAAMC,MAAM,GAAG,CAAC,CAAY;EAC5BC,MAAM,CAACC,IAAI,CAACJ,aAAa,CAAC,CAACK,OAAO,CAAEC,SAAS,IAAK;IAChD,MAAMC,OAAO,GAAGP,aAAa,CAACM,SAAS,CAAC;IACxC;IACAJ,MAAM,CAACI,SAAS,CAAC,GAAGE,cAAc,CAACD,OAAO,EAAED,SAAS,EAAEL,cAAc,CAAC;EACxE,CAAC,CAAC;EAEF,OAAOC,MAAM;AACf;AAEA,SAASM,cAAc,CACrBD,OAAgB,EAChBD,SAAiB,EACjBL,cAAsB,EACb;EACT,MAAMQ,uBAAuB,GAAGR,cAAc,CAACS,OAAO,CACpD,gBAAgB,EAChB,IAAAC,yBAAc,EAACL,SAAS,CAAC,CAC1B;;EAED;EACA,MAAMM,OAAgB,GAAG,CAAC,GAAGC,IAAS,KAAK;IACzC,MAAMC,YAAY,GAAI,GAAER,SAAU,6DAA4DG,uBAAwB,EAAC;IACvH;IACAM,OAAO,CAACC,IAAI,CAACF,YAAY,CAAC;IAC1B,OAAOP,OAAO,CAAC,GAAGM,IAAI,CAAC;EACzB,CAAC;EAED,OAAOD,OAAO;AAChB"}
1
+ {"version":3,"file":"deprecation.js","names":["_queryName","require","deprecateQueries","queriesObject","recommendation","result","Object","keys","forEach","queryName","queryFn","deprecateQuery","formattedRecommendation","replace","getQueryPrefix","wrapper","args","errorMessage","console","warn"],"sources":["../../src/helpers/deprecation.ts"],"sourcesContent":["import { getQueryPrefix } from './query-name';\n\nexport function deprecateQueries<Queries extends Record<string, any>>(\n queriesObject: Queries,\n recommendation: string\n): Queries {\n const result = {} as Queries;\n Object.keys(queriesObject).forEach((queryName) => {\n const queryFn = queriesObject[queryName];\n // @ts-expect-error: generic typing is hard\n result[queryName] = deprecateQuery(queryFn, queryName, recommendation);\n });\n\n return result;\n}\n\nfunction deprecateQuery<QueryFn extends (...args: any) => any>(\n queryFn: QueryFn,\n queryName: string,\n recommendation: string\n): QueryFn {\n const formattedRecommendation = recommendation.replace(\n /{queryPrefix}/g,\n getQueryPrefix(queryName)\n );\n\n // @ts-expect-error: generic typing is hard\n const wrapper: QueryFn = (...args: any) => {\n const errorMessage = `${queryName}(...) is deprecated and will be removed in the future.\\n\\n${formattedRecommendation}`;\n // eslint-disable-next-line no-console\n console.warn(errorMessage);\n return queryFn(...args);\n };\n\n return wrapper;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,SAASC,gBAAgBA,CAC9BC,aAAsB,EACtBC,cAAsB,EACb;EACT,MAAMC,MAAM,GAAG,CAAC,CAAY;EAC5BC,MAAM,CAACC,IAAI,CAACJ,aAAa,CAAC,CAACK,OAAO,CAAEC,SAAS,IAAK;IAChD,MAAMC,OAAO,GAAGP,aAAa,CAACM,SAAS,CAAC;IACxC;IACAJ,MAAM,CAACI,SAAS,CAAC,GAAGE,cAAc,CAACD,OAAO,EAAED,SAAS,EAAEL,cAAc,CAAC;EACxE,CAAC,CAAC;EAEF,OAAOC,MAAM;AACf;AAEA,SAASM,cAAcA,CACrBD,OAAgB,EAChBD,SAAiB,EACjBL,cAAsB,EACb;EACT,MAAMQ,uBAAuB,GAAGR,cAAc,CAACS,OAAO,CACpD,gBAAgB,EAChB,IAAAC,yBAAc,EAACL,SAAS,CAAC,CAC1B;;EAED;EACA,MAAMM,OAAgB,GAAGA,CAAC,GAAGC,IAAS,KAAK;IACzC,MAAMC,YAAY,GAAI,GAAER,SAAU,6DAA4DG,uBAAwB,EAAC;IACvH;IACAM,OAAO,CAACC,IAAI,CAACF,YAAY,CAAC;IAC1B,OAAOP,OAAO,CAAC,GAAGM,IAAI,CAAC;EACzB,CAAC;EAED,OAAOD,OAAO;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["ErrorWithStack","Error","constructor","message","callsite","captureStackTrace","createLibraryNotSupportedError","error","prepareErrorMessage","name","value","errorMessage","replace","toString","prettyFormat","min","createQueryByError","includes","copyStackTrace","target","stackTraceSource","stack","warned","printDeprecationWarning","functionName","console","warn","throwRemovedFunctionError","docsRef","throwRenamedFunctionError","newFunctionName"],"sources":["../../src/helpers/errors.ts"],"sourcesContent":["import prettyFormat from 'pretty-format';\n\nexport class ErrorWithStack extends Error {\n constructor(message: string | undefined, callsite: Function) {\n super(message);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, callsite);\n }\n }\n}\n\nexport const createLibraryNotSupportedError = (error: unknown): Error =>\n new Error(\n `Currently the only supported library to search by text is \"react-native\".\\n\\n${\n error instanceof Error ? error.message : ''\n }`\n );\n\nexport const prepareErrorMessage = (\n // TS states that error caught in a catch close are of type `unknown`\n // most real cases will be `Error`, but better safe than sorry\n error: unknown,\n name?: string,\n value?: unknown\n): string => {\n let errorMessage: string;\n if (error instanceof Error) {\n // Strip info about custom predicate\n errorMessage = error.message.replace(\n / matching custom predicate[^]*/gm,\n ''\n );\n } else if (error && typeof error === 'object') {\n errorMessage = error.toString();\n } else {\n errorMessage = 'Caught unknown error';\n }\n\n if (name && value) {\n errorMessage += ` with ${name} ${prettyFormat(value, { min: true })}`;\n }\n return errorMessage;\n};\n\nexport const createQueryByError = (\n error: unknown,\n callsite: Function\n): null => {\n if (error instanceof Error) {\n if (error.message.includes('No instances found')) {\n return null;\n }\n throw new ErrorWithStack(error.message, callsite);\n }\n\n throw new ErrorWithStack(\n // generic refining of `unknown` is very hard, you cannot do `'toString' in error` or anything like that\n // Converting as any with extra safe optional chaining will do the job just as well\n `Query: caught unknown error type: ${typeof error}, value: ${(\n error as any\n )?.toString?.()}`,\n callsite\n );\n};\n\nexport function copyStackTrace(target: unknown, stackTraceSource: Error) {\n if (target instanceof Error && stackTraceSource.stack) {\n target.stack = stackTraceSource.stack.replace(\n stackTraceSource.message,\n target.message\n );\n }\n}\n\nconst warned: { [functionName: string]: boolean } = {};\n\nexport function printDeprecationWarning(functionName: string) {\n if (warned[functionName]) {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn(`\n Deprecation Warning:\n Use of ${functionName} is not recommended and will be deleted in future versions of @testing-library/react-native.\n `);\n\n warned[functionName] = true;\n}\n\nexport function throwRemovedFunctionError(\n functionName: string,\n docsRef: string\n) {\n throw new Error(\n `\"${functionName}\" has been removed.\\n\\nPlease consult: https://callstack.github.io/react-native-testing-library/docs/${docsRef}`\n );\n}\n\nexport function throwRenamedFunctionError(\n functionName: string,\n newFunctionName: string\n) {\n throw new ErrorWithStack(\n `The \"${functionName}\" function has been renamed to \"${newFunctionName}\". Please replace all occurrences.`,\n throwRenamedFunctionError\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAyC;AAElC,MAAMA,cAAc,SAASC,KAAK,CAAC;EACxCC,WAAW,CAACC,OAA2B,EAAEC,QAAkB,EAAE;IAC3D,KAAK,CAACD,OAAO,CAAC;IACd,IAAIF,KAAK,CAACI,iBAAiB,EAAE;MAC3BJ,KAAK,CAACI,iBAAiB,CAAC,IAAI,EAAED,QAAQ,CAAC;IACzC;EACF;AACF;AAAC;AAEM,MAAME,8BAA8B,GAAIC,KAAc,IAC3D,IAAIN,KAAK,CACN,gFACCM,KAAK,YAAYN,KAAK,GAAGM,KAAK,CAACJ,OAAO,GAAG,EAC1C,EAAC,CACH;AAAC;AAEG,MAAMK,mBAAmB,GAAG,CAGjCD,KAAc,EACdE,IAAa,EACbC,KAAe,KACJ;EACX,IAAIC,YAAoB;EACxB,IAAIJ,KAAK,YAAYN,KAAK,EAAE;IAC1B;IACAU,YAAY,GAAGJ,KAAK,CAACJ,OAAO,CAACS,OAAO,CAClC,kCAAkC,EAClC,EAAE,CACH;EACH,CAAC,MAAM,IAAIL,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7CI,YAAY,GAAGJ,KAAK,CAACM,QAAQ,EAAE;EACjC,CAAC,MAAM;IACLF,YAAY,GAAG,sBAAsB;EACvC;EAEA,IAAIF,I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C,CAClI;AACH;AAEO,SAASC,yBAAyB,CACvCL,YAAoB,EACpBM,eAAuB,EACvB;EACA,MAAM,IAAI9B,cAAc,CACrB,QAAOwB,YAAa,mCAAkCM,eAAgB,oCAAmC,EAC1GD,yBAAyB,CAC1B;AACH"}
1
+ {"version":3,"file":"errors.js","names":["_prettyFormat","_interopRequireDefault","require","obj","__esModule","default","ErrorWithStack","Error","constructor","message","callsite","captureStackTrace","exports","createLibraryNotSupportedError","error","prepareErrorMessage","name","value","errorMessage","replace","toString","prettyFormat","min","createQueryByError","includes","copyStackTrace","target","stackTraceSource","stack","warned","printDeprecationWarning","functionName","console","warn","throwRemovedFunctionError","docsRef","throwRenamedFunctionError","newFunctionName"],"sources":["../../src/helpers/errors.ts"],"sourcesContent":["import prettyFormat from 'pretty-format';\n\nexport class ErrorWithStack extends Error {\n constructor(message: string | undefined, callsite: Function) {\n super(message);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, callsite);\n }\n }\n}\n\nexport const createLibraryNotSupportedError = (error: unknown): Error =>\n new Error(\n `Currently the only supported library to search by text is \"react-native\".\\n\\n${\n error instanceof Error ? error.message : ''\n }`\n );\n\nexport const prepareErrorMessage = (\n // TS states that error caught in a catch close are of type `unknown`\n // most real cases will be `Error`, but better safe than sorry\n error: unknown,\n name?: string,\n value?: unknown\n): string => {\n let errorMessage: string;\n if (error instanceof Error) {\n // Strip info about custom predicate\n errorMessage = error.message.replace(\n / matching custom predicate[^]*/gm,\n ''\n );\n } else if (error && typeof error === 'object') {\n errorMessage = error.toString();\n } else {\n errorMessage = 'Caught unknown error';\n }\n\n if (name && value) {\n errorMessage += ` with ${name} ${prettyFormat(value, { min: true })}`;\n }\n return errorMessage;\n};\n\nexport const createQueryByError = (\n error: unknown,\n callsite: Function\n): null => {\n if (error instanceof Error) {\n if (error.message.includes('No instances found')) {\n return null;\n }\n throw new ErrorWithStack(error.message, callsite);\n }\n\n throw new ErrorWithStack(\n // generic refining of `unknown` is very hard, you cannot do `'toString' in error` or anything like that\n // Converting as any with extra safe optional chaining will do the job just as well\n `Query: caught unknown error type: ${typeof error}, value: ${(\n error as any\n )?.toString?.()}`,\n callsite\n );\n};\n\nexport function copyStackTrace(target: unknown, stackTraceSource: Error) {\n if (target instanceof Error && stackTraceSource.stack) {\n target.stack = stackTraceSource.stack.replace(\n stackTraceSource.message,\n target.message\n );\n }\n}\n\nconst warned: { [functionName: string]: boolean } = {};\n\nexport function printDeprecationWarning(functionName: string) {\n if (warned[functionName]) {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn(`\n Deprecation Warning:\n Use of ${functionName} is not recommended and will be deleted in future versions of @testing-library/react-native.\n `);\n\n warned[functionName] = true;\n}\n\nexport function throwRemovedFunctionError(\n functionName: string,\n docsRef: string\n) {\n throw new Error(\n `\"${functionName}\" has been removed.\\n\\nPlease consult: https://callstack.github.io/react-native-testing-library/docs/${docsRef}`\n );\n}\n\nexport function throwRenamedFunctionError(\n functionName: string,\n newFunctionName: string\n) {\n throw new ErrorWithStack(\n `The \"${functionName}\" function has been renamed to \"${newFunctionName}\". Please replace all occurrences.`,\n throwRenamedFunctionError\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElC,MAAMG,cAAc,SAASC,KAAK,CAAC;EACxCC,WAAWA,CAACC,OAA2B,EAAEC,QAAkB,EAAE;IAC3D,KAAK,CAACD,OAAO,CAAC;IACd,IAAIF,KAAK,CAACI,iBAAiB,EAAE;MAC3BJ,KAAK,CAACI,iBAAiB,CAAC,IAAI,EAAED,QAAQ,CAAC;IACzC;EACF;AACF;AAACE,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAEM,MAAMO,8BAA8B,GAAIC,KAAc,IAC3D,IAAIP,KAAK,CACN,gFACCO,KAAK,Y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MAAM,YAAYnB,KAAK,IAAIoB,gBAAgB,CAACC,KAAK,EAAE;IACrDF,MAAM,CAACE,KAAK,GAAGD,gBAAgB,CAACC,KAAK,CAACT,OAAO,CAC3CQ,gBAAgB,CAAClB,OAAO,EACxBiB,MAAM,CAACjB,OAAO,CACf;EACH;AACF;AAEA,MAAMoB,MAA2C,GAAG,CAAC,CAAC;AAE/C,SAASC,uBAAuBA,CAACC,YAAoB,EAAE;EAC5D,IAAIF,MAAM,CAACE,YAAY,CAAC,EAAE;IACxB;EACF;;EAEA;EACAC,OAAO,CAACC,IAAI,CAAE;AAChB;AACA,WAAWF,YAAa;AACxB,GAAG,CAAC;EAEFF,MAAM,CAACE,YAAY,CAAC,GAAG,IAAI;AAC7B;AAEO,SAASG,yBAAyBA,CACvCH,YAAoB,EACpBI,OAAe,EACf;EACA,MAAM,IAAI5B,KAAK,CACZ,IAAGwB,YAAa,wGAAuGI,OAAQ,EAAC,CAClI;AACH;AAEO,SAASC,yBAAyBA,CACvCL,YAAoB,EACpBM,eAAuB,EACvB;EACA,MAAM,IAAI/B,cAAc,CACrB,QAAOyB,YAAa,mCAAkCM,eAAgB,oCAAmC,EAC1GD,yBAAyB,CAC1B;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"filterNodeByType.js","names":["filterNodeByType","node","type"],"sources":["../../src/helpers/filterNodeByType.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport * as React from 'react';\n\nexport const filterNodeByType = (\n node: ReactTestInstance | React.ReactElement,\n type: React.ElementType | string\n) => node.type === type;\n"],"mappings":";;;;;;AAGO,MAAMA,gBAAgB,GAAG,CAC9BC,IAA4C,EAC5CC,IAAgC,KAC7BD,IAAI,CAACC,IAAI,KAAKA,IAAI;AAAC"}
1
+ {"version":3,"file":"filterNodeByType.js","names":["filterNodeByType","node","type","exports"],"sources":["../../src/helpers/filterNodeByType.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport * as React from 'react';\n\nexport const filterNodeByType = (\n node: ReactTestInstance | React.ReactElement,\n type: React.ElementType | string\n) => node.type === type;\n"],"mappings":";;;;;;AAGO,MAAMA,gBAAgB,GAAGA,CAC9BC,IAA4C,EAC5CC,IAAgC,KAC7BD,IAAI,CAACC,IAAI,KAAKA,IAAI;AAACC,OAAA,CAAAH,gBAAA,GAAAA,gBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"findAll.js","names":["findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length"],"sources":["../../src/helpers/findAll.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessiblity';\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: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n) {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ??\n options?.hidden ??\n getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<ReactTestInstance>();\n return results.filter(\n (element) => !isHiddenFromAccessibility(element, { cache })\n );\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 root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): Array<ReactTestInstance> {\n const results: ReactTestInstance[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: ReactTestInstance[] = [];\n root.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n predicate(root)\n ) {\n results.push(root);\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":";;;;;;AACA;AACA;AAaO,SAASA,OAAO,CACrBC,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACxB;EACA,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAC9BH,OAAO,EAAEI,MAAM,IACf,IAAAC,iBAAS,GAAE,EAAEC,4BAA4B;EAE3C,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,EAAqB;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAClBC,OAAO,IAAK,CAAC,IAAAC,uCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAC5D;AACH;;AAEA;AACA;AACA,SAASL,eAAe,CACtBJ,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACE;EAC1B,MAAMC,OAA4B,GAAG,EAAE;;EAEvC;EACA,MAAMW,mBAAwC,GAAG,EAAE;EACnDd,IAAI,CAACe,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGd,eAAe,CAACa,KAAK,EAAEhB,SAAS,EAAEC,OAAO,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACA,OAAO,EAAEiB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/DnB,SAAS,CAACD,IAAI,CAAC,EACf;IACAG,OAAO,CAACe,IAAI,CAAClB,IAAI,CAAC;EACpB;;EAEA;EACAG,OAAO,CAACe,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOX,OAAO;AAChB"}
1
+ {"version":3,"file":"findAll.js","names":["_config","require","_accessiblity","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length"],"sources":["../../src/helpers/findAll.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessiblity';\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: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n) {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ??\n options?.hidden ??\n getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<ReactTestInstance>();\n return results.filter(\n (element) => !isHiddenFromAccessibility(element, { cache })\n );\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 root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): Array<ReactTestInstance> {\n const results: ReactTestInstance[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: ReactTestInstance[] = [];\n root.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n predicate(root)\n ) {\n results.push(root);\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":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAaO,SAASE,OAAOA,CACrBC,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACxB;EACA,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAC9BH,OAAO,EAAEI,MAAM,IACf,IAAAC,iBAAS,GAAE,EAAEC,4BAA4B;EAE3C,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,EAAqB;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAClBC,OAAO,IAAK,CAAC,IAAAC,uCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAC5D;AACH;;AAEA;AACA;AACA,SAASL,eAAeA,CACtBJ,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACE;EAC1B,MAAMC,OAA4B,GAAG,EAAE;;EAEvC;EACA,MAAMW,mBAAwC,GAAG,EAAE;EACnDd,IAAI,CAACe,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGd,eAAe,CAACa,KAAK,EAAEhB,SAAS,EAAEC,OAAO,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACA,OAAO,EAAEiB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/DnB,SAAS,CAACD,IAAI,CAAC,EACf;IACAG,OAAO,CAACe,IAAI,CAAClB,IAAI,CAAC;EACpB;;EAEA;EACAG,OAAO,CAACe,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOX,OAAO;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","names":["format","input","options","prettyFormat","plugins","getCustomPlugin","mapProps","ReactElement","highlight","test","val","ReactTestComponent","serialize","config","indentation","depth","refs","printer","newVal","props"],"sources":["../../src/helpers/format.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport prettyFormat, { NewPlugin, plugins } from 'pretty-format';\n\ntype MapPropsFunction = (\n props: Record<string, unknown>,\n node: ReactTestRendererJSON\n) => Record<string, unknown>;\n\nexport type FormatOptions = {\n mapProps?: MapPropsFunction;\n};\n\nconst format = (\n input: ReactTestRendererJSON | ReactTestRendererJSON[],\n options: FormatOptions = {}\n) =>\n prettyFormat(input, {\n plugins: [getCustomPlugin(options.mapProps), plugins.ReactElement],\n highlight: true,\n });\n\nconst getCustomPlugin = (mapProps?: MapPropsFunction): 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, val) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer\n );\n },\n };\n};\n\nexport default format;\n"],"mappings":";;;;;;AACA;AAAiE;AAAA;AAWjE,MAAMA,MAAM,GAAG,CACbC,KAAsD,EACtDC,OAAsB,GAAG,CAAC,CAAC,KAE3B,IAAAC,qBAAY,EAACF,KAAK,EAAE;EAClBG,OAAO,EAAE,CAACC,eAAe,CAACH,OAAO,CAACI,QAAQ,CAAC,EAAEF,qBAAO,CAACG,YAAY,CAAC;EAClEC,SAAS,EAAE;AACb,CAAC,CAAC;AAEJ,MAAMH,eAAe,GAAIC,QAA2B,IAAgB;EAClE,OAAO;IACLG,IAAI,EAAGC,GAAG,IAAKN,qBAAO,CAACO,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAAC;IACnDE,SAAS,EAAE,CAACF,GAAG,EAAEG,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,KAAK;MAC7D,IAAIC,MAAM,GAAGR,GAAG;MAChB,IAAIJ,QAAQ,IAAII,GAAG,CAACS,KAAK,EAAE;QACzBD,MAAM,GAAG;UAAE,GAAGR,GAAG;UAAES,KAAK,EAAEb,QAAQ,CAACI,GAAG,CAACS,KAAK,EAAET,GAAG;QAAE,CAAC;MACtD;MACA,OAAON,qBAAO,CAACO,kBAAkB,CAACC,SAAS,CACzCM,MAAM,EACNL,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,OAAO,CACR;IACH;EACF,CAAC;AACH,CAAC;AAAC,eAEajB,MAAM;AAAA"}
1
+ {"version":3,"file":"format.js","names":["_prettyFormat","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","format","input","options","prettyFormat","plugins","getCustomPlugin","mapProps","ReactElement","highlight","test","val","ReactTestComponent","serialize","config","indentation","depth","refs","printer","newVal","props","_default","exports"],"sources":["../../src/helpers/format.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport prettyFormat, { NewPlugin, plugins } from 'pretty-format';\n\ntype MapPropsFunction = (\n props: Record<string, unknown>,\n node: ReactTestRendererJSON\n) => Record<string, unknown>;\n\nexport type FormatOptions = {\n mapProps?: MapPropsFunction;\n};\n\nconst format = (\n input: ReactTestRendererJSON | ReactTestRendererJSON[],\n options: FormatOptions = {}\n) =>\n prettyFormat(input, {\n plugins: [getCustomPlugin(options.mapProps), plugins.ReactElement],\n highlight: true,\n });\n\nconst getCustomPlugin = (mapProps?: MapPropsFunction): 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, val) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer\n );\n },\n };\n};\n\nexport default format;\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiE,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAWjE,MAAMW,MAAM,GAAGA,CACbC,KAAsD,EACtDC,OAAsB,GAAG,CAAC,CAAC,KAE3B,IAAAC,qBAAY,EAACF,KAAK,EAAE;EAClBG,OAAO,EAAE,CAACC,eAAe,CAACH,OAAO,CAACI,QAAQ,CAAC,EAAEF,qBAAO,CAACG,YAAY,CAAC;EAClEC,SAAS,EAAE;AACb,CAAC,CAAC;AAEJ,MAAMH,eAAe,GAAIC,QAA2B,IAAgB;EAClE,OAAO;IACLG,IAAI,EAAGC,GAAG,IAAKN,qBAAO,CAACO,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAAC;IACnDE,SAAS,EAAEA,CAACF,GAAG,EAAEG,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,KAAK;MAC7D,IAAIC,MAAM,GAAGR,GAAG;MAChB,IAAIJ,QAAQ,IAAII,GAAG,CAACS,KAAK,EAAE;QACzBD,MAAM,GAAG;UAAE,GAAGR,GAAG;UAAES,KAAK,EAAEb,QAAQ,CAACI,GAAG,CAACS,KAAK,EAAET,GAAG;QAAE,CAAC;MACtD;MACA,OAAON,qBAAO,CAACO,kBAAkB,CAACC,SAAS,CACzCM,MAAM,EACNL,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,OAAO,CACR;IACH;EACF,CAAC;AACH,CAAC;AAAC,IAAAG,QAAA,GAEapB,MAAM;AAAAqB,OAAA,CAAApC,OAAA,GAAAmC,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getTextContent.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/getTextContent.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nexport function getTextContent(\n element: ReactTestInstance | string | null\n): 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,cAAc,CAC5BC,OAA0C,EAClC;EACR,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"}
1
+ {"version":3,"file":"getTextContent.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/getTextContent.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nexport function getTextContent(\n element: ReactTestInstance | string | null\n): 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,CAC5BC,OAA0C,EAClC;EACR,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"host-component-names.js","names":["userConfigErrorMessage","getHostComponentNames","hostComponentNames","getConfig","detectHostComponentNames","configureInternal","configureHostComponentNamesIfNeeded","configHostComponentNames","renderer","TestRenderer","create","getByTestId","getQueriesForElement","root","textHostName","type","textInputHostName","Error","text","textInput","error","errorMessage","message"],"sources":["../../src/helpers/host-component-names.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TextInput, View } from 'react-native';\nimport TestRenderer from 'react-test-renderer';\nimport { configureInternal, getConfig, HostComponentNames } from '../config';\nimport { getQueriesForElement } from '../within';\n\nconst userConfigErrorMessage = `There seems to be an issue with your configuration that prevents React Native Testing Library from working correctly.\nPlease check if you are using compatible versions of React Native and React Native Testing Library.`;\n\nexport function getHostComponentNames(): HostComponentNames {\n let hostComponentNames = getConfig().hostComponentNames;\n if (!hostComponentNames) {\n hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n }\n\n return hostComponentNames;\n}\n\nexport function configureHostComponentNamesIfNeeded() {\n const configHostComponentNames = getConfig().hostComponentNames;\n if (configHostComponentNames) {\n return;\n }\n\n const hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n}\n\nfunction detectHostComponentNames(): HostComponentNames {\n try {\n const renderer = TestRenderer.create(\n <View>\n <Text testID=\"text\">Hello</Text>\n <TextInput testID=\"textInput\" />\n </View>\n );\n\n const { getByTestId } = getQueriesForElement(renderer.root);\n const textHostName = getByTestId('text').type;\n const textInputHostName = getByTestId('textInput').type;\n\n // This code path should not happen as getByTestId always returns host elements.\n if (\n typeof textHostName !== 'string' ||\n typeof textInputHostName !== 'string'\n ) {\n throw new Error('getByTestId returned non-host component');\n }\n\n return {\n text: textHostName,\n textInput: textInputHostName,\n };\n } catch (error) {\n const errorMessage =\n error && typeof error === 'object' && 'message' in error\n ? error.message\n : null;\n\n throw new Error(\n `Trying to detect host component names triggered the following error:\\n\\n${errorMessage}\\n\\n${userConfigErrorMessage}`\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAiD;AAEjD,MAAMA,sBAAsB,GAAI;AAChC,oGAAoG;AAE7F,SAASC,qBAAqB,GAAuB;EAC1D,IAAIC,kBAAkB,GAAG,IAAAC,iBAAS,GAAE,CAACD,kBAAkB;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvBA,kBAAkB,GAAGE,wBAAwB,EAAE;IAC/C,IAAAC,yBAAiB,EAAC;MAAEH;IAAmB,CAAC,CAAC;EAC3C;EAEA,OAAOA,kBAAkB;AAC3B;AAEO,SAASI,mCAAmC,GAAG;EACpD,MAAMC,wBAAwB,GAAG,IAAAJ,iBAAS,GAAE,CAACD,kBAAkB;EAC/D,IAAIK,wBAAwB,EAAE;IAC5B;EACF;EAEA,MAAML,kBAAkB,GAAGE,wBAAwB,EAAE;EACrD,IAAAC,yBAAiB,EAAC;IAAEH;EAAmB,CAAC,CAAC;AAC3C;AAEA,SAASE,wBAAwB,GAAuB;EACtD,IAAI;IACF,MAAMI,QAAQ,GAAGC,0BAAY,CAACC,MAAM,eAClC,6BAAC,iBAAI,qBACH,6BAAC,iBAAI;MAAC,MAAM,EAAC;IAAM,GAAC,OAAK,CAAO,eAChC,6BAAC,sBAAS;MAAC,MAAM,EAAC;IAAW,EAAG,CAC3B,CACR;IAED,MAAM;MAAEC;IAAY,CAAC,GAAG,IAAAC,4BAAoB,EAACJ,QAAQ,CAACK,IAAI,CAAC;IAC3D,MAAMC,YAAY,GAAGH,WAAW,CAAC,MAAM,CAAC,CAACI,IAAI;IAC7C,MAAMC,iBAAiB,GAAGL,WAAW,CAAC,WAAW,CAAC,CAACI,IAAI;;IAEvD;IACA,IACE,OAAOD,YAAY,KAAK,QAAQ,IAChC,OAAOE,iBAAiB,KAAK,QAAQ,EACrC;MACA,MAAM,IAAIC,KAAK,CAAC,yCAAyC,CAAC;IAC5D;IAEA,OAAO;MACLC,IAAI,EAAEJ,YAAY;MAClBK,SAAS,EAAEH;IACb,CAAC;EACH,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,MAAMC,YAAY,GAChBD,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAIA,KAAK,GACpDA,KAAK,CAACE,OAAO,GACb,IAAI;IAEV,MAAM,IAAIL,KAAK,CACZ,2EAA0EI,YAAa,OAAMrB,sBAAuB,EAAC,CACvH;EACH;AACF"}
1
+ {"version":3,"file":"host-component-names.js","names":["_react","_interopRequireDefault","require","_reactNative","_reactTestRenderer","_config","_within","obj","__esModule","default","userConfigErrorMessage","getHostComponentNames","hostComponentNames","getConfig","detectHostComponentNames","configureInternal","configureHostComponentNamesIfNeeded","configHostComponentNames","renderer","TestRenderer","create","createElement","View","Text","testID","TextInput","getByTestId","getQueriesForElement","root","textHostName","type","textInputHostName","Error","text","textInput","error","errorMessage","message"],"sources":["../../src/helpers/host-component-names.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, TextInput, View } from 'react-native';\nimport TestRenderer from 'react-test-renderer';\nimport { configureInternal, getConfig, HostComponentNames } from '../config';\nimport { getQueriesForElement } from '../within';\n\nconst userConfigErrorMessage = `There seems to be an issue with your configuration that prevents React Native Testing Library from working correctly.\nPlease check if you are using compatible versions of React Native and React Native Testing Library.`;\n\nexport function getHostComponentNames(): HostComponentNames {\n let hostComponentNames = getConfig().hostComponentNames;\n if (!hostComponentNames) {\n hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n }\n\n return hostComponentNames;\n}\n\nexport function configureHostComponentNamesIfNeeded() {\n const configHostComponentNames = getConfig().hostComponentNames;\n if (configHostComponentNames) {\n return;\n }\n\n const hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n}\n\nfunction detectHostComponentNames(): HostComponentNames {\n try {\n const renderer = TestRenderer.create(\n <View>\n <Text testID=\"text\">Hello</Text>\n <TextInput testID=\"textInput\" />\n </View>\n );\n\n const { getByTestId } = getQueriesForElement(renderer.root);\n const textHostName = getByTestId('text').type;\n const textInputHostName = getByTestId('textInput').type;\n\n // This code path should not happen as getByTestId always returns host elements.\n if (\n typeof textHostName !== 'string' ||\n typeof textInputHostName !== 'string'\n ) {\n throw new Error('getByTestId returned non-host component');\n }\n\n return {\n text: textHostName,\n textInput: textInputHostName,\n };\n } catch (error) {\n const errorMessage =\n error && typeof error === 'object' && 'message' in error\n ? error.message\n : null;\n\n throw new Error(\n `Trying to detect host component names triggered the following error:\\n\\n${errorMessage}\\n\\n${userConfigErrorMessage}`\n );\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAiD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjD,MAAMG,sBAAsB,GAAI;AAChC,oGAAoG;AAE7F,SAASC,qBAAqBA,CAAA,EAAuB;EAC1D,IAAIC,kBAAkB,GAAG,IAAAC,iBAAS,GAAE,CAACD,kBAAkB;EACvD,IAAI,CAACA,kBAAkB,EAAE;IACvBA,kBAAkB,GAAGE,wBAAwB,EAAE;IAC/C,IAAAC,yBAAiB,EAAC;MAAEH;IAAmB,CAAC,CAAC;EAC3C;EAEA,OAAOA,kBAAkB;AAC3B;AAEO,SAASI,mCAAmCA,CAAA,EAAG;EACpD,MAAMC,wBAAwB,GAAG,IAAAJ,iBAAS,GAAE,CAACD,kBAAkB;EAC/D,IAAIK,wBAAwB,EAAE;IAC5B;EACF;EAEA,MAAML,kBAAkB,GAAGE,wBAAwB,EAAE;EACrD,IAAAC,yBAAiB,EAAC;IAAEH;EAAmB,CAAC,CAAC;AAC3C;AAEA,SAASE,wBAAwBA,CAAA,EAAuB;EACtD,IAAI;IACF,MAAMI,QAAQ,GAAGC,0BAAY,CAACC,MAAM,eAClCpB,MAAA,CAAAS,OAAA,CAAAY,aAAA,CAAClB,YAAA,CAAAmB,IAAI,qBACHtB,MAAA,CAAAS,OAAA,CAAAY,aAAA,CAAClB,YAAA,CAAAoB,IAAI;MAACC,MAAM,EAAC;IAAM,GAAC,OAAK,CAAO,eAChCxB,MAAA,CAAAS,OAAA,CAAAY,aAAA,CAAClB,YAAA,CAAAsB,SAAS;MAACD,MAAM,EAAC;IAAW,EAAG,CAC3B,CACR;IAED,MAAM;MAAEE;IAAY,CAAC,GAAG,IAAAC,4BAAoB,EAACT,QAAQ,CAACU,IAAI,CAAC;IAC3D,MAAMC,YAAY,GAAGH,WAAW,CAAC,MAAM,CAAC,CAACI,IAAI;IAC7C,MAAMC,iBAAiB,GAAGL,WAAW,CAAC,WAAW,CAAC,CAACI,IAAI;;IAEvD;IACA,IACE,OAAOD,YAAY,KAAK,QAAQ,IAChC,OAAOE,iBAAiB,KAAK,QAAQ,EACrC;MACA,MAAM,IAAIC,KAAK,CAAC,yCAAyC,CAAC;IAC5D;IAEA,OAAO;MACLC,IAAI,EAAEJ,YAAY;MAClBK,SAAS,EAAEH;IACb,CAAC;EACH,CAAC,CAAC,OAAOI,KAAK,EAAE;IACd,MAAMC,YAAY,GAChBD,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAIA,KAAK,GACpDA,KAAK,CAACE,OAAO,GACb,IAAI;IAEV,MAAM,IAAIL,KAAK,CACZ,2EAA0EI,YAAa,OAAM1B,sBAAuB,EAAC,CACvH;EACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"accessibilityState.js","names":["defaultState","disabled","selected","checked","undefined","busy","expanded","matchAccessibilityState","node","matcher","state","props","accessibilityState","accessibilityStateKeys","every","key","matchState"],"sources":["../../../src/helpers/matchers/accessibilityState.ts"],"sourcesContent":["import { AccessibilityState } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../accessiblity';\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\n/**\n * Default accessibility state values based on experiments using accessibility\n * inspector/screen reader on iOS and Android.\n *\n * @see https://github.com/callstack/react-native-testing-library/wiki/Accessibility:-State\n */\nconst defaultState: AccessibilityState = {\n disabled: false,\n selected: false,\n checked: undefined,\n busy: false,\n expanded: undefined,\n};\n\nexport function matchAccessibilityState(\n node: ReactTestInstance,\n matcher: AccessibilityStateMatcher\n) {\n const state = node.props.accessibilityState;\n return accessibilityStateKeys.every((key) => matchState(state, matcher, key));\n}\n\nfunction matchState(\n state: AccessibilityState,\n matcher: AccessibilityStateMatcher,\n key: keyof AccessibilityState\n) {\n return (\n matcher[key] === undefined ||\n matcher[key] === (state?.[key] ?? defaultState[key])\n );\n}\n"],"mappings":";;;;;;AAEA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,YAAgC,GAAG;EACvCC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,KAAK;EACfC,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,KAAK;EACXC,QAAQ,EAAEF;AACZ,CAAC;AAEM,SAASG,uBAAuB,CACrCC,IAAuB,EACvBC,OAAkC,EAClC;EACA,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAK,CAACC,kBAAkB;EAC3C,OAAOC,oCAAsB,CAACC,KAAK,CAAEC,GAAG,IAAKC,UAAU,CAACN,KAAK,EAAED,OAAO,EAAEM,GAAG,CAAC,CAAC;AAC/E;AAEA,SAASC,UAAU,CACjBN,KAAyB,EACzBD,OAAkC,EAClCM,GAA6B,EAC7B;EACA,OACEN,OAAO,CAACM,GAAG,CAAC,KAAKX,SAAS,IAC1BK,OAAO,CAACM,GAAG,CAAC,MAAML,KAAK,GAAGK,GAAG,CAAC,IAAIf,YAAY,CAACe,GAAG,CAAC,CAAC;AAExD"}
1
+ {"version":3,"file":"accessibilityState.js","names":["_accessiblity","require","defaultState","disabled","selected","checked","undefined","busy","expanded","matchAccessibilityState","node","matcher","state","props","accessibilityState","accessibilityStateKeys","every","key","matchState"],"sources":["../../../src/helpers/matchers/accessibilityState.ts"],"sourcesContent":["import { AccessibilityState } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../accessiblity';\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\n/**\n * Default accessibility state values based on experiments using accessibility\n * inspector/screen reader on iOS and Android.\n *\n * @see https://github.com/callstack/react-native-testing-library/wiki/Accessibility:-State\n */\nconst defaultState: AccessibilityState = {\n disabled: false,\n selected: false,\n checked: undefined,\n busy: false,\n expanded: undefined,\n};\n\nexport function matchAccessibilityState(\n node: ReactTestInstance,\n matcher: AccessibilityStateMatcher\n) {\n const state = node.props.accessibilityState;\n return accessibilityStateKeys.every((key) => matchState(state, matcher, key));\n}\n\nfunction matchState(\n state: AccessibilityState,\n matcher: AccessibilityStateMatcher,\n key: keyof AccessibilityState\n) {\n return (\n matcher[key] === undefined ||\n matcher[key] === (state?.[key] ?? defaultState[key])\n );\n}\n"],"mappings":";;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAgC,GAAG;EACvCC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,KAAK;EACfC,OAAO,EAAEC,SAAS;EAClBC,IAAI,EAAE,KAAK;EACXC,QAAQ,EAAEF;AACZ,CAAC;AAEM,SAASG,uBAAuBA,CACrCC,IAAuB,EACvBC,OAAkC,EAClC;EACA,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAK,CAACC,kBAAkB;EAC3C,OAAOC,oCAAsB,CAACC,KAAK,CAAEC,GAAG,IAAKC,UAAU,CAACN,KAAK,EAAED,OAAO,EAAEM,GAAG,CAAC,CAAC;AAC/E;AAEA,SAASC,UAAUA,CACjBN,KAAyB,EACzBD,OAAkC,EAClCM,GAA6B,EAC7B;EACA,OACEN,OAAO,CAACM,GAAG,CAAC,KAAKX,SAAS,IAC1BK,OAAO,CAACM,GAAG,CAAC,MAAML,KAAK,GAAGK,GAAG,CAAC,IAAIf,YAAY,CAACe,GAAG,CAAC,CAAC;AAExD"}
@@ -1 +1 @@
1
- {"version":3,"file":"accessibilityValue.js","names":["matchAccessibilityValue","node","matcher","value","props","accessibilityValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/accessibilityValue.ts"],"sourcesContent":["import { AccessibilityValue } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { TextMatch } from '../../matches';\nimport { matchStringProp } from './matchStringProp';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: ReactTestInstance,\n matcher: AccessibilityValueMatcher\n): boolean {\n const value: AccessibilityValue = node.props.accessibilityValue ?? {};\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;AASO,SAASA,uBAAuB,CACrCC,IAAuB,EACvBC,OAAkC,EACzB;EACT,MAAMC,KAAyB,GAAGF,IAAI,CAACG,KAAK,CAACC,kBAAkB,IAAI,CAAC,CAAC;EACrE,OACE,CAACH,OAAO,CAACI,GAAG,KAAKC,SAAS,IAAIL,OAAO,CAACI,GAAG,KAAKH,KAAK,CAACG,GAAG,MACtDJ,OAAO,CAACM,GAAG,KAAKD,SAAS,IAAIL,OAAO,CAACM,GAAG,KAAKL,KAAK,CAACK,GAAG,CAAC,KACvDN,OAAO,CAACO,GAAG,KAAKF,SAAS,IAAIL,OAAO,CAACO,GAAG,KAAKN,KAAK,CAACM,GAAG,CAAC,KACvDP,OAAO,CAACQ,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACR,KAAK,CAACO,IAAI,EAAER,OAAO,CAACQ,IAAI,CAAC,CAAC;AAE7E"}
1
+ {"version":3,"file":"accessibilityValue.js","names":["_matchStringProp","require","matchAccessibilityValue","node","matcher","value","props","accessibilityValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/accessibilityValue.ts"],"sourcesContent":["import { AccessibilityValue } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { TextMatch } from '../../matches';\nimport { matchStringProp } from './matchStringProp';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: ReactTestInstance,\n matcher: AccessibilityValueMatcher\n): boolean {\n const value: AccessibilityValue = node.props.accessibilityValue ?? {};\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,gBAAA,GAAAC,OAAA;AASO,SAASC,uBAAuBA,CACrCC,IAAuB,EACvBC,OAAkC,EACzB;EACT,MAAMC,KAAyB,GAAGF,IAAI,CAACG,KAAK,CAACC,kBAAkB,IAAI,CAAC,CAAC;EACrE,OACE,CAACH,OAAO,CAACI,GAAG,KAAKC,SAAS,IAAIL,OAAO,CAACI,GAAG,KAAKH,KAAK,CAACG,GAAG,MACtDJ,OAAO,CAACM,GAAG,KAAKD,SAAS,IAAIL,OAAO,CAACM,GAAG,KAAKL,KAAK,CAACK,GAAG,CAAC,KACvDN,OAAO,CAACO,GAAG,KAAKF,SAAS,IAAIL,OAAO,CAACO,GAAG,KAAKN,KAAK,CAACM,GAAG,CAAC,KACvDP,OAAO,CAACQ,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACR,KAAK,CAACO,IAAI,EAAER,OAAO,CAACQ,IAAI,CAAC,CAAC;AAE7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"matchArrayProp.js","names":["matchArrayProp","prop","matcher","length","includes","every","e"],"sources":["../../../src/helpers/matchers/matchArrayProp.ts"],"sourcesContent":["/**\n * Matches whether given array prop contains the given value, or all given values.\n *\n * @param prop - The array prop to match.\n * @param matcher - The value or values to be included in the array.\n * @returns Whether the array prop contains the given value, or all given values.\n */\nexport function matchArrayProp(\n prop: Array<string> | undefined,\n matcher: string | Array<string>\n): boolean {\n if (!prop || matcher.length === 0) {\n return false;\n }\n\n if (typeof matcher === 'string') {\n return prop.includes(matcher);\n }\n\n return matcher.every((e) => prop.includes(e));\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAc,CAC5BC,IAA+B,EAC/BC,OAA+B,EACtB;EACT,IAAI,CAACD,IAAI,IAAIC,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOD,IAAI,CAACG,QAAQ,CAACF,OAAO,CAAC;EAC/B;EAEA,OAAOA,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAKL,IAAI,CAACG,QAAQ,CAACE,CAAC,CAAC,CAAC;AAC/C"}
1
+ {"version":3,"file":"matchArrayProp.js","names":["matchArrayProp","prop","matcher","length","includes","every","e"],"sources":["../../../src/helpers/matchers/matchArrayProp.ts"],"sourcesContent":["/**\n * Matches whether given array prop contains the given value, or all given values.\n *\n * @param prop - The array prop to match.\n * @param matcher - The value or values to be included in the array.\n * @returns Whether the array prop contains the given value, or all given values.\n */\nexport function matchArrayProp(\n prop: Array<string> | undefined,\n matcher: string | Array<string>\n): boolean {\n if (!prop || matcher.length === 0) {\n return false;\n }\n\n if (typeof matcher === 'string') {\n return prop.includes(matcher);\n }\n\n return matcher.every((e) => prop.includes(e));\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,IAA+B,EAC/BC,OAA+B,EACtB;EACT,IAAI,CAACD,IAAI,IAAIC,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOD,IAAI,CAACG,QAAQ,CAACF,OAAO,CAAC;EAC/B;EAEA,OAAOA,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAKL,IAAI,CAACG,QAAQ,CAACE,CAAC,CAAC,CAAC;AAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"matchLabelText.js","names":["matchLabelText","root","element","text","options","matchAccessibilityLabel","matchAccessibilityLabelledBy","props","accessibilityLabelledBy","exact","normalizer","matches","accessibilityLabel","nativeId","findAll","node","type","nativeID","matchTextContent","length"],"sources":["../../../src/helpers/matchers/matchLabelText.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { findAll } from '../findAll';\nimport { matchTextContent } from './matchTextContent';\n\nexport function matchLabelText(\n root: ReactTestInstance,\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) {\n return (\n matchAccessibilityLabel(element, text, options) ||\n matchAccessibilityLabelledBy(\n root,\n element.props.accessibilityLabelledBy,\n text,\n options\n )\n );\n}\n\nfunction matchAccessibilityLabel(\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions\n) {\n const { exact, normalizer } = options;\n return matches(text, element.props.accessibilityLabel, normalizer, exact);\n}\n\nfunction matchAccessibilityLabelledBy(\n root: ReactTestInstance,\n nativeId: string | undefined,\n text: TextMatch,\n options: TextMatchOptions\n) {\n if (!nativeId) {\n return false;\n }\n\n return (\n findAll(\n root,\n (node) =>\n typeof node.type === 'string' &&\n node.props.nativeID === nativeId &&\n matchTextContent(node, text, options)\n ).length > 0\n );\n}\n"],"mappings":";;;;;;AACA;AACA;AACA;AAEO,SAASA,cAAc,CAC5BC,IAAuB,EACvBC,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,OACEC,uBAAuB,CAACH,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC,IAC/CE,4BAA4B,CAC1BL,IAAI,EACJC,OAAO,CAACK,KAAK,CAACC,uBAAuB,EACrCL,IAAI,EACJC,OAAO,CACR;AAEL;AAEA,SAASC,uBAAuB,CAC9BH,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,EACzB;EACA,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGN,OAAO;EACrC,OAAO,IAAAO,gBAAO,EAACR,IAAI,EAAED,OAAO,CAACK,KAAK,CAACK,kBAAkB,EAAEF,UAAU,EAAED,KAAK,CAAC;AAC3E;AAEA,SAASH,4BAA4B,CACnCL,IAAuB,EACvBY,QAA4B,EAC5BV,IAAe,EACfC,OAAyB,EACzB;EACA,IAAI,CAACS,QAAQ,EAAE;IACb,OAAO,KAAK;EACd;EAEA,OACE,IAAAC,gBAAO,EACLb,IAAI,EACHc,IAAI,IACH,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAC7BD,IAAI,CAACR,KAAK,CAACU,QAAQ,KAAKJ,QAAQ,IAChC,IAAAK,kCAAgB,EAACH,IAAI,EAAEZ,IAAI,EAAEC,OAAO,CAAC,CACxC,CAACe,MAAM,GAAG,CAAC;AAEhB"}
1
+ {"version":3,"file":"matchLabelText.js","names":["_matches","require","_findAll","_matchTextContent","matchLabelText","root","element","text","options","matchAccessibilityLabel","matchAccessibilityLabelledBy","props","accessibilityLabelledBy","exact","normalizer","matches","accessibilityLabel","nativeId","findAll","node","type","nativeID","matchTextContent","length"],"sources":["../../../src/helpers/matchers/matchLabelText.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { findAll } from '../findAll';\nimport { matchTextContent } from './matchTextContent';\n\nexport function matchLabelText(\n root: ReactTestInstance,\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) {\n return (\n matchAccessibilityLabel(element, text, options) ||\n matchAccessibilityLabelledBy(\n root,\n element.props.accessibilityLabelledBy,\n text,\n options\n )\n );\n}\n\nfunction matchAccessibilityLabel(\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions\n) {\n const { exact, normalizer } = options;\n return matches(text, element.props.accessibilityLabel, normalizer, exact);\n}\n\nfunction matchAccessibilityLabelledBy(\n root: ReactTestInstance,\n nativeId: string | undefined,\n text: TextMatch,\n options: TextMatchOptions\n) {\n if (!nativeId) {\n return false;\n }\n\n return (\n findAll(\n root,\n (node) =>\n typeof node.type === 'string' &&\n node.props.nativeID === nativeId &&\n matchTextContent(node, text, options)\n ).length > 0\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,SAASG,cAAcA,CAC5BC,IAAuB,EACvBC,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,OACEC,uBAAuB,CAACH,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC,IAC/CE,4BAA4B,CAC1BL,IAAI,EACJC,OAAO,CAACK,KAAK,CAACC,uBAAuB,EACrCL,IAAI,EACJC,OAAO,CACR;AAEL;AAEA,SAASC,uBAAuBA,CAC9BH,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,EACzB;EACA,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGN,OAAO;EACrC,OAAO,IAAAO,gBAAO,EAACR,IAAI,EAAED,OAAO,CAACK,KAAK,CAACK,kBAAkB,EAAEF,UAAU,EAAED,KAAK,CAAC;AAC3E;AAEA,SAASH,4BAA4BA,CACnCL,IAAuB,EACvBY,QAA4B,EAC5BV,IAAe,EACfC,OAAyB,EACzB;EACA,IAAI,CAACS,QAAQ,EAAE;IACb,OAAO,KAAK;EACd;EAEA,OACE,IAAAC,gBAAO,EACLb,IAAI,EACHc,IAAI,IACH,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAC7BD,IAAI,CAACR,KAAK,CAACU,QAAQ,KAAKJ,QAAQ,IAChC,IAAAK,kCAAgB,EAACH,IAAI,EAAEZ,IAAI,EAAEC,OAAO,CAAC,CACxC,CAACe,MAAM,GAAG,CAAC;AAEhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"matchObjectProp.js","names":["matchObjectProp","prop","matcher","Object","keys","length","every","key"],"sources":["../../../src/helpers/matchers/matchObjectProp.ts"],"sourcesContent":["/**\n * check that each key value pair of the objects match\n * BE CAREFUL it works only for 1 level deep key value pairs\n * won't work for nested objects\n */\n\n/**\n * Matches whether given object prop contains all key/value pairs.\n * @param prop - The object prop to match.\n * @param matcher - The key/value pairs to be included in the object.\n * @returns Whether the object prop contains all key/value pairs.\n */\nexport function matchObjectProp<T extends Record<string, unknown>>(\n prop: T | undefined,\n matcher: T\n): boolean {\n if (!prop || Object.keys(matcher).length === 0) {\n return false;\n }\n\n return (\n Object.keys(prop).length !== 0 &&\n Object.keys(matcher).every((key) => prop[key] === matcher[key])\n );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAe,CAC7BC,IAAmB,EACnBC,OAAU,EACD;EACT,IAAI,CAACD,IAAI,IAAIE,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE;IAC9C,OAAO,KAAK;EACd;EAEA,OACEF,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,MAAM,KAAK,CAAC,IAC9BF,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACI,KAAK,CAAEC,GAAG,IAAKN,IAAI,CAACM,GAAG,CAAC,KAAKL,OAAO,CAACK,GAAG,CAAC,CAAC;AAEnE"}
1
+ {"version":3,"file":"matchObjectProp.js","names":["matchObjectProp","prop","matcher","Object","keys","length","every","key"],"sources":["../../../src/helpers/matchers/matchObjectProp.ts"],"sourcesContent":["/**\n * check that each key value pair of the objects match\n * BE CAREFUL it works only for 1 level deep key value pairs\n * won't work for nested objects\n */\n\n/**\n * Matches whether given object prop contains all key/value pairs.\n * @param prop - The object prop to match.\n * @param matcher - The key/value pairs to be included in the object.\n * @returns Whether the object prop contains all key/value pairs.\n */\nexport function matchObjectProp<T extends Record<string, unknown>>(\n prop: T | undefined,\n matcher: T\n): boolean {\n if (!prop || Object.keys(matcher).length === 0) {\n return false;\n }\n\n return (\n Object.keys(prop).length !== 0 &&\n Object.keys(matcher).every((key) => prop[key] === matcher[key])\n );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAC7BC,IAAmB,EACnBC,OAAU,EACD;EACT,IAAI,CAACD,IAAI,IAAIE,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE;IAC9C,OAAO,KAAK;EACd;EAEA,OACEF,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,MAAM,KAAK,CAAC,IAC9BF,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACI,KAAK,CAAEC,GAAG,IAAKN,IAAI,CAACM,GAAG,CAAC,KAAKL,OAAO,CAACK,GAAG,CAAC,CAAC;AAEnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"matchStringProp.js","names":["matchStringProp","prop","matcher","match"],"sources":["../../../src/helpers/matchers/matchStringProp.ts"],"sourcesContent":["import { TextMatch } from '../../matches';\n\n/**\n * Matches the given string property again string or regex matcher.\n *\n * @param prop - The string prop to match.\n * @param matcher - The string or regex to match.\n * @returns - Whether the string prop matches the given string or regex.\n */\nexport function matchStringProp(\n prop: string | undefined,\n matcher: TextMatch\n): boolean {\n if (!prop) {\n return false;\n }\n\n if (typeof matcher === 'string') {\n return prop === matcher;\n }\n\n return prop.match(matcher) != null;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAe,CAC7BC,IAAwB,EACxBC,OAAkB,EACT;EACT,IAAI,CAACD,IAAI,EAAE;IACT,OAAO,KAAK;EACd;EAEA,IAAI,OAAOC,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOD,IAAI,KAAKC,OAAO;EACzB;EAEA,OAAOD,IAAI,CAACE,KAAK,CAACD,OAAO,CAAC,IAAI,IAAI;AACpC"}
1
+ {"version":3,"file":"matchStringProp.js","names":["matchStringProp","prop","matcher","match"],"sources":["../../../src/helpers/matchers/matchStringProp.ts"],"sourcesContent":["import { TextMatch } from '../../matches';\n\n/**\n * Matches the given string property again string or regex matcher.\n *\n * @param prop - The string prop to match.\n * @param matcher - The string or regex to match.\n * @returns - Whether the string prop matches the given string or regex.\n */\nexport function matchStringProp(\n prop: string | undefined,\n matcher: TextMatch\n): boolean {\n if (!prop) {\n return false;\n }\n\n if (typeof matcher === 'string') {\n return prop === matcher;\n }\n\n return prop.match(matcher) != null;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAC7BC,IAAwB,EACxBC,OAAkB,EACT;EACT,IAAI,CAACD,IAAI,EAAE;IACT,OAAO,KAAK;EACd;EAEA,IAAI,OAAOC,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOD,IAAI,KAAKC,OAAO;EACzB;EAEA,OAAOD,IAAI,CAACE,KAAK,CAACD,OAAO,CAAC,IAAI,IAAI;AACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"matchTextContent.js","names":["matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/matchTextContent.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { getTextContent } from '../getTextContent';\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: ReactTestInstance,\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":";;;;;;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAgB,CAC9BC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,MAAMC,WAAW,GAAG,IAAAC,8BAAc,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"}
1
+ {"version":3,"file":"matchTextContent.js","names":["_matches","require","_getTextContent","matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/matchTextContent.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { getTextContent } from '../getTextContent';\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: ReactTestInstance,\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":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAC9BC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,MAAMC,WAAW,GAAG,IAAAC,8BAAc,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-name.js","names":["getQueryPrefix","queryName","parts","split"],"sources":["../../src/helpers/query-name.ts"],"sourcesContent":["export function getQueryPrefix(queryName: string) {\n const parts = queryName.split('By');\n return parts[0];\n}\n"],"mappings":";;;;;;AAAO,SAASA,cAAc,CAACC,SAAiB,EAAE;EAChD,MAAMC,KAAK,GAAGD,SAAS,CAACE,KAAK,CAAC,IAAI,CAAC;EACnC,OAAOD,KAAK,CAAC,CAAC,CAAC;AACjB"}
1
+ {"version":3,"file":"query-name.js","names":["getQueryPrefix","queryName","parts","split"],"sources":["../../src/helpers/query-name.ts"],"sourcesContent":["export function getQueryPrefix(queryName: string) {\n const parts = queryName.split('By');\n return parts[0];\n}\n"],"mappings":";;;;;;AAAO,SAASA,cAAcA,CAACC,SAAiB,EAAE;EAChD,MAAMC,KAAK,GAAGD,SAAS,CAACE,KAAK,CAAC,IAAI,CAAC;EACnC,OAAOD,KAAK,CAAC,CAAC,CAAC;AACjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"stringValidation.js","names":["validateStringsRenderedWithinText","rendererJSON","Array","isArray","forEach","validateStringsRenderedWithinTextForNode","node","type","children","child","Error"],"sources":["../../src/helpers/stringValidation.ts"],"sourcesContent":["import { ReactTestRendererNode } from 'react-test-renderer';\n\nexport const validateStringsRenderedWithinText = (\n rendererJSON: ReactTestRendererNode | Array<ReactTestRendererNode> | null\n) => {\n if (!rendererJSON) return;\n\n if (Array.isArray(rendererJSON)) {\n rendererJSON.forEach(validateStringsRenderedWithinTextForNode);\n return;\n }\n\n return validateStringsRenderedWithinTextForNode(rendererJSON);\n};\n\nconst validateStringsRenderedWithinTextForNode = (\n node: ReactTestRendererNode\n) => {\n if (typeof node === 'string') {\n return;\n }\n\n if (node.type !== 'Text') {\n node.children?.forEach((child) => {\n if (typeof child === 'string') {\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render \"${child}\" string within a <${node.type}> component.`\n );\n }\n });\n }\n\n if (node.children) {\n node.children.forEach(validateStringsRenderedWithinTextForNode);\n }\n};\n"],"mappings":";;;;;;AAEO,MAAMA,iCAAiC,GAC5CC,YAAyE,IACtE;EACH,IAAI,CAACA,YAAY,EAAE;EAEnB,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACG,OAAO,CAACC,wCAAwC,CAAC;IAC9D;EACF;EAEA,OAAOA,wCAAwC,CAACJ,YAAY,CAAC;AAC/D,CAAC;AAAC;AAEF,MAAMI,wCAAwC,GAC5CC,IAA2B,IACxB;EACH,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B;EACF;EAEA,IAAIA,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;IACxBD,IAAI,CAACE,QAAQ,EAAEJ,OAAO,CAAEK,KAAK,IAAK;MAChC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAIC,KAAK,CACZ,6GAA4GD,KAAM,sBAAqBH,IAAI,CAACC,IAAK,cAAa,CAChK;MACH;IACF,CAAC,CAAC;EACJ;EAEA,IAAID,IAAI,CAACE,QAAQ,EAAE;IACjBF,IAAI,CAACE,QAAQ,CAACJ,OAAO,CAACC,wCAAwC,CAAC;EACjE;AACF,CAAC"}
1
+ {"version":3,"file":"stringValidation.js","names":["validateStringsRenderedWithinText","rendererJSON","Array","isArray","forEach","validateStringsRenderedWithinTextForNode","exports","node","type","children","child","Error"],"sources":["../../src/helpers/stringValidation.ts"],"sourcesContent":["import { ReactTestRendererNode } from 'react-test-renderer';\n\nexport const validateStringsRenderedWithinText = (\n rendererJSON: ReactTestRendererNode | Array<ReactTestRendererNode> | null\n) => {\n if (!rendererJSON) return;\n\n if (Array.isArray(rendererJSON)) {\n rendererJSON.forEach(validateStringsRenderedWithinTextForNode);\n return;\n }\n\n return validateStringsRenderedWithinTextForNode(rendererJSON);\n};\n\nconst validateStringsRenderedWithinTextForNode = (\n node: ReactTestRendererNode\n) => {\n if (typeof node === 'string') {\n return;\n }\n\n if (node.type !== 'Text') {\n node.children?.forEach((child) => {\n if (typeof child === 'string') {\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render \"${child}\" string within a <${node.type}> component.`\n );\n }\n });\n }\n\n if (node.children) {\n node.children.forEach(validateStringsRenderedWithinTextForNode);\n }\n};\n"],"mappings":";;;;;;AAEO,MAAMA,iCAAiC,GAC5CC,YAAyE,IACtE;EACH,IAAI,CAACA,YAAY,EAAE;EAEnB,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACG,OAAO,CAACC,wCAAwC,CAAC;IAC9D;EACF;EAEA,OAAOA,wCAAwC,CAACJ,YAAY,CAAC;AAC/D,CAAC;AAACK,OAAA,CAAAN,iCAAA,GAAAA,iCAAA;AAEF,MAAMK,wCAAwC,GAC5CE,IAA2B,IACxB;EACH,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B;EACF;EAEA,IAAIA,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;IACxBD,IAAI,CAACE,QAAQ,EAAEL,OAAO,CAAEM,KAAK,IAAK;MAChC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAIC,KAAK,CACZ,6GAA4GD,KAAM,sBAAqBH,IAAI,CAACC,IAAK,cAAa,CAChK;MACH;IACF,CAAC,CAAC;EACJ;EAEA,IAAID,IAAI,CAACE,QAAQ,EAAE;IACjBF,IAAI,CAACE,QAAQ,CAACL,OAAO,CAACC,wCAAwC,CAAC;EACjE;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"timers.js","names":["globalObj","window","global","runWithRealTimers","callback","fakeTimersType","getJestFakeTimersType","jest","useRealTimers","callbackReturnValue","fakeTimersConfig","getFakeTimersConfigFromType","useFakeTimers","setTimeout","process","env","RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS","_isMockFunction","clock","getRealSystemTime","type","legacyFakeTimers","jestFakeTimersAreEnabled","Boolean","setImmediatePolyfill","fn","bindTimeFunctions","clearTimeoutFn","clearTimeout","setImmediateFn","setImmediate","setTimeoutFn"],"sources":["../../src/helpers/timers.ts"],"sourcesContent":["// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/main/src/helpers.js\n/* globals jest */\nconst globalObj = typeof window === 'undefined' ? global : window;\n\ntype FakeTimersTypes = 'modern' | 'legacy';\n\n// Currently this fn only supports jest timers, but it could support other test runners in the future.\nfunction runWithRealTimers<T>(callback: () => T): T {\n const fakeTimersType = getJestFakeTimersType();\n if (fakeTimersType) {\n jest.useRealTimers();\n }\n\n const callbackReturnValue = callback();\n\n if (fakeTimersType) {\n const fakeTimersConfig = getFakeTimersConfigFromType(fakeTimersType);\n jest.useFakeTimers(fakeTimersConfig);\n }\n\n return callbackReturnValue;\n}\n\nfunction getJestFakeTimersType(): FakeTimersTypes | null {\n // istanbul ignore if\n if (\n typeof jest === 'undefined' ||\n typeof globalObj.setTimeout === 'undefined' ||\n process.env.RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS\n ) {\n return null;\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout._isMockFunction !== 'undefined' &&\n // @ts-expect-error jest mutates setTimeout\n globalObj.setTimeout._isMockFunction\n ) {\n return 'legacy';\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout.clock !== 'undefined' &&\n typeof jest.getRealSystemTime !== 'undefined'\n ) {\n try {\n // jest.getRealSystemTime is only supported for Jest's `modern` fake timers and otherwise throws\n jest.getRealSystemTime();\n return 'modern';\n } catch {\n // not using Jest's modern fake timers\n }\n }\n\n return null;\n}\n\nfunction getFakeTimersConfigFromType(type: FakeTimersTypes) {\n return type === 'legacy'\n ? { legacyFakeTimers: true }\n : { legacyFakeTimers: false };\n}\n\nconst jestFakeTimersAreEnabled = (): boolean =>\n Boolean(getJestFakeTimersType());\n\n// we only run our tests in node, and setImmediate is supported in node.\nfunction setImmediatePolyfill(fn: Function) {\n return globalObj.setTimeout(fn, 0);\n}\n\ntype BindTimeFunctions = {\n clearTimeoutFn: typeof clearTimeout;\n setImmediateFn: typeof setImmediate;\n setTimeoutFn: typeof setTimeout;\n};\n\nfunction bindTimeFunctions(): BindTimeFunctions {\n return {\n clearTimeoutFn: globalObj.clearTimeout,\n setImmediateFn: globalObj.setImmediate || setImmediatePolyfill,\n setTimeoutFn: globalObj.setTimeout,\n };\n}\n\nconst { clearTimeoutFn, setImmediateFn, setTimeoutFn } = runWithRealTimers(\n bindTimeFunctions\n) as BindTimeFunctions;\n\nexport {\n runWithRealTimers,\n jestFakeTimersAreEnabled,\n clearTimeoutFn as clearTimeout,\n setImmediateFn as setImmediate,\n setTimeoutFn as setTimeout,\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA,MAAMA,SAAS,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AACA,SAASkB,oBAAoB,CAACC,EAAY,EAAE;EAC1C,OAAOzB,SAAS,CAACa,UAAU,CAACY,EAAE,EAAE,CAAC,CAAC;AACpC;AAQA,SAASC,iBAAiB,GAAsB;EAC9C,OAAO;IACLC,cAAc,EAAE3B,SAAS,CAAC4B,YAAY;IACtCC,cAAc,EAAE7B,SAAS,CAAC8B,YAAY,IAAIN,oBAAoB;IAC9DO,YAAY,EAAE/B,SAAS,CAACa;EAC1B,CAAC;AACH;AAEA,MAAM;EAAEc,cAAc;EAAEE,cAAc;EAAEE;AAAa,CAAC,GAAG5B,iBAAiB,CACxEuB,iBAAiB,CACG;AAAC;AAAA;AAAA"}
1
+ {"version":3,"file":"timers.js","names":["globalObj","window","global","runWithRealTimers","callback","fakeTimersType","getJestFakeTimersType","jest","useRealTimers","callbackReturnValue","fakeTimersConfig","getFakeTimersConfigFromType","useFakeTimers","setTimeout","process","env","RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS","_isMockFunction","clock","getRealSystemTime","type","legacyFakeTimers","jestFakeTimersAreEnabled","Boolean","exports","setImmediatePolyfill","fn","bindTimeFunctions","clearTimeoutFn","clearTimeout","setImmediateFn","setImmediate","setTimeoutFn"],"sources":["../../src/helpers/timers.ts"],"sourcesContent":["// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/main/src/helpers.js\n/* globals jest */\nconst globalObj = typeof window === 'undefined' ? global : window;\n\ntype FakeTimersTypes = 'modern' | 'legacy';\n\n// Currently this fn only supports jest timers, but it could support other test runners in the future.\nfunction runWithRealTimers<T>(callback: () => T): T {\n const fakeTimersType = getJestFakeTimersType();\n if (fakeTimersType) {\n jest.useRealTimers();\n }\n\n const callbackReturnValue = callback();\n\n if (fakeTimersType) {\n const fakeTimersConfig = getFakeTimersConfigFromType(fakeTimersType);\n jest.useFakeTimers(fakeTimersConfig);\n }\n\n return callbackReturnValue;\n}\n\nfunction getJestFakeTimersType(): FakeTimersTypes | null {\n // istanbul ignore if\n if (\n typeof jest === 'undefined' ||\n typeof globalObj.setTimeout === 'undefined' ||\n process.env.RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS\n ) {\n return null;\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout._isMockFunction !== 'undefined' &&\n // @ts-expect-error jest mutates setTimeout\n globalObj.setTimeout._isMockFunction\n ) {\n return 'legacy';\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout.clock !== 'undefined' &&\n typeof jest.getRealSystemTime !== 'undefined'\n ) {\n try {\n // jest.getRealSystemTime is only supported for Jest's `modern` fake timers and otherwise throws\n jest.getRealSystemTime();\n return 'modern';\n } catch {\n // not using Jest's modern fake timers\n }\n }\n\n return null;\n}\n\nfunction getFakeTimersConfigFromType(type: FakeTimersTypes) {\n return type === 'legacy'\n ? { legacyFakeTimers: true }\n : { legacyFakeTimers: false };\n}\n\nconst jestFakeTimersAreEnabled = (): boolean =>\n Boolean(getJestFakeTimersType());\n\n// we only run our tests in node, and setImmediate is supported in node.\nfunction setImmediatePolyfill(fn: Function) {\n return globalObj.setTimeout(fn, 0);\n}\n\ntype BindTimeFunctions = {\n clearTimeoutFn: typeof clearTimeout;\n setImmediateFn: typeof setImmediate;\n setTimeoutFn: typeof setTimeout;\n};\n\nfunction bindTimeFunctions(): BindTimeFunctions {\n return {\n clearTimeoutFn: globalObj.clearTimeout,\n setImmediateFn: globalObj.setImmediate || setImmediatePolyfill,\n setTimeoutFn: globalObj.setTimeout,\n };\n}\n\nconst { clearTimeoutFn, setImmediateFn, setTimeoutFn } = runWithRealTimers(\n bindTimeFunctions\n) as BindTimeFunctions;\n\nexport {\n runWithRealTimers,\n jestFakeTimersAreEnabled,\n clearTimeoutFn as clearTimeout,\n setImmediateFn as setImmediate,\n setTimeoutFn as setTimeout,\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA,MAAMA,SAAS,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGC,MAAM,GAAGD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AA;AACA,SAASG,oBAAoBA,CAACC,EAAY,EAAE;EAC1C,OAAO1B,SAAS,CAACa,UAAU,CAACa,EAAE,EAAE,CAAC,CAAC;AACpC;AAQA,SAASC,iBAAiBA,CAAA,EAAsB;EAC9C,OAAO;IACLC,cAAc,EAAE5B,SAAS,CAAC6B,YAAY;IACtCC,cAAc,EAAE9B,SAAS,CAAC+B,YAAY,IAAIN,oBAAoB;IAC9DO,YAAY,EAAEhC,SAAS,CAACa;EAC1B,CAAC;AACH;AAEA,MAAM;EAAEe,cAAc;EAAEE,cAAc;EAAEE;AAAa,CAAC,GAAG7B,iBAAiB,CACxEwB,iBAAiB,CACG;AAACH,OAAA,CAAAX,UAAA,GAAAmB,YAAA;AAAAR,OAAA,CAAAO,YAAA,GAAAD,cAAA;AAAAN,OAAA,CAAAK,YAAA,GAAAD,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import { cleanup } from './pure';\nimport { flushMicroTasks } from './flushMicroTasks';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\n\nif (typeof process === 'undefined' || !process.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n // eslint-disable-next-line no-undef\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;AAAA;AAgCA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AA/BA;AACA;AAEA,IAAI,OAAOA,OAAO,KAAK,WAAW,IAAI,CAACA,OAAO,CAACC,GAAG,EAAEC,sBAAsB,EAAE;EAC1E;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnC;IACAA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,GAAE;MACvB,IAAAC,aAAO,GAAE;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,GAAE;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,GAAE;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF"}
1
+ {"version":3,"file":"index.js","names":["_pure","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_flushMicroTasks","_act","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import { cleanup } from './pure';\nimport { flushMicroTasks } from './flushMicroTasks';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\n\nif (typeof process === 'undefined' || !process.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n // eslint-disable-next-line no-undef\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAgCAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AA/BA,IAAAK,gBAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AAEA,IAAI,OAAOW,OAAO,KAAK,WAAW,IAAI,CAACA,OAAO,CAACC,GAAG,EAAEC,sBAAsB,EAAE;EAC1E;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnC;IACAA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,GAAE;MACvB,IAAAC,aAAO,GAAE;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,GAAE;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,GAAE;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"matches.js","names":["matches","matcher","text","normalizer","getDefaultNormalizer","exact","normalizedText","normalizedMatcher","toLowerCase","includes","lastIndex","test","trim","collapseWhitespace","replace"],"sources":["../src/matches.ts"],"sourcesContent":["export type NormalizerFn = (textToNormalize: string) => string;\n\nexport type TextMatch = string | RegExp;\nexport type TextMatchOptions = {\n exact?: boolean;\n normalizer?: NormalizerFn;\n};\n\nexport function matches(\n matcher: TextMatch,\n text: string,\n normalizer: NormalizerFn = getDefaultNormalizer(),\n exact: boolean = true\n): boolean {\n if (typeof text !== 'string') {\n return false;\n }\n\n const normalizedText = normalizer(text);\n if (typeof matcher === 'string') {\n const normalizedMatcher = normalizer(matcher);\n return exact\n ? normalizedText === normalizedMatcher\n : normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());\n } else {\n // Reset state for global regexes: https://stackoverflow.com/a/1520839/484499\n matcher.lastIndex = 0;\n return matcher.test(normalizedText);\n }\n}\n\ntype NormalizerConfig = {\n trim?: boolean;\n collapseWhitespace?: boolean;\n};\n\nexport function getDefaultNormalizer({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerConfig = {}): NormalizerFn {\n return (text: string) => {\n let normalizedText = text;\n normalizedText = trim ? normalizedText.trim() : normalizedText;\n normalizedText = collapseWhitespace\n ? normalizedText.replace(/\\s+/g, ' ')\n : normalizedText;\n return normalizedText;\n };\n}\n"],"mappings":";;;;;;;AAQO,SAASA,OAAO,CACrBC,OAAkB,EAClBC,IAAY,EACZC,UAAwB,GAAGC,oBAAoB,EAAE,EACjDC,KAAc,GAAG,IAAI,EACZ;EACT,IAAI,OAAOH,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,KAAK;EACd;EAEA,MAAMI,cAAc,GAAGH,UAAU,CAACD,IAAI,CAAC;EACvC,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAMM,iBAAiB,GAAGJ,UAAU,CAACF,OAAO,CAAC;IAC7C,OAAOI,KAAK,GACRC,cAAc,KAAKC,iBAAiB,GACpCD,cAAc,CAACE,WAAW,EAAE,CAACC,QAAQ,CAACF,iBAAiB,CAACC,WAAW,EAAE,CAAC;EAC5E,CAAC,MAAM;IACL;IACAP,OAAO,CAACS,SAAS,GAAG,CAAC;IACrB,OAAOT,OAAO,CAACU,IAAI,CAACL,cAAc,CAAC;EACrC;AACF;AAOO,SAASF,oBAAoB,CAAC;EACnCQ,IAAI,GAAG,IAAI;EACXC,kBAAkB,GAAG;AACL,CAAC,GAAG,CAAC,CAAC,EAAgB;EACtC,OAAQX,IAAY,IAAK;IACvB,IAAII,cAAc,GAAGJ,IAAI;IACzBI,cAAc,GAAGM,IAAI,GAAGN,cAAc,CAACM,IAAI,EAAE,GAAGN,cAAc;IAC9DA,cAAc,GAAGO,kBAAkB,GAC/BP,cAAc,CAACQ,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,GACnCR,cAAc;IAClB,OAAOA,cAAc;EACvB,CAAC;AACH"}
1
+ {"version":3,"file":"matches.js","names":["matches","matcher","text","normalizer","getDefaultNormalizer","exact","normalizedText","normalizedMatcher","toLowerCase","includes","lastIndex","test","trim","collapseWhitespace","replace"],"sources":["../src/matches.ts"],"sourcesContent":["export type NormalizerFn = (textToNormalize: string) => string;\n\nexport type TextMatch = string | RegExp;\nexport type TextMatchOptions = {\n exact?: boolean;\n normalizer?: NormalizerFn;\n};\n\nexport function matches(\n matcher: TextMatch,\n text: string,\n normalizer: NormalizerFn = getDefaultNormalizer(),\n exact: boolean = true\n): boolean {\n if (typeof text !== 'string') {\n return false;\n }\n\n const normalizedText = normalizer(text);\n if (typeof matcher === 'string') {\n const normalizedMatcher = normalizer(matcher);\n return exact\n ? normalizedText === normalizedMatcher\n : normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());\n } else {\n // Reset state for global regexes: https://stackoverflow.com/a/1520839/484499\n matcher.lastIndex = 0;\n return matcher.test(normalizedText);\n }\n}\n\ntype NormalizerConfig = {\n trim?: boolean;\n collapseWhitespace?: boolean;\n};\n\nexport function getDefaultNormalizer({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerConfig = {}): NormalizerFn {\n return (text: string) => {\n let normalizedText = text;\n normalizedText = trim ? normalizedText.trim() : normalizedText;\n normalizedText = collapseWhitespace\n ? normalizedText.replace(/\\s+/g, ' ')\n : normalizedText;\n return normalizedText;\n };\n}\n"],"mappings":";;;;;;;AAQO,SAASA,OAAOA,CACrBC,OAAkB,EAClBC,IAAY,EACZC,UAAwB,GAAGC,oBAAoB,EAAE,EACjDC,KAAc,GAAG,IAAI,EACZ;EACT,IAAI,OAAOH,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,KAAK;EACd;EAEA,MAAMI,cAAc,GAAGH,UAAU,CAACD,IAAI,CAAC;EACvC,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAMM,iBAAiB,GAAGJ,UAAU,CAACF,OAAO,CAAC;IAC7C,OAAOI,KAAK,GACRC,cAAc,KAAKC,iBAAiB,GACpCD,cAAc,CAACE,WAAW,EAAE,CAACC,QAAQ,CAACF,iBAAiB,CAACC,WAAW,EAAE,CAAC;EAC5E,CAAC,MAAM;IACL;IACAP,OAAO,CAACS,SAAS,GAAG,CAAC;IACrB,OAAOT,OAAO,CAACU,IAAI,CAACL,cAAc,CAAC;EACrC;AACF;AAOO,SAASF,oBAAoBA,CAAC;EACnCQ,IAAI,GAAG,IAAI;EACXC,kBAAkB,GAAG;AACL,CAAC,GAAG,CAAC,CAAC,EAAgB;EACtC,OAAQX,IAAY,IAAK;IACvB,IAAII,cAAc,GAAGJ,IAAI;IACzBI,cAAc,GAAGM,IAAI,GAAGN,cAAc,CAACM,IAAI,EAAE,GAAGN,cAAc;IAC9DA,cAAc,GAAGO,kBAAkB,GAC/BP,cAAc,CAACQ,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,GACnCR,cAAc;IAClB,OAAOA,cAAc;EACvB,CAAC;AACH"}
package/build/pure.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pure.js","names":[],"sources":["../src/pure.ts"],"sourcesContent":["export { default as act } from './act';\nexport { default as cleanup } from './cleanup';\nexport { default as fireEvent } from './fireEvent';\nexport { default as render } from './render';\nexport { default as waitFor } from './waitFor';\nexport { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';\nexport { within, getQueriesForElement } from './within';\n\nexport { configure, resetToDefaults } from './config';\nexport {\n isHiddenFromAccessibility,\n isInaccessible,\n} from './helpers/accessiblity';\nexport { getDefaultNormalizer } from './matches';\nexport { renderHook } from './renderHook';\nexport { screen } from './screen';\n\nexport type {\n RenderOptions,\n RenderResult,\n RenderResult as RenderAPI,\n} from './render';\nexport type { RenderHookOptions, RenderHookResult } from './renderHook';\nexport type { Config } from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAIA;AACA;AACA;AAAkC"}
1
+ {"version":3,"file":"pure.js","names":["_act","_interopRequireDefault","require","_cleanup","_fireEvent","_render","_waitFor","_waitForElementToBeRemoved","_within","_config","_accessiblity","_matches","_renderHook","_screen","obj","__esModule","default"],"sources":["../src/pure.ts"],"sourcesContent":["export { default as act } from './act';\nexport { default as cleanup } from './cleanup';\nexport { default as fireEvent } from './fireEvent';\nexport { default as render } from './render';\nexport { default as waitFor } from './waitFor';\nexport { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';\nexport { within, getQueriesForElement } from './within';\n\nexport { configure, resetToDefaults } from './config';\nexport {\n isHiddenFromAccessibility,\n isInaccessible,\n} from './helpers/accessiblity';\nexport { getDefaultNormalizer } from './matches';\nexport { renderHook } from './renderHook';\nexport { screen } from './screen';\n\nexport type {\n RenderOptions,\n RenderResult,\n RenderResult as RenderAPI,\n} from './render';\nexport type { RenderHookOptions, RenderHookResult } from './renderHook';\nexport type { Config } from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,0BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AAIA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAAkC,SAAAD,uBAAAa,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"a11yState.js","names":["queryAllByA11yState","instance","queryAllByA11yStateFn","matcher","queryOptions","findAll","node","type","matchAccessibilityState","buildErrorMessage","state","errors","accessibilityStateKeys","forEach","stateKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yStateQueries","getByA11yState","getAllByA11yState","queryByA11yState","findByA11yState","findAllByA11yState","deprecateQueries","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState"],"sources":["../../src/queries/a11yState.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yState = (\n instance: ReactTestInstance\n): ((\n matcher: AccessibilityStateMatcher,\n queryOptions?: CommonQueryOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByA11yStateFn(matcher, queryOptions) {\n return findAll(\n instance,\n (node) =>\n typeof node.type === 'string' && matchAccessibilityState(node, matcher),\n queryOptions\n );\n };\n\nconst buildErrorMessage = (state: AccessibilityStateMatcher = {}) => {\n const errors: string[] = [];\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (state[stateKey] !== undefined) {\n errors.push(`${stateKey} state: ${state[stateKey]}`);\n }\n });\n\n return errors.join(', ');\n};\n\nconst getMultipleError = (state: AccessibilityStateMatcher) =>\n `Found multiple elements with ${buildErrorMessage(state)}`;\n\nconst getMissingError = (state: AccessibilityStateMatcher) =>\n `Unable to find an element with ${buildErrorMessage(state)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yState,\n getMissingError,\n getMultipleError\n);\n\nexport type ByA11yStateQueries = {\n getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n getAllByA11yState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByA11yState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryAllByA11yState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByA11yState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findAllByA11yState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n\n getByAccessibilityState: GetByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n getAllByAccessibilityState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByAccessibilityState: QueryByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryAllByAccessibilityState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByAccessibilityState: FindByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findAllByAccessibilityState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n};\n\nexport const bindByA11yStateQueries = (\n instance: ReactTestInstance\n): ByA11yStateQueries => {\n const getByA11yState = getBy(instance);\n const getAllByA11yState = getAllBy(instance);\n const queryByA11yState = queryBy(instance);\n const queryAllByA11yState = queryAllBy(instance);\n const findByA11yState = findBy(instance);\n const findAllByA11yState = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yState,\n getAllByA11yState,\n queryByA11yState,\n queryAllByA11yState,\n findByA11yState,\n findAllByA11yState,\n getByAccessibilityState: getByA11yState,\n getAllByAccessibilityState: getAllByA11yState,\n queryByAccessibilityState: queryByA11yState,\n queryAllByAccessibilityState: queryAllByA11yState,\n findByAccessibilityState: findByA11yState,\n findAllByAccessibilityState: findAllByA11yState,\n },\n 'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher from \"@testing-library/jest-native\" package instead.'\n ),\n };\n};\n"],"mappings":";;;;;;AACA;AACA;AACA;AACA;AAIA;AAWA,MAAMA,mBAAmB,GACvBC,QAA2B,IAK3B,SAASC,qBAAqB,CAACC,OAAO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B,QAAQ,CAAC;EACxC,MAAM+B,kBAAkB,GAAGP,SAAS,CAACxB,QAAQ,CAAC;EAE9C,OAAO;IACL,GAAG,IAAAgC,6BAAgB,EACjB;MACEL,cAAc;MACdC,iBAAiB;MACjBC,gBAAgB;MAChB9B,mBAAmB;MACnB+B,eAAe;MACfC,kBAAkB;MAClBE,uBAAuB,EAAEN,cAAc;MACvCO,0BAA0B,EAAEN,iBAAiB;MAC7CO,yBAAyB,EAAEN,gBAAgB;MAC3CO,4BAA4B,EAAErC,mBAAmB;MACjDsC,wBAAwB,EAAEP,eAAe;MACzCQ,2BAA2B,EAAEP;IAC/B,CAAC,EACD,gMAAgM;EAEpM,CAAC;AACH,CAAC;AAAC"}
1
+ {"version":3,"file":"a11yState.js","names":["_accessiblity","require","_deprecation","_findAll","_accessibilityState","_makeQueries","queryAllByA11yState","instance","queryAllByA11yStateFn","matcher","queryOptions","findAll","node","type","matchAccessibilityState","buildErrorMessage","state","errors","accessibilityStateKeys","forEach","stateKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yStateQueries","getByA11yState","getAllByA11yState","queryByA11yState","findByA11yState","findAllByA11yState","deprecateQueries","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState","exports"],"sources":["../../src/queries/a11yState.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yState = (\n instance: ReactTestInstance\n): ((\n matcher: AccessibilityStateMatcher,\n queryOptions?: CommonQueryOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByA11yStateFn(matcher, queryOptions) {\n return findAll(\n instance,\n (node) =>\n typeof node.type === 'string' && matchAccessibilityState(node, matcher),\n queryOptions\n );\n };\n\nconst buildErrorMessage = (state: AccessibilityStateMatcher = {}) => {\n const errors: string[] = [];\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (state[stateKey] !== undefined) {\n errors.push(`${stateKey} state: ${state[stateKey]}`);\n }\n });\n\n return errors.join(', ');\n};\n\nconst getMultipleError = (state: AccessibilityStateMatcher) =>\n `Found multiple elements with ${buildErrorMessage(state)}`;\n\nconst getMissingError = (state: AccessibilityStateMatcher) =>\n `Unable to find an element with ${buildErrorMessage(state)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yState,\n getMissingError,\n getMultipleError\n);\n\nexport type ByA11yStateQueries = {\n getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n getAllByA11yState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByA11yState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryAllByA11yState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByA11yState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findAllByA11yState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n\n getByAccessibilityState: GetByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n getAllByAccessibilityState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByAccessibilityState: QueryByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryAllByAccessibilityState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByAccessibilityState: FindByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findAllByAccessibilityState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n};\n\nexport const bindByA11yStateQueries = (\n instance: ReactTestInstance\n): ByA11yStateQueries => {\n const getByA11yState = getBy(instance);\n const getAllByA11yState = getAllBy(instance);\n const queryByA11yState = queryBy(instance);\n const queryAllByA11yState = queryAllBy(instance);\n const findByA11yState = findBy(instance);\n const findAllByA11yState = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yState,\n getAllByA11yState,\n queryByA11yState,\n queryAllByA11yState,\n findByA11yState,\n findAllByA11yState,\n getByAccessibilityState: getByA11yState,\n getAllByAccessibilityState: getAllByA11yState,\n queryByAccessibilityState: queryByA11yState,\n queryAllByAccessibilityState: queryAllByA11yState,\n findByAccessibilityState: findByA11yState,\n findAllByAccessibilityState: findAllByA11yState,\n },\n 'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher from \"@testing-library/jest-native\" package instead.'\n ),\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBAAmB,GACvBC,QAA2B,IAK3B,SAASC,qBAAqBA,CAACC,OAAO,EAAEC,YAAY,EAAE;EACpD,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPK,IAAI,IACH,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAAI,IAAAC,2CAAuB,EAACF,IAAI,EAAEH,OAAO,CAAC,EACzEC,YAAY,CACb;AACH,CAAC;AAEH,MAAMK,iBAAiB,GAAGA,CAACC,KAAgC,GAAG,CAAC,CAAC,KAAK;EACnE,MAAMC,MAAgB,GAAG,EAAE;EAE3BC,oCAAsB,CA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