@testing-library/react-native 12.3.1 → 12.3.2

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 (146) hide show
  1. package/build/config.d.ts +1 -1
  2. package/build/config.js.map +1 -1
  3. package/build/{fireEvent.js → fire-event.js} +1 -1
  4. package/build/fire-event.js.map +1 -0
  5. package/build/helpers/{debugDeep.js → debug-deep.js} +1 -1
  6. package/build/helpers/debug-deep.js.map +1 -0
  7. package/build/helpers/{debugShallow.js → debug-shallow.js} +1 -1
  8. package/build/helpers/debug-shallow.js.map +1 -0
  9. package/build/helpers/{findAll.js → find-all.js} +1 -1
  10. package/build/helpers/find-all.js.map +1 -0
  11. package/build/helpers/format-default.js +3 -19
  12. package/build/helpers/format-default.js.map +1 -1
  13. package/build/helpers/matchers/{accessibilityState.js → match-accessibility-state.js} +1 -1
  14. package/build/helpers/matchers/match-accessibility-state.js.map +1 -0
  15. package/build/helpers/matchers/{accessibilityValue.js → match-accessibility-value.js} +2 -2
  16. package/build/helpers/matchers/match-accessibility-value.js.map +1 -0
  17. package/build/helpers/matchers/{matchArrayProp.js → match-array-prop.js} +1 -1
  18. package/build/helpers/matchers/match-array-prop.js.map +1 -0
  19. package/build/helpers/matchers/{matchLabelText.js → match-label-text.js} +3 -3
  20. package/build/helpers/matchers/match-label-text.js.map +1 -0
  21. package/build/helpers/matchers/{matchObjectProp.js → match-object-prop.js} +1 -1
  22. package/build/helpers/matchers/match-object-prop.js.map +1 -0
  23. package/build/helpers/matchers/{matchStringProp.js → match-string-prop.js} +1 -1
  24. package/build/helpers/matchers/match-string-prop.js.map +1 -0
  25. package/build/helpers/matchers/{matchTextContent.js → match-text-content.js} +1 -1
  26. package/build/helpers/matchers/match-text-content.js.map +1 -0
  27. package/build/helpers/object.d.ts +1 -0
  28. package/build/helpers/object.js +18 -0
  29. package/build/helpers/object.js.map +1 -1
  30. package/build/helpers/{stringValidation.js → string-validation.js} +1 -1
  31. package/build/helpers/string-validation.js.map +1 -0
  32. package/build/matchers/extend-expect.d.js.map +1 -1
  33. package/build/matchers/extend-expect.js +2 -0
  34. package/build/matchers/extend-expect.js.map +1 -1
  35. package/build/matchers/index.d.ts +1 -0
  36. package/build/matchers/index.js +7 -0
  37. package/build/matchers/index.js.map +1 -1
  38. package/build/matchers/to-have-accessibility-value.d.ts +7 -0
  39. package/build/matchers/to-have-accessibility-value.js +23 -0
  40. package/build/matchers/to-have-accessibility-value.js.map +1 -0
  41. package/build/pure.d.ts +5 -5
  42. package/build/pure.js +4 -4
  43. package/build/pure.js.map +1 -1
  44. package/build/queries/{a11yState.d.ts → accessibility-state.d.ts} +2 -2
  45. package/build/queries/{a11yState.js → accessibility-state.js} +5 -5
  46. package/build/queries/accessibility-state.js.map +1 -0
  47. package/build/queries/{a11yValue.d.ts → accessibility-value.d.ts} +2 -2
  48. package/build/queries/{a11yValue.js → accessibility-value.js} +5 -5
  49. package/build/queries/accessibility-value.js.map +1 -0
  50. package/build/queries/{displayValue.d.ts → display-value.d.ts} +1 -1
  51. package/build/queries/{displayValue.js → display-value.js} +3 -3
  52. package/build/queries/display-value.js.map +1 -0
  53. package/build/queries/{hintText.d.ts → hint-text.d.ts} +1 -1
  54. package/build/queries/{hintText.js → hint-text.js} +3 -3
  55. package/build/queries/hint-text.js.map +1 -0
  56. package/build/queries/{labelText.d.ts → label-text.d.ts} +1 -1
  57. package/build/queries/{labelText.js → label-text.js} +4 -4
  58. package/build/queries/label-text.js.map +1 -0
  59. package/build/queries/{makeQueries.d.ts → make-queries.d.ts} +1 -1
  60. package/build/queries/{makeQueries.js → make-queries.js} +2 -2
  61. package/build/queries/make-queries.js.map +1 -0
  62. package/build/queries/{placeholderText.d.ts → placeholder-text.d.ts} +1 -1
  63. package/build/queries/{placeholderText.js → placeholder-text.js} +3 -3
  64. package/build/queries/placeholder-text.js.map +1 -0
  65. package/build/queries/role.d.ts +3 -3
  66. package/build/queries/role.js +7 -7
  67. package/build/queries/role.js.map +1 -1
  68. package/build/queries/{testId.d.ts → test-id.d.ts} +1 -1
  69. package/build/queries/{testId.js → test-id.js} +3 -3
  70. package/build/queries/test-id.js.map +1 -0
  71. package/build/queries/text.d.ts +1 -1
  72. package/build/queries/text.js +3 -3
  73. package/build/queries/text.js.map +1 -1
  74. package/build/queries/{unsafeProps.js → unsafe-props.js} +1 -1
  75. package/build/queries/unsafe-props.js.map +1 -0
  76. package/build/queries/{unsafeType.js → unsafe-type.js} +1 -1
  77. package/build/queries/unsafe-type.js.map +1 -0
  78. package/build/{renderHook.js → render-hook.js} +1 -1
  79. package/build/render-hook.js.map +1 -0
  80. package/build/render.d.ts +169 -169
  81. package/build/render.js +3 -3
  82. package/build/render.js.map +1 -1
  83. package/build/user-event/scroll/index.d.ts +1 -1
  84. package/build/user-event/scroll/index.js +1 -1
  85. package/build/user-event/scroll/index.js.map +1 -1
  86. package/build/user-event/scroll/{scrollTo.js → scroll-to.js} +1 -1
  87. package/build/user-event/scroll/scroll-to.js.map +1 -0
  88. package/build/user-event/type/{parseKeys.js → parse-keys.js} +1 -1
  89. package/build/user-event/type/parse-keys.js.map +1 -0
  90. package/build/user-event/type/type.js +1 -1
  91. package/build/user-event/type/type.js.map +1 -1
  92. package/build/{waitForElementToBeRemoved.d.ts → wait-for-element-to-be-removed.d.ts} +1 -1
  93. package/build/{waitForElementToBeRemoved.js → wait-for-element-to-be-removed.js} +2 -2
  94. package/build/wait-for-element-to-be-removed.js.map +1 -0
  95. package/build/{waitFor.js → wait-for.js} +1 -1
  96. package/build/wait-for.js.map +1 -0
  97. package/build/within.d.ts +84 -84
  98. package/build/within.js +11 -11
  99. package/build/within.js.map +1 -1
  100. package/package.json +2 -1
  101. package/pure.d.ts +1 -0
  102. package/build/fireEvent.js.map +0 -1
  103. package/build/helpers/debugDeep.js.map +0 -1
  104. package/build/helpers/debugShallow.js.map +0 -1
  105. package/build/helpers/findAll.js.map +0 -1
  106. package/build/helpers/matchers/accessibilityState.js.map +0 -1
  107. package/build/helpers/matchers/accessibilityValue.js.map +0 -1
  108. package/build/helpers/matchers/matchArrayProp.js.map +0 -1
  109. package/build/helpers/matchers/matchLabelText.js.map +0 -1
  110. package/build/helpers/matchers/matchObjectProp.js.map +0 -1
  111. package/build/helpers/matchers/matchStringProp.js.map +0 -1
  112. package/build/helpers/matchers/matchTextContent.js.map +0 -1
  113. package/build/helpers/stringValidation.js.map +0 -1
  114. package/build/queries/a11yState.js.map +0 -1
  115. package/build/queries/a11yValue.js.map +0 -1
  116. package/build/queries/displayValue.js.map +0 -1
  117. package/build/queries/hintText.js.map +0 -1
  118. package/build/queries/labelText.js.map +0 -1
  119. package/build/queries/makeQueries.js.map +0 -1
  120. package/build/queries/placeholderText.js.map +0 -1
  121. package/build/queries/testId.js.map +0 -1
  122. package/build/queries/unsafeProps.js.map +0 -1
  123. package/build/queries/unsafeType.js.map +0 -1
  124. package/build/renderHook.js.map +0 -1
  125. package/build/user-event/scroll/scrollTo.js.map +0 -1
  126. package/build/user-event/type/parseKeys.js.map +0 -1
  127. package/build/waitFor.js.map +0 -1
  128. package/build/waitForElementToBeRemoved.js.map +0 -1
  129. /package/build/{fireEvent.d.ts → fire-event.d.ts} +0 -0
  130. /package/build/helpers/{debugDeep.d.ts → debug-deep.d.ts} +0 -0
  131. /package/build/helpers/{debugShallow.d.ts → debug-shallow.d.ts} +0 -0
  132. /package/build/helpers/{findAll.d.ts → find-all.d.ts} +0 -0
  133. /package/build/helpers/matchers/{accessibilityState.d.ts → match-accessibility-state.d.ts} +0 -0
  134. /package/build/helpers/matchers/{accessibilityValue.d.ts → match-accessibility-value.d.ts} +0 -0
  135. /package/build/helpers/matchers/{matchArrayProp.d.ts → match-array-prop.d.ts} +0 -0
  136. /package/build/helpers/matchers/{matchLabelText.d.ts → match-label-text.d.ts} +0 -0
  137. /package/build/helpers/matchers/{matchObjectProp.d.ts → match-object-prop.d.ts} +0 -0
  138. /package/build/helpers/matchers/{matchStringProp.d.ts → match-string-prop.d.ts} +0 -0
  139. /package/build/helpers/matchers/{matchTextContent.d.ts → match-text-content.d.ts} +0 -0
  140. /package/build/helpers/{stringValidation.d.ts → string-validation.d.ts} +0 -0
  141. /package/build/queries/{unsafeProps.d.ts → unsafe-props.d.ts} +0 -0
  142. /package/build/queries/{unsafeType.d.ts → unsafe-type.d.ts} +0 -0
  143. /package/build/{renderHook.d.ts → render-hook.d.ts} +0 -0
  144. /package/build/user-event/scroll/{scrollTo.d.ts → scroll-to.d.ts} +0 -0
  145. /package/build/user-event/type/{parseKeys.d.ts → parse-keys.d.ts} +0 -0
  146. /package/build/{waitFor.d.ts → wait-for.d.ts} +0 -0
package/build/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DebugOptions } from './helpers/debugDeep';
1
+ import { DebugOptions } from './helpers/debug-deep';
2
2
  /**
3
3
  * Global configuration options for React Native Testing Library.
4
4
  */
@@ -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 switch: string;\n scrollView: string;\n modal: 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;;AA+BA,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
+ {"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/debug-deep';\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 switch: string;\n scrollView: string;\n modal: 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;;AA+BA,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"}
@@ -90,4 +90,4 @@ fireEvent.press = (element, ...data) => fireEvent(element, 'press', ...data);
90
90
  fireEvent.changeText = (element, ...data) => fireEvent(element, 'changeText', ...data);
91
91
  fireEvent.scroll = (element, ...data) => fireEvent(element, 'scroll', ...data);
92
92
  var _default = exports.default = fireEvent;
93
- //# sourceMappingURL=fireEvent.js.map
93
+ //# sourceMappingURL=fire-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fire-event.js","names":["_act","_interopRequireDefault","require","_componentTree","_hostComponentNames","_pointerEvents","_textInput","obj","__esModule","default","isTouchResponder","element","isHostElement","Boolean","props","onStartShouldSetResponder","isHostTextInput","eventsAffectedByPointerEventsProp","Set","textInputEventsIgnoringEditableProp","isEventEnabled","eventName","nearestTouchResponder","isTextInputEditable","has","isPointerEventEnabled","touchStart","touchMove","onMoveShouldSetResponder","undefined","findEventHandler","touchResponder","handler","getEventHandler","parent","eventHandlerName","getEventHandlerName","charAt","toUpperCase","slice","fireEvent","data","returnValue","act","press","changeText","scroll","_default","exports"],"sources":["../src/fire-event.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport {\n ViewProps,\n TextProps,\n TextInputProps,\n PressableProps,\n ScrollViewProps,\n} from 'react-native';\nimport act from './act';\nimport { isHostElement } from './helpers/component-tree';\nimport { isHostTextInput } from './helpers/host-component-names';\nimport { isPointerEventEnabled } from './helpers/pointer-events';\nimport { isTextInputEditable } from './helpers/text-input';\n\ntype EventHandler = (...args: unknown[]) => unknown;\n\nexport function isTouchResponder(element: ReactTestInstance) {\n if (!isHostElement(element)) {\n return false;\n }\n\n return (\n Boolean(element.props.onStartShouldSetResponder) || isHostTextInput(element)\n );\n}\n\n/**\n * List of events affected by `pointerEvents` prop.\n *\n * Note: `fireEvent` is accepting both `press` and `onPress` for event names,\n * so we need cover both forms.\n */\nconst eventsAffectedByPointerEventsProp = new Set(['press', 'onPress']);\n\n/**\n * List of `TextInput` events not affected by `editable` prop.\n *\n * Note: `fireEvent` is accepting both `press` and `onPress` for event names,\n * so we need cover both forms.\n */\nconst textInputEventsIgnoringEditableProp = new Set([\n 'contentSizeChange',\n 'onContentSizeChange',\n 'layout',\n 'onLayout',\n 'scroll',\n 'onScroll',\n]);\n\nexport function isEventEnabled(\n element: ReactTestInstance,\n eventName: string,\n nearestTouchResponder?: ReactTestInstance\n) {\n if (isHostTextInput(nearestTouchResponder)) {\n return (\n isTextInputEditable(nearestTouchResponder) ||\n textInputEventsIgnoringEditableProp.has(eventName)\n );\n }\n\n if (\n eventsAffectedByPointerEventsProp.has(eventName) &&\n !isPointerEventEnabled(element)\n ) {\n return false;\n }\n\n const touchStart = nearestTouchResponder?.props.onStartShouldSetResponder?.();\n const touchMove = nearestTouchResponder?.props.onMoveShouldSetResponder?.();\n if (touchStart || touchMove) {\n return true;\n }\n\n return touchStart === undefined && touchMove === undefined;\n}\n\nfunction findEventHandler(\n element: ReactTestInstance,\n eventName: string,\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, eventName, touchResponder))\n return handler;\n\n if (element.parent === null || element.parent.parent === null) {\n return null;\n }\n\n return findEventHandler(element.parent, eventName, touchResponder);\n}\n\nfunction getEventHandler(element: ReactTestInstance, eventName: string) {\n const eventHandlerName = getEventHandlerName(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\nfunction getEventHandlerName(eventName: string) {\n return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;\n}\n\n// Allows any string but will provide autocomplete for type T\ntype StringWithAutoComplete<T> = T | (string & Record<never, never>);\n\n// String union type of keys of T that start with on, stripped from on\ntype OnKeys<T> = keyof {\n [K in keyof T as K extends `on${infer Rest}`\n ? Uncapitalize<Rest>\n : never]: T[K];\n};\n\ntype EventName = StringWithAutoComplete<\n | OnKeys<ViewProps>\n | OnKeys<TextProps>\n | OnKeys<TextInputProps>\n | OnKeys<PressableProps>\n | OnKeys<ScrollViewProps>\n>;\n\nfunction fireEvent(\n element: ReactTestInstance,\n eventName: EventName,\n ...data: unknown[]\n) {\n const handler = findEventHandler(element, eventName);\n if (!handler) {\n return;\n }\n\n let returnValue;\n act(() => {\n returnValue = handler(...data);\n });\n\n return returnValue;\n}\n\nfireEvent.press = (element: ReactTestInstance, ...data: unknown[]) =>\n fireEvent(element, 'press', ...data);\n\nfireEvent.changeText = (element: ReactTestInstance, ...data: unknown[]) =>\n fireEvent(element, 'changeText', ...data);\n\nfireEvent.scroll = (element: ReactTestInstance, ...data: unknown[]) =>\n fireEvent(element, 'scroll', ...data);\n\nexport default fireEvent;\n"],"mappings":"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"}
@@ -22,4 +22,4 @@ function debugDeep(instance, options) {
22
22
  console.log((0, _format.default)(instance, formatOptions));
23
23
  }
24
24
  }
25
- //# sourceMappingURL=debugDeep.js.map
25
+ //# sourceMappingURL=debug-deep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-deep.js","names":["_format","_interopRequireDefault","require","obj","__esModule","default","debugDeep","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug-deep.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"}
@@ -22,4 +22,4 @@ function debugShallow(instance, message) {
22
22
  console.log((0, _format.default)(output));
23
23
  }
24
24
  }
25
- //# sourceMappingURL=debugShallow.js.map
25
+ //# sourceMappingURL=debug-shallow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-shallow.js","names":["_shallow","require","_format","_interopRequireDefault","obj","__esModule","default","debugShallow","instance","message","output","shallowInternal","console","log","format"],"sources":["../../src/helpers/debug-shallow.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"}
@@ -42,4 +42,4 @@ function findAllInternal(root, predicate, options) {
42
42
  results.push(...matchingDescendants);
43
43
  return results;
44
44
  }
45
- //# sourceMappingURL=findAll.js.map
45
+ //# sourceMappingURL=find-all.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-all.js","names":["_config","require","_accessiblity","_componentTree","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","isHostElement"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessiblity';\nimport { HostTestInstance, isHostElement } from './component-tree';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): HostTestInstance[] {\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): HostTestInstance[] {\n const results: HostTestInstance[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostTestInstance[] = [];\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 isHostElement(root) &&\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;AACA,IAAAE,cAAA,GAAAF,OAAA;AAaO,SAASG,OAAOA,CACrBC,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACJ;EACpB,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,EAAC,CAAC,EAAEC,4BAA4B;EAE3C,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAoB,CAAC;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAClBC,OAAO,IAAK,CAAC,IAAAC,uCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAC5D,CAAC;AACH;;AAEA;AACA;AACA,SAASL,eAAeA,CACtBJ,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACJ;EACpB,MAAMC,OAA2B,GAAG,EAAE;;EAEtC;EACA,MAAMW,mBAAuC,GAAG,EAAE;EAClDd,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/D,IAAAC,4BAAa,EAACrB,IAAI,CAAC,IACnBC,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"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.defaultMapProps = defaultMapProps;
7
7
  var _reactNative = require("react-native");
8
+ var _object = require("./object");
8
9
  const propsToDisplay = ['accessible', 'accessibilityElementsHidden', 'accessibilityHint', 'accessibilityLabel', 'accessibilityLabelledBy', 'accessibilityRole', 'accessibilityViewIsModal', 'aria-busy', 'aria-checked', 'aria-disabled', 'aria-expanded', 'aria-hidden', 'aria-label', 'aria-labelledby', 'aria-modal', 'aria-selected', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'defaultValue', 'importantForAccessibility', 'nativeID', 'placeholder', 'role', 'testID', 'title', 'value'];
9
10
 
10
11
  /**
@@ -17,11 +18,11 @@ function defaultMapProps(props) {
17
18
  if (styleToDisplay !== undefined) {
18
19
  result.style = styleToDisplay;
19
20
  }
20
- const accessibilityState = removeUndefinedKeys(props.accessibilityState);
21
+ const accessibilityState = (0, _object.removeUndefinedKeys)(props.accessibilityState);
21
22
  if (accessibilityState !== undefined) {
22
23
  result.accessibilityState = accessibilityState;
23
24
  }
24
- const accessibilityValue = removeUndefinedKeys(props.accessibilityValue);
25
+ const accessibilityValue = (0, _object.removeUndefinedKeys)(props.accessibilityValue);
25
26
  if (accessibilityValue !== undefined) {
26
27
  result.accessibilityValue = accessibilityValue;
27
28
  }
@@ -32,23 +33,6 @@ function defaultMapProps(props) {
32
33
  });
33
34
  return result;
34
35
  }
35
- function isObject(value) {
36
- return typeof value === 'object' && value !== null && !Array.isArray(value);
37
- }
38
- function removeUndefinedKeys(prop) {
39
- if (!isObject(prop)) {
40
- return prop;
41
- }
42
- let hasKeys = false;
43
- const result = {};
44
- Object.entries(prop).forEach(([key, value]) => {
45
- if (value !== undefined) {
46
- result[key] = value;
47
- hasKeys = true;
48
- }
49
- });
50
- return hasKeys ? result : undefined;
51
- }
52
36
  function extractStyle(style) {
53
37
  if (style == null) {
54
38
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"format-default.js","names":["_reactNative","require","propsToDisplay","defaultMapProps","props","result","styles","StyleSheet","flatten","style","styleToDisplay","extractStyle","undefined","accessibilityState","removeUndefinedKeys","accessibilityValue","forEach","propName","isObject","value","Array","isArray","prop","hasKeys","Object","entries","key","display","opacity","hasAnyKeys","keys","length"],"sources":["../../src/helpers/format-default.ts"],"sourcesContent":["import { StyleSheet, ViewStyle } from 'react-native';\n\nconst propsToDisplay = [\n 'accessible',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityRole',\n 'accessibilityViewIsModal',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-hidden',\n 'aria-label',\n 'aria-labelledby',\n 'aria-modal',\n 'aria-selected',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n 'defaultValue',\n 'importantForAccessibility',\n 'nativeID',\n 'placeholder',\n 'role',\n 'testID',\n 'title',\n 'value',\n] as const;\n\n/**\n * Preserve props that are helpful in diagnosing test failures, while stripping rest\n */\nexport function defaultMapProps(\n props: Record<string, unknown>\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n const styles = StyleSheet.flatten(props.style as ViewStyle);\n const styleToDisplay = extractStyle(styles);\n if (styleToDisplay !== undefined) {\n result.style = styleToDisplay;\n }\n\n const accessibilityState = removeUndefinedKeys(props.accessibilityState);\n if (accessibilityState !== undefined) {\n result.accessibilityState = accessibilityState;\n }\n\n const accessibilityValue = removeUndefinedKeys(props.accessibilityValue);\n if (accessibilityValue !== undefined) {\n result.accessibilityValue = accessibilityValue;\n }\n\n propsToDisplay.forEach((propName) => {\n if (propName in props) {\n result[propName] = props[propName];\n }\n });\n\n return result;\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction removeUndefinedKeys(prop: unknown) {\n if (!isObject(prop)) {\n return prop;\n }\n\n let hasKeys = false;\n const result: Record<string, unknown> = {};\n Object.entries(prop).forEach(([key, value]) => {\n if (value !== undefined) {\n result[key] = value;\n hasKeys = true;\n }\n });\n\n return hasKeys ? result : undefined;\n}\n\nfunction extractStyle(style: ViewStyle | undefined) {\n if (style == null) {\n return undefined;\n }\n\n const result: Record<string, unknown> = {};\n if (style.display === 'none') {\n result.display = 'none';\n }\n\n if (style.opacity === 0) {\n result.opacity = 0;\n }\n\n const hasAnyKeys = Object.keys(result).length > 0;\n return hasAnyKeys ? result : undefined;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"format-default.js","names":["_reactNative","require","_object","propsToDisplay","defaultMapProps","props","result","styles","StyleSheet","flatten","style","styleToDisplay","extractStyle","undefined","accessibilityState","removeUndefinedKeys","accessibilityValue","forEach","propName","display","opacity","hasAnyKeys","Object","keys","length"],"sources":["../../src/helpers/format-default.ts"],"sourcesContent":["import { StyleSheet, ViewStyle } from 'react-native';\nimport { removeUndefinedKeys } from './object';\n\nconst propsToDisplay = [\n 'accessible',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityRole',\n 'accessibilityViewIsModal',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-hidden',\n 'aria-label',\n 'aria-labelledby',\n 'aria-modal',\n 'aria-selected',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n 'defaultValue',\n 'importantForAccessibility',\n 'nativeID',\n 'placeholder',\n 'role',\n 'testID',\n 'title',\n 'value',\n] as const;\n\n/**\n * Preserve props that are helpful in diagnosing test failures, while stripping rest\n */\nexport function defaultMapProps(\n props: Record<string, unknown>\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n const styles = StyleSheet.flatten(props.style as ViewStyle);\n const styleToDisplay = extractStyle(styles);\n if (styleToDisplay !== undefined) {\n result.style = styleToDisplay;\n }\n\n const accessibilityState = removeUndefinedKeys(props.accessibilityState);\n if (accessibilityState !== undefined) {\n result.accessibilityState = accessibilityState;\n }\n\n const accessibilityValue = removeUndefinedKeys(props.accessibilityValue);\n if (accessibilityValue !== undefined) {\n result.accessibilityValue = accessibilityValue;\n }\n\n propsToDisplay.forEach((propName) => {\n if (propName in props) {\n result[propName] = props[propName];\n }\n });\n\n return result;\n}\n\nfunction extractStyle(style: ViewStyle | undefined) {\n if (style == null) {\n return undefined;\n }\n\n const result: Record<string, unknown> = {};\n if (style.display === 'none') {\n result.display = 'none';\n }\n\n if (style.opacity === 0) {\n result.opacity = 0;\n }\n\n const hasAnyKeys = Object.keys(result).length > 0;\n return hasAnyKeys ? result : undefined;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,cAAc,GAAG,CACrB,YAAY,EACZ,6BAA6B,EAC7B,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,2BAA2B,EAC3B,UAAU,EACV,aAAa,EACb,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,CACC;;AAEV;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,KAA8B,EACL;EACzB,MAAMC,MAA+B,GAAG,CAAC,CAAC;EAE1C,MAAMC,MAAM,GAAGC,uBAAU,CAACC,OAAO,CAACJ,KAAK,CAACK,KAAkB,CAAC;EAC3D,MAAMC,cAAc,GAAGC,YAAY,CAACL,MAAM,CAAC;EAC3C,IAAII,cAAc,KAAKE,SAAS,EAAE;IAChCP,MAAM,CAACI,KAAK,GAAGC,cAAc;EAC/B;EAEA,MAAMG,kBAAkB,GAAG,IAAAC,2BAAmB,EAACV,KAAK,CAACS,kBAAkB,CAAC;EACxE,IAAIA,kBAAkB,KAAKD,SAAS,EAAE;IACpCP,MAAM,CAACQ,kBAAkB,GAAGA,kBAAkB;EAChD;EAEA,MAAME,kBAAkB,GAAG,IAAAD,2BAAmB,EAACV,KAAK,CAACW,kBAAkB,CAAC;EACxE,IAAIA,kBAAkB,KAAKH,SAAS,EAAE;IACpCP,MAAM,CAACU,kBAAkB,GAAGA,kBAAkB;EAChD;EAEAb,cAAc,CAACc,OAAO,CAAEC,QAAQ,IAAK;IACnC,IAAIA,QAAQ,IAAIb,KAAK,EAAE;MACrBC,MAAM,CAACY,QAAQ,CAAC,GAAGb,KAAK,CAACa,QAAQ,CAAC;IACpC;EACF,CAAC,CAAC;EAEF,OAAOZ,MAAM;AACf;AAEA,SAASM,YAAYA,CAACF,KAA4B,EAAE;EAClD,IAAIA,KAAK,IAAI,IAAI,EAAE;IACjB,OAAOG,SAAS;EAClB;EAEA,MAAMP,MAA+B,GAAG,CAAC,CAAC;EAC1C,IAAII,KAAK,CAACS,OAAO,KAAK,MAAM,EAAE;IAC5Bb,MAAM,CAACa,OAAO,GAAG,MAAM;EACzB;EAEA,IAAIT,KAAK,CAACU,OAAO,KAAK,CAAC,EAAE;IACvBd,MAAM,CAACc,OAAO,GAAG,CAAC;EACpB;EAEA,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACjB,MAAM,CAAC,CAACkB,MAAM,GAAG,CAAC;EACjD,OAAOH,UAAU,GAAGf,MAAM,GAAGO,SAAS;AACxC"}
@@ -29,4 +29,4 @@ function matchAccessibilityState(node, matcher) {
29
29
  function matchState(matcher, state, key) {
30
30
  return matcher[key] === undefined || matcher[key] === (state?.[key] ?? defaultState[key]);
31
31
  }
32
- //# sourceMappingURL=accessibilityState.js.map
32
+ //# sourceMappingURL=match-accessibility-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-accessibility-state.js","names":["_accessiblity","require","defaultState","disabled","selected","checked","undefined","busy","expanded","matchAccessibilityState","node","matcher","state","getAccessibilityState","accessibilityStateKeys","every","key","matchState"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import { AccessibilityState } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys, getAccessibilityState } 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 = getAccessibilityState(node);\n return accessibilityStateKeys.every((key) => matchState(matcher, state, key));\n}\n\nfunction matchState(\n matcher: AccessibilityStateMatcher,\n state: AccessibilityState | undefined,\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;AAEA;AACA;AACA;AACA;AASA;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,GAAG,IAAAC,mCAAqB,EAACH,IAAI,CAAC;EACzC,OAAOI,oCAAsB,CAACC,KAAK,CAAEC,GAAG,IAAKC,UAAU,CAACN,OAAO,EAAEC,KAAK,EAAEI,GAAG,CAAC,CAAC;AAC/E;AAEA,SAASC,UAAUA,CACjBN,OAAkC,EAClCC,KAAqC,EACrCI,GAA6B,EAC7B;EACA,OACEL,OAAO,CAACK,GAAG,CAAC,KAAKV,SAAS,IAC1BK,OAAO,CAACK,GAAG,CAAC,MAAMJ,KAAK,GAAGI,GAAG,CAAC,IAAId,YAAY,CAACc,GAAG,CAAC,CAAC;AAExD"}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.matchAccessibilityValue = matchAccessibilityValue;
7
7
  var _accessiblity = require("../accessiblity");
8
- var _matchStringProp = require("./matchStringProp");
8
+ var _matchStringProp = require("./match-string-prop");
9
9
  function matchAccessibilityValue(node, matcher) {
10
10
  const value = (0, _accessiblity.getAccessibilityValue)(node);
11
11
  return (matcher.min === undefined || matcher.min === value?.min) && (matcher.max === undefined || matcher.max === value?.max) && (matcher.now === undefined || matcher.now === value?.now) && (matcher.text === undefined || (0, _matchStringProp.matchStringProp)(value?.text, matcher.text));
12
12
  }
13
- //# sourceMappingURL=accessibilityValue.js.map
13
+ //# sourceMappingURL=match-accessibility-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-accessibility-value.js","names":["_accessiblity","require","_matchStringProp","matchAccessibilityValue","node","matcher","value","getAccessibilityValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/match-accessibility-value.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getAccessibilityValue } from '../accessiblity';\nimport { TextMatch } from '../../matches';\nimport { matchStringProp } from './match-string-prop';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: ReactTestInstance,\n matcher: AccessibilityValueMatcher\n): boolean {\n const value = getAccessibilityValue(node);\n return (\n (matcher.min === undefined || matcher.min === value?.min) &&\n (matcher.max === undefined || matcher.max === value?.max) &&\n (matcher.now === undefined || matcher.now === value?.now) &&\n (matcher.text === undefined || matchStringProp(value?.text, matcher.text))\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AASO,SAASE,uBAAuBA,CACrCC,IAAuB,EACvBC,OAAkC,EACzB;EACT,MAAMC,KAAK,GAAG,IAAAC,mCAAqB,EAACH,IAAI,CAAC;EACzC,OACE,CAACC,OAAO,CAACG,GAAG,KAAKC,SAAS,IAAIJ,OAAO,CAACG,GAAG,KAAKF,KAAK,EAAEE,GAAG,MACvDH,OAAO,CAACK,GAAG,KAAKD,SAAS,IAAIJ,OAAO,CAACK,GAAG,KAAKJ,KAAK,EAAEI,GAAG,CAAC,KACxDL,OAAO,CAACM,GAAG,KAAKF,SAAS,IAAIJ,OAAO,CAACM,GAAG,KAAKL,KAAK,EAAEK,GAAG,CAAC,KACxDN,OAAO,CAACO,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACP,KAAK,EAAEM,IAAI,EAAEP,OAAO,CAACO,IAAI,CAAC,CAAC;AAE9E"}
@@ -20,4 +20,4 @@ function matchArrayProp(prop, matcher) {
20
20
  }
21
21
  return matcher.every(e => prop.includes(e));
22
22
  }
23
- //# sourceMappingURL=matchArrayProp.js.map
23
+ //# sourceMappingURL=match-array-prop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-array-prop.js","names":["matchArrayProp","prop","matcher","length","includes","every","e"],"sources":["../../../src/helpers/matchers/match-array-prop.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"}
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.matchLabelText = matchLabelText;
7
7
  var _matches = require("../../matches");
8
8
  var _accessiblity = require("../accessiblity");
9
- var _findAll = require("../findAll");
10
- var _matchTextContent = require("./matchTextContent");
9
+ var _findAll = require("../find-all");
10
+ var _matchTextContent = require("./match-text-content");
11
11
  function matchLabelText(root, element, expectedText, options = {}) {
12
12
  return matchAccessibilityLabel(element, expectedText, options) || matchAccessibilityLabelledBy(root, (0, _accessiblity.getAccessibilityLabelledBy)(element), expectedText, options);
13
13
  }
@@ -20,4 +20,4 @@ function matchAccessibilityLabelledBy(root, nativeId, text, options) {
20
20
  }
21
21
  return (0, _findAll.findAll)(root, node => node.props.nativeID === nativeId && (0, _matchTextContent.matchTextContent)(node, text, options)).length > 0;
22
22
  }
23
- //# sourceMappingURL=matchLabelText.js.map
23
+ //# sourceMappingURL=match-label-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-label-text.js","names":["_matches","require","_accessiblity","_findAll","_matchTextContent","matchLabelText","root","element","expectedText","options","matchAccessibilityLabel","matchAccessibilityLabelledBy","getAccessibilityLabelledBy","extpectedLabel","matches","getAccessibilityLabel","normalizer","exact","nativeId","text","findAll","node","props","nativeID","matchTextContent","length"],"sources":["../../../src/helpers/matchers/match-label-text.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport {\n getAccessibilityLabel,\n getAccessibilityLabelledBy,\n} from '../accessiblity';\nimport { findAll } from '../find-all';\nimport { matchTextContent } from './match-text-content';\n\nexport function matchLabelText(\n root: ReactTestInstance,\n element: ReactTestInstance,\n expectedText: TextMatch,\n options: TextMatchOptions = {}\n) {\n return (\n matchAccessibilityLabel(element, expectedText, options) ||\n matchAccessibilityLabelledBy(\n root,\n getAccessibilityLabelledBy(element),\n expectedText,\n options\n )\n );\n}\n\nfunction matchAccessibilityLabel(\n element: ReactTestInstance,\n extpectedLabel: TextMatch,\n options: TextMatchOptions\n) {\n return matches(\n extpectedLabel,\n getAccessibilityLabel(element),\n options.normalizer,\n options.exact\n );\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 node.props.nativeID === nativeId &&\n matchTextContent(node, text, options)\n ).length > 0\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEO,SAASI,cAAcA,CAC5BC,IAAuB,EACvBC,OAA0B,EAC1BC,YAAuB,EACvBC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,OACEC,uBAAuB,CAACH,OAAO,EAAEC,YAAY,EAAEC,OAAO,CAAC,IACvDE,4BAA4B,CAC1BL,IAAI,EACJ,IAAAM,wCAA0B,EAACL,OAAO,CAAC,EACnCC,YAAY,EACZC,OACF,CAAC;AAEL;AAEA,SAASC,uBAAuBA,CAC9BH,OAA0B,EAC1BM,cAAyB,EACzBJ,OAAyB,EACzB;EACA,OAAO,IAAAK,gBAAO,EACZD,cAAc,EACd,IAAAE,mCAAqB,EAACR,OAAO,CAAC,EAC9BE,OAAO,CAACO,UAAU,EAClBP,OAAO,CAACQ,KACV,CAAC;AACH;AAEA,SAASN,4BAA4BA,CACnCL,IAAuB,EACvBY,QAA4B,EAC5BC,IAAe,EACfV,OAAyB,EACzB;EACA,IAAI,CAACS,QAAQ,EAAE;IACb,OAAO,KAAK;EACd;EAEA,OACE,IAAAE,gBAAO,EACLd,IAAI,EACHe,IAAI,IACHA,IAAI,CAACC,KAAK,CAACC,QAAQ,KAAKL,QAAQ,IAChC,IAAAM,kCAAgB,EAACH,IAAI,EAAEF,IAAI,EAAEV,OAAO,CACxC,CAAC,CAACgB,MAAM,GAAG,CAAC;AAEhB"}
@@ -22,4 +22,4 @@ function matchObjectProp(prop, matcher) {
22
22
  }
23
23
  return Object.keys(prop).length !== 0 && Object.keys(matcher).every(key => prop[key] === matcher[key]);
24
24
  }
25
- //# sourceMappingURL=matchObjectProp.js.map
25
+ //# sourceMappingURL=match-object-prop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-object-prop.js","names":["matchObjectProp","prop","matcher","Object","keys","length","every","key"],"sources":["../../../src/helpers/matchers/match-object-prop.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"}
@@ -20,4 +20,4 @@ function matchStringProp(prop, matcher) {
20
20
  }
21
21
  return prop.match(matcher) != null;
22
22
  }
23
- //# sourceMappingURL=matchStringProp.js.map
23
+ //# sourceMappingURL=match-string-prop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-string-prop.js","names":["matchStringProp","prop","matcher","match"],"sources":["../../../src/helpers/matchers/match-string-prop.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"}
@@ -21,4 +21,4 @@ function matchTextContent(node, text, options = {}) {
21
21
  } = options;
22
22
  return (0, _matches.matches)(text, textContent, normalizer, exact);
23
23
  }
24
- //# sourceMappingURL=matchTextContent.js.map
24
+ //# sourceMappingURL=match-text-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match-text-content.js","names":["_matches","require","_textContent","matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/match-text-content.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { getTextContent } from '../text-content';\n\n/**\n * Matches the given node's text content against string or regex matcher.\n *\n * @param node - Node which text content will be matched\n * @param text - The string or regex to match.\n * @returns - Whether the node's text content matches the given string or regex.\n */\nexport function matchTextContent(\n node: 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,YAAA,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,2BAAc,EAACJ,IAAI,CAAC;EACxC,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGJ,OAAO;EACrC,OAAO,IAAAK,gBAAO,EAACN,IAAI,EAAEE,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AACtD"}
@@ -1 +1,2 @@
1
1
  export declare function pick<T extends {}>(object: T, keys: (keyof T)[]): Partial<T>;
2
+ export declare function removeUndefinedKeys(prop: unknown): unknown;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.pick = pick;
7
+ exports.removeUndefinedKeys = removeUndefinedKeys;
7
8
  function pick(object, keys) {
8
9
  const result = {};
9
10
  keys.forEach(key => {
@@ -13,4 +14,21 @@ function pick(object, keys) {
13
14
  });
14
15
  return result;
15
16
  }
17
+ function isObject(value) {
18
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
19
+ }
20
+ function removeUndefinedKeys(prop) {
21
+ if (!isObject(prop)) {
22
+ return prop;
23
+ }
24
+ let hasKeys = false;
25
+ const result = {};
26
+ Object.entries(prop).forEach(([key, value]) => {
27
+ if (value !== undefined) {
28
+ result[key] = value;
29
+ hasKeys = true;
30
+ }
31
+ });
32
+ return hasKeys ? result : undefined;
33
+ }
16
34
  //# sourceMappingURL=object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","names":["pick","object","keys","result","forEach","key","undefined"],"sources":["../../src/helpers/object.ts"],"sourcesContent":["export function pick<T extends {}>(object: T, keys: (keyof T)[]): Partial<T> {\n const result: Partial<T> = {};\n keys.forEach((key) => {\n if (object[key] !== undefined) {\n result[key] = object[key];\n }\n });\n\n return result;\n}\n"],"mappings":";;;;;;AAAO,SAASA,IAAIA,CAAeC,MAAS,EAAEC,IAAiB,EAAc;EAC3E,MAAMC,MAAkB,GAAG,CAAC,CAAC;EAC7BD,IAAI,CAACE,OAAO,CAAEC,GAAG,IAAK;IACpB,IAAIJ,MAAM,CAACI,GAAG,CAAC,KAAKC,SAAS,EAAE;MAC7BH,MAAM,CAACE,GAAG,CAAC,GAAGJ,MAAM,CAACI,GAAG,CAAC;IAC3B;EACF,CAAC,CAAC;EAEF,OAAOF,MAAM;AACf"}
1
+ {"version":3,"file":"object.js","names":["pick","object","keys","result","forEach","key","undefined","isObject","value","Array","isArray","removeUndefinedKeys","prop","hasKeys","Object","entries"],"sources":["../../src/helpers/object.ts"],"sourcesContent":["export function pick<T extends {}>(object: T, keys: (keyof T)[]): Partial<T> {\n const result: Partial<T> = {};\n keys.forEach((key) => {\n if (object[key] !== undefined) {\n result[key] = object[key];\n }\n });\n\n return result;\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport function removeUndefinedKeys(prop: unknown) {\n if (!isObject(prop)) {\n return prop;\n }\n\n let hasKeys = false;\n const result: Record<string, unknown> = {};\n Object.entries(prop).forEach(([key, value]) => {\n if (value !== undefined) {\n result[key] = value;\n hasKeys = true;\n }\n });\n\n return hasKeys ? result : undefined;\n}\n"],"mappings":";;;;;;;AAAO,SAASA,IAAIA,CAAeC,MAAS,EAAEC,IAAiB,EAAc;EAC3E,MAAMC,MAAkB,GAAG,CAAC,CAAC;EAC7BD,IAAI,CAACE,OAAO,CAAEC,GAAG,IAAK;IACpB,IAAIJ,MAAM,CAACI,GAAG,CAAC,KAAKC,SAAS,EAAE;MAC7BH,MAAM,CAACE,GAAG,CAAC,GAAGJ,MAAM,CAACI,GAAG,CAAC;IAC3B;EACF,CAAC,CAAC;EAEF,OAAOF,MAAM;AACf;AAEA,SAASI,QAAQA,CAACC,KAAc,EAAoC;EAClE,OAAOA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAC7E;AAEO,SAASG,mBAAmBA,CAACC,IAAa,EAAE;EACjD,IAAI,CAACL,QAAQ,CAACK,IAAI,CAAC,EAAE;IACnB,OAAOA,IAAI;EACb;EAEA,IAAIC,OAAO,GAAG,KAAK;EACnB,MAAMV,MAA+B,GAAG,CAAC,CAAC;EAC1CW,MAAM,CAACC,OAAO,CAACH,IAAI,CAAC,CAACR,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEG,KAAK,CAAC,KAAK;IAC7C,IAAIA,KAAK,KAAKF,SAAS,EAAE;MACvBH,MAAM,CAACE,GAAG,CAAC,GAAGG,KAAK;MACnBK,OAAO,GAAG,IAAI;IAChB;EACF,CAAC,CAAC;EAEF,OAAOA,OAAO,GAAGV,MAAM,GAAGG,SAAS;AACrC"}
@@ -28,4 +28,4 @@ const validateStringsRenderedWithinTextForNode = node => {
28
28
  node.children.forEach(validateStringsRenderedWithinTextForNode);
29
29
  }
30
30
  };
31
- //# sourceMappingURL=stringValidation.js.map
31
+ //# sourceMappingURL=string-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-validation.js","names":["validateStringsRenderedWithinText","rendererJSON","Array","isArray","forEach","validateStringsRenderedWithinTextForNode","exports","node","type","children","child","Error"],"sources":["../../src/helpers/string-validation.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,cACpJ,CAAC;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":"extend-expect.d.js","names":[],"sources":["../../src/matchers/extend-expect.d.ts"],"sourcesContent":["import type { StyleProp } from 'react-native';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport type { Style } from './to-have-style';\n\nexport interface JestNativeMatchers<R> {\n toBeOnTheScreen(): R;\n toBeChecked(): R;\n toBeCollapsed(): R;\n toBeDisabled(): R;\n toBeBusy(): R;\n toBeEmptyElement(): R;\n toBeEnabled(): R;\n toBeExpanded(): R;\n toBePartiallyChecked(): R;\n toBeSelected(): R;\n toBeVisible(): R;\n toContainElement(element: ReactTestInstance | null): R;\n toHaveDisplayValue(expectedValue: TextMatch, options?: TextMatchOptions): R;\n toHaveProp(name: string, expectedValue?: unknown): R;\n toHaveStyle(style: StyleProp<Style>): R;\n toHaveTextContent(expectedText: TextMatch, options?: TextMatchOptions): R;\n}\n\n// Implicit Jest global `expect`.\ndeclare global {\n namespace jest {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface Matchers<R, T = {}> extends JestNativeMatchers<R> {}\n }\n}\n\n// Explicit `@jest/globals` `expect` matchers.\ndeclare module '@jest/expect' {\n interface Matchers<R extends void | Promise<void>>\n extends JestNativeMatchers<R> {}\n}\n"],"mappings":""}
1
+ {"version":3,"file":"extend-expect.d.js","names":[],"sources":["../../src/matchers/extend-expect.d.ts"],"sourcesContent":["import type { StyleProp } from 'react-native';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';\nimport type { Style } from './to-have-style';\n\nexport interface JestNativeMatchers<R> {\n toBeOnTheScreen(): R;\n toBeChecked(): R;\n toBeCollapsed(): R;\n toBeDisabled(): R;\n toBeBusy(): R;\n toBeEmptyElement(): R;\n toBeEnabled(): R;\n toBeExpanded(): R;\n toBePartiallyChecked(): R;\n toBeSelected(): R;\n toBeVisible(): R;\n toContainElement(element: ReactTestInstance | null): R;\n toHaveAccessibilityValue(expectedValue: AccessibilityValueMatcher): R;\n toHaveDisplayValue(expectedValue: TextMatch, options?: TextMatchOptions): R;\n toHaveProp(name: string, expectedValue?: unknown): R;\n toHaveStyle(style: StyleProp<Style>): R;\n toHaveTextContent(expectedText: TextMatch, options?: TextMatchOptions): R;\n}\n\n// Implicit Jest global `expect`.\ndeclare global {\n namespace jest {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface Matchers<R, T = {}> extends JestNativeMatchers<R> {}\n }\n}\n\n// Explicit `@jest/globals` `expect` matchers.\ndeclare module '@jest/expect' {\n interface Matchers<R extends void | Promise<void>>\n extends JestNativeMatchers<R> {}\n}\n"],"mappings":""}
@@ -11,6 +11,7 @@ var _toBePartiallyChecked = require("./to-be-partially-checked");
11
11
  var _toBeSelected = require("./to-be-selected");
12
12
  var _toBeVisible = require("./to-be-visible");
13
13
  var _toContainElement = require("./to-contain-element");
14
+ var _toHaveAccessibilityValue = require("./to-have-accessibility-value");
14
15
  var _toHaveDisplayValue = require("./to-have-display-value");
15
16
  var _toHaveProp = require("./to-have-prop");
16
17
  var _toHaveStyle = require("./to-have-style");
@@ -30,6 +31,7 @@ expect.extend({
30
31
  toBeSelected: _toBeSelected.toBeSelected,
31
32
  toBeVisible: _toBeVisible.toBeVisible,
32
33
  toContainElement: _toContainElement.toContainElement,
34
+ toHaveAccessibilityValue: _toHaveAccessibilityValue.toHaveAccessibilityValue,
33
35
  toHaveDisplayValue: _toHaveDisplayValue.toHaveDisplayValue,
34
36
  toHaveProp: _toHaveProp.toHaveProp,
35
37
  toHaveStyle: _toHaveStyle.toHaveStyle,
@@ -1 +1 @@
1
- {"version":3,"file":"extend-expect.js","names":["_toBeOnTheScreen","require","_toBeChecked","_toBeCollapsed","_toBeDisabled","_toBeBusy","_toBeEmptyElement","_toBeExpanded","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent","expect","extend","toBeOnTheScreen","toBeChecked","toBeCollapsed","toBeDisabled","toBeBusy","toBeEmptyElement","toBeEnabled","toBeExpanded","toBePartiallyChecked","toBeSelected","toBeVisible","toContainElement","toHaveDisplayValue","toHaveProp","toHaveStyle","toHaveTextContent"],"sources":["../../src/matchers/extend-expect.ts"],"sourcesContent":["/// <reference path=\"./extend-expect.d.ts\" />\n\nimport { toBeOnTheScreen } from './to-be-on-the-screen';\nimport { toBeChecked } from './to-be-checked';\nimport { toBeCollapsed } from './to-be-collapsed';\nimport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nimport { toBeBusy } from './to-be-busy';\nimport { toBeEmptyElement } from './to-be-empty-element';\nimport { toBeExpanded } from './to-be-expanded';\nimport { toBePartiallyChecked } from './to-be-partially-checked';\nimport { toBeSelected } from './to-be-selected';\nimport { toBeVisible } from './to-be-visible';\nimport { toContainElement } from './to-contain-element';\nimport { toHaveDisplayValue } from './to-have-display-value';\nimport { toHaveProp } from './to-have-prop';\nimport { toHaveStyle } from './to-have-style';\nimport { toHaveTextContent } from './to-have-text-content';\n\nexpect.extend({\n toBeOnTheScreen,\n toBeChecked,\n toBeCollapsed,\n toBeDisabled,\n toBeBusy,\n toBeEmptyElement,\n toBeEnabled,\n toBeExpanded,\n toBePartiallyChecked,\n toBeSelected,\n toBeVisible,\n toContainElement,\n toHaveDisplayValue,\n toHaveProp,\n toHaveStyle,\n toHaveTextContent,\n});\n"],"mappings":";;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,kBAAA,GAAAd,OAAA;AAhBA;;AAkBAe,MAAM,CAACC,MAAM,CAAC;EACZC,eAAe,EAAfA,gCAAe;EACfC,WAAW,EAAXA,wBAAW;EACXC,aAAa,EAAbA,4BAAa;EACbC,YAAY,EAAZA,0BAAY;EACZC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA,kCAAgB;EAChBC,WAAW,EAAXA,yBAAW;EACXC,YAAY,EAAZA,0BAAY;EACZC,oBAAoB,EAApBA,0CAAoB;EACpBC,YAAY,EAAZA,0BAAY;EACZC,WAAW,EAAXA,wBAAW;EACXC,gBAAgB,EAAhBA,kCAAgB;EAChBC,kBAAkB,EAAlBA,sCAAkB;EAClBC,UAAU,EAAVA,sBAAU;EACVC,WAAW,EAAXA,wBAAW;EACXC,iBAAiB,EAAjBA;AACF,CAAC,CAAC"}
1
+ {"version":3,"file":"extend-expect.js","names":["_toBeOnTheScreen","require","_toBeChecked","_toBeCollapsed","_toBeDisabled","_toBeBusy","_toBeEmptyElement","_toBeExpanded","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveAccessibilityValue","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent","expect","extend","toBeOnTheScreen","toBeChecked","toBeCollapsed","toBeDisabled","toBeBusy","toBeEmptyElement","toBeEnabled","toBeExpanded","toBePartiallyChecked","toBeSelected","toBeVisible","toContainElement","toHaveAccessibilityValue","toHaveDisplayValue","toHaveProp","toHaveStyle","toHaveTextContent"],"sources":["../../src/matchers/extend-expect.ts"],"sourcesContent":["/// <reference path=\"./extend-expect.d.ts\" />\n\nimport { toBeOnTheScreen } from './to-be-on-the-screen';\nimport { toBeChecked } from './to-be-checked';\nimport { toBeCollapsed } from './to-be-collapsed';\nimport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nimport { toBeBusy } from './to-be-busy';\nimport { toBeEmptyElement } from './to-be-empty-element';\nimport { toBeExpanded } from './to-be-expanded';\nimport { toBePartiallyChecked } from './to-be-partially-checked';\nimport { toBeSelected } from './to-be-selected';\nimport { toBeVisible } from './to-be-visible';\nimport { toContainElement } from './to-contain-element';\nimport { toHaveAccessibilityValue } from './to-have-accessibility-value';\nimport { toHaveDisplayValue } from './to-have-display-value';\nimport { toHaveProp } from './to-have-prop';\nimport { toHaveStyle } from './to-have-style';\nimport { toHaveTextContent } from './to-have-text-content';\n\nexpect.extend({\n toBeOnTheScreen,\n toBeChecked,\n toBeCollapsed,\n toBeDisabled,\n toBeBusy,\n toBeEmptyElement,\n toBeEnabled,\n toBeExpanded,\n toBePartiallyChecked,\n toBeSelected,\n toBeVisible,\n toContainElement,\n toHaveAccessibilityValue,\n toHaveDisplayValue,\n toHaveProp,\n toHaveStyle,\n toHaveTextContent,\n});\n"],"mappings":";;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,yBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA;AAjBA;;AAmBAgB,MAAM,CAACC,MAAM,CAAC;EACZC,eAAe,EAAfA,gCAAe;EACfC,WAAW,EAAXA,wBAAW;EACXC,aAAa,EAAbA,4BAAa;EACbC,YAAY,EAAZA,0BAAY;EACZC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA,kCAAgB;EAChBC,WAAW,EAAXA,yBAAW;EACXC,YAAY,EAAZA,0BAAY;EACZC,oBAAoB,EAApBA,0CAAoB;EACpBC,YAAY,EAAZA,0BAAY;EACZC,WAAW,EAAXA,wBAAW;EACXC,gBAAgB,EAAhBA,kCAAgB;EAChBC,wBAAwB,EAAxBA,kDAAwB;EACxBC,kBAAkB,EAAlBA,sCAAkB;EAClBC,UAAU,EAAVA,sBAAU;EACVC,WAAW,EAAXA,wBAAW;EACXC,iBAAiB,EAAjBA;AACF,CAAC,CAAC"}
@@ -9,6 +9,7 @@ export { toBePartiallyChecked } from './to-be-partially-checked';
9
9
  export { toBeSelected } from './to-be-selected';
10
10
  export { toBeVisible } from './to-be-visible';
11
11
  export { toContainElement } from './to-contain-element';
12
+ export { toHaveAccessibilityValue } from './to-have-accessibility-value';
12
13
  export { toHaveDisplayValue } from './to-have-display-value';
13
14
  export { toHaveProp } from './to-have-prop';
14
15
  export { toHaveStyle } from './to-have-style';
@@ -75,6 +75,12 @@ Object.defineProperty(exports, "toContainElement", {
75
75
  return _toContainElement.toContainElement;
76
76
  }
77
77
  });
78
+ Object.defineProperty(exports, "toHaveAccessibilityValue", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _toHaveAccessibilityValue.toHaveAccessibilityValue;
82
+ }
83
+ });
78
84
  Object.defineProperty(exports, "toHaveDisplayValue", {
79
85
  enumerable: true,
80
86
  get: function () {
@@ -110,6 +116,7 @@ var _toBePartiallyChecked = require("./to-be-partially-checked");
110
116
  var _toBeSelected = require("./to-be-selected");
111
117
  var _toBeVisible = require("./to-be-visible");
112
118
  var _toContainElement = require("./to-contain-element");
119
+ var _toHaveAccessibilityValue = require("./to-have-accessibility-value");
113
120
  var _toHaveDisplayValue = require("./to-have-display-value");
114
121
  var _toHaveProp = require("./to-have-prop");
115
122
  var _toHaveStyle = require("./to-have-style");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_toBeBusy","require","_toBeChecked","_toBeCollapsed","_toBeDisabled","_toBeEmptyElement","_toBeExpanded","_toBeOnTheScreen","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent"],"sources":["../../src/matchers/index.tsx"],"sourcesContent":["export { toBeBusy } from './to-be-busy';\nexport { toBeChecked } from './to-be-checked';\nexport { toBeCollapsed } from './to-be-collapsed';\nexport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nexport { toBeEmptyElement } from './to-be-empty-element';\nexport { toBeExpanded } from './to-be-expanded';\nexport { toBeOnTheScreen } from './to-be-on-the-screen';\nexport { toBePartiallyChecked } from './to-be-partially-checked';\nexport { toBeSelected } from './to-be-selected';\nexport { toBeVisible } from './to-be-visible';\nexport { toContainElement } from './to-contain-element';\nexport { toHaveDisplayValue } from './to-have-display-value';\nexport { toHaveProp } from './to-have-prop';\nexport { toHaveStyle } from './to-have-style';\nexport { toHaveTextContent } from './to-have-text-content';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,kBAAA,GAAAd,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_toBeBusy","require","_toBeChecked","_toBeCollapsed","_toBeDisabled","_toBeEmptyElement","_toBeExpanded","_toBeOnTheScreen","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveAccessibilityValue","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent"],"sources":["../../src/matchers/index.ts"],"sourcesContent":["export { toBeBusy } from './to-be-busy';\nexport { toBeChecked } from './to-be-checked';\nexport { toBeCollapsed } from './to-be-collapsed';\nexport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nexport { toBeEmptyElement } from './to-be-empty-element';\nexport { toBeExpanded } from './to-be-expanded';\nexport { toBeOnTheScreen } from './to-be-on-the-screen';\nexport { toBePartiallyChecked } from './to-be-partially-checked';\nexport { toBeSelected } from './to-be-selected';\nexport { toBeVisible } from './to-be-visible';\nexport { toContainElement } from './to-contain-element';\nexport { toHaveAccessibilityValue } from './to-have-accessibility-value';\nexport { toHaveDisplayValue } from './to-have-display-value';\nexport { toHaveProp } from './to-have-prop';\nexport { toHaveStyle } from './to-have-style';\nexport { toHaveTextContent } from './to-have-text-content';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,yBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="jest" />
2
+ import type { ReactTestInstance } from 'react-test-renderer';
3
+ import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
4
+ export declare function toHaveAccessibilityValue(this: jest.MatcherContext, element: ReactTestInstance, expectedValue: AccessibilityValueMatcher): {
5
+ pass: boolean;
6
+ message: () => string;
7
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toHaveAccessibilityValue = toHaveAccessibilityValue;
7
+ var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _accessiblity = require("../helpers/accessiblity");
9
+ var _matchAccessibilityValue = require("../helpers/matchers/match-accessibility-value");
10
+ var _object = require("../helpers/object");
11
+ var _utils = require("./utils");
12
+ function toHaveAccessibilityValue(element, expectedValue) {
13
+ (0, _utils.checkHostElement)(element, toHaveAccessibilityValue, this);
14
+ const receivedValue = (0, _accessiblity.getAccessibilityValue)(element);
15
+ return {
16
+ pass: (0, _matchAccessibilityValue.matchAccessibilityValue)(element, expectedValue),
17
+ message: () => {
18
+ const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`, 'element', (0, _jestMatcherUtils.stringify)(expectedValue));
19
+ return (0, _utils.formatMessage)(matcher, `Expected the element ${this.isNot ? 'not to' : 'to'} have accessibility value`, (0, _jestMatcherUtils.stringify)(expectedValue), 'Received element with accessibility value', (0, _jestMatcherUtils.stringify)((0, _object.removeUndefinedKeys)(receivedValue)));
20
+ }
21
+ };
22
+ }
23
+ //# sourceMappingURL=to-have-accessibility-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-have-accessibility-value.js","names":["_jestMatcherUtils","require","_accessiblity","_matchAccessibilityValue","_object","_utils","toHaveAccessibilityValue","element","expectedValue","checkHostElement","receivedValue","getAccessibilityValue","pass","matchAccessibilityValue","message","matcher","matcherHint","isNot","stringify","formatMessage","removeUndefinedKeys"],"sources":["../../src/matchers/to-have-accessibility-value.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, stringify } from 'jest-matcher-utils';\nimport { getAccessibilityValue } from '../helpers/accessiblity';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/match-accessibility-value';\nimport { removeUndefinedKeys } from '../helpers/object';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibilityValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: AccessibilityValueMatcher\n) {\n checkHostElement(element, toHaveAccessibilityValue, this);\n\n const receivedValue = getAccessibilityValue(element);\n\n return {\n pass: matchAccessibilityValue(element, expectedValue),\n message: () => {\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`,\n 'element',\n stringify(expectedValue)\n );\n return formatMessage(\n matcher,\n `Expected the element ${\n this.isNot ? 'not to' : 'to'\n } have accessibility value`,\n stringify(expectedValue),\n 'Received element with accessibility value',\n stringify(removeUndefinedKeys(receivedValue))\n );\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,OAA0B,EAC1BC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAEzD,MAAMI,aAAa,GAAG,IAAAC,mCAAqB,EAACJ,OAAO,CAAC;EAEpD,OAAO;IACLK,IAAI,EAAE,IAAAC,gDAAuB,EAACN,OAAO,EAAEC,aAAa,CAAC;IACrDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACxB,GAAE,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAG,2BAA0B,EACtD,SAAS,EACT,IAAAC,2BAAS,EAACV,aAAa,CACzB,CAAC;MACD,OAAO,IAAAW,oBAAa,EAClBJ,OAAO,EACN,wBACC,IAAI,CAACE,KAAK,GAAG,QAAQ,GAAG,IACzB,2BAA0B,EAC3B,IAAAC,2BAAS,EAACV,aAAa,CAAC,EACxB,2CAA2C,EAC3C,IAAAU,2BAAS,EAAC,IAAAE,2BAAmB,EAACV,aAAa,CAAC,CAC9C,CAAC;IACH;EACF,CAAC;AACH"}
package/build/pure.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export { default as act } from './act';
2
2
  export { default as cleanup } from './cleanup';
3
- export { default as fireEvent } from './fireEvent';
3
+ export { default as fireEvent } from './fire-event';
4
4
  export { default as render } from './render';
5
- export { default as waitFor } from './waitFor';
6
- export { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';
5
+ export { default as waitFor } from './wait-for';
6
+ export { default as waitForElementToBeRemoved } from './wait-for-element-to-be-removed';
7
7
  export { within, getQueriesForElement } from './within';
8
8
  export { configure, resetToDefaults } from './config';
9
9
  export { isHiddenFromAccessibility, isInaccessible, } from './helpers/accessiblity';
10
10
  export { getDefaultNormalizer } from './matches';
11
- export { renderHook } from './renderHook';
11
+ export { renderHook } from './render-hook';
12
12
  export { screen } from './screen';
13
13
  export { userEvent } from './user-event';
14
14
  export type { RenderOptions, RenderResult, RenderResult as RenderAPI, DebugFunction, } from './render';
15
- export type { RenderHookOptions, RenderHookResult } from './renderHook';
15
+ export type { RenderHookOptions, RenderHookResult } from './render-hook';
16
16
  export type { Config } from './config';
17
17
  export type { UserEventConfig } from './user-event';
package/build/pure.js CHANGED
@@ -101,15 +101,15 @@ Object.defineProperty(exports, "within", {
101
101
  });
102
102
  var _act = _interopRequireDefault(require("./act"));
103
103
  var _cleanup = _interopRequireDefault(require("./cleanup"));
104
- var _fireEvent = _interopRequireDefault(require("./fireEvent"));
104
+ var _fireEvent = _interopRequireDefault(require("./fire-event"));
105
105
  var _render = _interopRequireDefault(require("./render"));
106
- var _waitFor = _interopRequireDefault(require("./waitFor"));
107
- var _waitForElementToBeRemoved = _interopRequireDefault(require("./waitForElementToBeRemoved"));
106
+ var _waitFor = _interopRequireDefault(require("./wait-for"));
107
+ var _waitForElementToBeRemoved = _interopRequireDefault(require("./wait-for-element-to-be-removed"));
108
108
  var _within = require("./within");
109
109
  var _config = require("./config");
110
110
  var _accessiblity = require("./helpers/accessiblity");
111
111
  var _matches = require("./matches");
112
- var _renderHook = require("./renderHook");
112
+ var _renderHook = require("./render-hook");
113
113
  var _screen = require("./screen");
114
114
  var _userEvent = require("./user-event");
115
115
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/build/pure.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pure.js","names":["_act","_interopRequireDefault","require","_cleanup","_fireEvent","_render","_waitFor","_waitForElementToBeRemoved","_within","_config","_accessiblity","_matches","_renderHook","_screen","_userEvent","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';\nexport { userEvent } from './user-event';\n\nexport type {\n RenderOptions,\n RenderResult,\n RenderResult as RenderAPI,\n DebugFunction,\n} from './render';\nexport type { RenderHookOptions, RenderHookResult } from './renderHook';\nexport type { Config } from './config';\nexport type { UserEventConfig } from './user-event';\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;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAAyC,SAAAD,uBAAAc,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
1
+ {"version":3,"file":"pure.js","names":["_act","_interopRequireDefault","require","_cleanup","_fireEvent","_render","_waitFor","_waitForElementToBeRemoved","_within","_config","_accessiblity","_matches","_renderHook","_screen","_userEvent","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 './fire-event';\nexport { default as render } from './render';\nexport { default as waitFor } from './wait-for';\nexport { default as waitForElementToBeRemoved } from './wait-for-element-to-be-removed';\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 './render-hook';\nexport { screen } from './screen';\nexport { userEvent } from './user-event';\n\nexport type {\n RenderOptions,\n RenderResult,\n RenderResult as RenderAPI,\n DebugFunction,\n} from './render';\nexport type { RenderHookOptions, RenderHookResult } from './render-hook';\nexport type { Config } from './config';\nexport type { UserEventConfig } from './user-event';\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;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAAyC,SAAAD,uBAAAc,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
- import { AccessibilityStateMatcher } from '../helpers/matchers/accessibilityState';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
2
+ import { AccessibilityStateMatcher } from '../helpers/matchers/match-accessibility-state';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import { CommonQueryOptions } from './options';
5
5
  export type ByA11yStateQueries = {
6
6
  getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.bindByA11yStateQueries = void 0;
7
7
  var _accessiblity = require("../helpers/accessiblity");
8
8
  var _deprecation = require("../helpers/deprecation");
9
- var _findAll = require("../helpers/findAll");
10
- var _accessibilityState = require("../helpers/matchers/accessibilityState");
11
- var _makeQueries = require("./makeQueries");
9
+ var _findAll = require("../helpers/find-all");
10
+ var _matchAccessibilityState = require("../helpers/matchers/match-accessibility-state");
11
+ var _makeQueries = require("./make-queries");
12
12
  const queryAllByA11yState = instance => function queryAllByA11yStateFn(matcher, queryOptions) {
13
- return (0, _findAll.findAll)(instance, node => (0, _accessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
13
+ return (0, _findAll.findAll)(instance, node => (0, _matchAccessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
14
14
  };
15
15
  const buildErrorMessage = (state = {}) => {
16
16
  const errors = [];
@@ -56,4 +56,4 @@ const bindByA11yStateQueries = instance => {
56
56
  };
57
57
  };
58
58
  exports.bindByA11yStateQueries = bindByA11yStateQueries;
59
- //# sourceMappingURL=a11yState.js.map
59
+ //# sourceMappingURL=accessibility-state.js.map