@testing-library/react-native 14.0.0-beta.0 → 14.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +22 -33
  2. package/build/event-builder/base.js.map +1 -0
  3. package/build/event-builder/common.d.ts +152 -0
  4. package/build/event-builder/common.js +80 -0
  5. package/build/event-builder/common.js.map +1 -0
  6. package/build/event-builder/index.d.ts +3 -0
  7. package/build/event-builder/index.js +39 -0
  8. package/build/event-builder/index.js.map +1 -0
  9. package/build/event-builder/scroll.d.ts +56 -0
  10. package/build/event-builder/scroll.js +51 -0
  11. package/build/event-builder/scroll.js.map +1 -0
  12. package/build/event-builder/text.d.ts +162 -0
  13. package/build/event-builder/text.js +113 -0
  14. package/build/event-builder/text.js.map +1 -0
  15. package/build/fire-event.d.ts +6 -5
  16. package/build/fire-event.js +47 -23
  17. package/build/fire-event.js.map +1 -1
  18. package/build/helpers/accessibility.d.ts +18 -15
  19. package/build/helpers/accessibility.js +64 -47
  20. package/build/helpers/accessibility.js.map +1 -1
  21. package/build/helpers/component-tree.d.ts +9 -9
  22. package/build/helpers/component-tree.js +17 -17
  23. package/build/helpers/component-tree.js.map +1 -1
  24. package/build/helpers/find-all.d.ts +2 -2
  25. package/build/helpers/find-all.js +1 -1
  26. package/build/helpers/find-all.js.map +1 -1
  27. package/build/helpers/format-element.d.ts +5 -5
  28. package/build/helpers/format-element.js +9 -9
  29. package/build/helpers/format-element.js.map +1 -1
  30. package/build/helpers/host-component-names.d.ts +13 -13
  31. package/build/helpers/host-component-names.js +18 -18
  32. package/build/helpers/host-component-names.js.map +1 -1
  33. package/build/helpers/matchers/match-accessibility-state.d.ts +2 -2
  34. package/build/helpers/matchers/match-accessibility-state.js +6 -6
  35. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  36. package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
  37. package/build/helpers/matchers/match-accessibility-value.js +2 -2
  38. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  39. package/build/helpers/matchers/match-label-text.d.ts +2 -2
  40. package/build/helpers/matchers/match-label-text.js +2 -2
  41. package/build/helpers/matchers/match-label-text.js.map +1 -1
  42. package/build/helpers/matchers/match-text-content.d.ts +5 -5
  43. package/build/helpers/matchers/match-text-content.js +5 -5
  44. package/build/helpers/matchers/match-text-content.js.map +1 -1
  45. package/build/helpers/pointer-events.d.ts +2 -2
  46. package/build/helpers/pointer-events.js +4 -4
  47. package/build/helpers/pointer-events.js.map +1 -1
  48. package/build/helpers/text-content.d.ts +2 -2
  49. package/build/helpers/text-content.js +5 -5
  50. package/build/helpers/text-content.js.map +1 -1
  51. package/build/helpers/text-input.d.ts +3 -3
  52. package/build/helpers/text-input.js +6 -6
  53. package/build/helpers/text-input.js.map +1 -1
  54. package/build/matchers/to-be-busy.d.ts +2 -2
  55. package/build/matchers/to-be-busy.js +5 -5
  56. package/build/matchers/to-be-busy.js.map +1 -1
  57. package/build/matchers/to-be-checked.d.ts +2 -2
  58. package/build/matchers/to-be-checked.js +9 -9
  59. package/build/matchers/to-be-checked.js.map +1 -1
  60. package/build/matchers/to-be-disabled.d.ts +3 -3
  61. package/build/matchers/to-be-disabled.js +10 -10
  62. package/build/matchers/to-be-disabled.js.map +1 -1
  63. package/build/matchers/to-be-empty-element.d.ts +2 -2
  64. package/build/matchers/to-be-empty-element.js +4 -4
  65. package/build/matchers/to-be-empty-element.js.map +1 -1
  66. package/build/matchers/to-be-expanded.d.ts +3 -3
  67. package/build/matchers/to-be-expanded.js +10 -10
  68. package/build/matchers/to-be-expanded.js.map +1 -1
  69. package/build/matchers/to-be-on-the-screen.d.ts +2 -2
  70. package/build/matchers/to-be-on-the-screen.js +7 -7
  71. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  72. package/build/matchers/to-be-partially-checked.d.ts +2 -2
  73. package/build/matchers/to-be-partially-checked.js +8 -8
  74. package/build/matchers/to-be-partially-checked.js.map +1 -1
  75. package/build/matchers/to-be-selected.d.ts +2 -2
  76. package/build/matchers/to-be-selected.js +4 -4
  77. package/build/matchers/to-be-selected.js.map +1 -1
  78. package/build/matchers/to-be-visible.d.ts +2 -2
  79. package/build/matchers/to-be-visible.js +12 -12
  80. package/build/matchers/to-be-visible.js.map +1 -1
  81. package/build/matchers/to-contain-element.d.ts +2 -2
  82. package/build/matchers/to-contain-element.js +6 -6
  83. package/build/matchers/to-contain-element.js.map +1 -1
  84. package/build/matchers/to-have-accessibility-value.d.ts +2 -2
  85. package/build/matchers/to-have-accessibility-value.js +6 -6
  86. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  87. package/build/matchers/to-have-accessible-name.d.ts +2 -2
  88. package/build/matchers/to-have-accessible-name.js +5 -10
  89. package/build/matchers/to-have-accessible-name.js.map +1 -1
  90. package/build/matchers/to-have-display-value.d.ts +2 -2
  91. package/build/matchers/to-have-display-value.js +6 -6
  92. package/build/matchers/to-have-display-value.js.map +1 -1
  93. package/build/matchers/to-have-prop.d.ts +2 -2
  94. package/build/matchers/to-have-prop.js +6 -6
  95. package/build/matchers/to-have-prop.js.map +1 -1
  96. package/build/matchers/to-have-style.d.ts +2 -2
  97. package/build/matchers/to-have-style.js +5 -5
  98. package/build/matchers/to-have-style.js.map +1 -1
  99. package/build/matchers/to-have-text-content.d.ts +2 -2
  100. package/build/matchers/to-have-text-content.js +4 -4
  101. package/build/matchers/to-have-text-content.js.map +1 -1
  102. package/build/matchers/types.d.ts +20 -20
  103. package/build/matchers/types.js.map +1 -1
  104. package/build/matchers/utils.d.ts +4 -4
  105. package/build/matchers/utils.js +6 -6
  106. package/build/matchers/utils.js.map +1 -1
  107. package/build/native-state.d.ts +3 -3
  108. package/build/native-state.js +2 -2
  109. package/build/native-state.js.map +1 -1
  110. package/build/queries/display-value.d.ts +2 -2
  111. package/build/queries/display-value.js +12 -12
  112. package/build/queries/display-value.js.map +1 -1
  113. package/build/queries/hint-text.d.ts +2 -2
  114. package/build/queries/hint-text.js +11 -11
  115. package/build/queries/hint-text.js.map +1 -1
  116. package/build/queries/label-text.d.ts +2 -2
  117. package/build/queries/label-text.js +9 -9
  118. package/build/queries/label-text.js.map +1 -1
  119. package/build/queries/make-queries.d.ts +8 -8
  120. package/build/queries/make-queries.js +11 -11
  121. package/build/queries/make-queries.js.map +1 -1
  122. package/build/queries/placeholder-text.d.ts +2 -2
  123. package/build/queries/placeholder-text.js +11 -11
  124. package/build/queries/placeholder-text.js.map +1 -1
  125. package/build/queries/role.d.ts +2 -2
  126. package/build/queries/role.js +17 -27
  127. package/build/queries/role.js.map +1 -1
  128. package/build/queries/test-id.d.ts +2 -2
  129. package/build/queries/test-id.js +11 -11
  130. package/build/queries/test-id.js.map +1 -1
  131. package/build/queries/text.d.ts +2 -2
  132. package/build/queries/text.js +9 -9
  133. package/build/queries/text.js.map +1 -1
  134. package/build/render.d.ts +3 -4
  135. package/build/render.js +17 -3
  136. package/build/render.js.map +1 -1
  137. package/build/screen.js.map +1 -1
  138. package/build/test-utils/react-version-gates.d.ts +1 -0
  139. package/build/test-utils/react-version-gates.js +28 -0
  140. package/build/test-utils/react-version-gates.js.map +1 -0
  141. package/build/types.d.ts +7 -0
  142. package/build/types.js.map +1 -1
  143. package/build/user-event/clear.d.ts +2 -2
  144. package/build/user-event/clear.js +13 -13
  145. package/build/user-event/clear.js.map +1 -1
  146. package/build/user-event/index.d.ts +7 -7
  147. package/build/user-event/index.js +6 -6
  148. package/build/user-event/index.js.map +1 -1
  149. package/build/user-event/paste.d.ts +2 -2
  150. package/build/user-event/paste.js +18 -18
  151. package/build/user-event/paste.js.map +1 -1
  152. package/build/user-event/press/press.d.ts +3 -3
  153. package/build/user-event/press/press.js +35 -35
  154. package/build/user-event/press/press.js.map +1 -1
  155. package/build/user-event/scroll/scroll-to.d.ts +2 -2
  156. package/build/user-event/scroll/scroll-to.js +20 -20
  157. package/build/user-event/scroll/scroll-to.js.map +1 -1
  158. package/build/user-event/setup/setup.d.ts +11 -11
  159. package/build/user-event/setup/setup.js.map +1 -1
  160. package/build/user-event/type/type.d.ts +3 -3
  161. package/build/user-event/type/type.js +27 -28
  162. package/build/user-event/type/type.js.map +1 -1
  163. package/build/user-event/utils/dispatch-event.d.ts +3 -3
  164. package/build/user-event/utils/dispatch-event.js +4 -4
  165. package/build/user-event/utils/dispatch-event.js.map +1 -1
  166. package/build/user-event/utils/index.d.ts +0 -1
  167. package/build/user-event/utils/index.js +0 -11
  168. package/build/user-event/utils/index.js.map +1 -1
  169. package/build/within.d.ts +3 -3
  170. package/build/within.js +10 -10
  171. package/build/within.js.map +1 -1
  172. package/package.json +38 -27
  173. package/build/tsconfig.release.tsbuildinfo +0 -1
  174. package/build/user-event/event-builder/base.js.map +0 -1
  175. package/build/user-event/event-builder/common.d.ts +0 -155
  176. package/build/user-event/event-builder/common.js +0 -77
  177. package/build/user-event/event-builder/common.js.map +0 -1
  178. package/build/user-event/event-builder/index.d.ts +0 -318
  179. package/build/user-event/event-builder/index.js +0 -15
  180. package/build/user-event/event-builder/index.js.map +0 -1
  181. package/build/user-event/event-builder/scroll-view.d.ts +0 -58
  182. package/build/user-event/event-builder/scroll-view.js +0 -53
  183. package/build/user-event/event-builder/scroll-view.js.map +0 -1
  184. package/build/user-event/event-builder/text-input.d.ts +0 -165
  185. package/build/user-event/event-builder/text-input.js +0 -105
  186. package/build/user-event/event-builder/text-input.js.map +0 -1
  187. package/build/user-event/utils/text-range.d.ts +0 -4
  188. package/build/user-event/utils/text-range.js +0 -6
  189. package/build/user-event/utils/text-range.js.map +0 -1
  190. /package/build/{user-event/event-builder → event-builder}/base.d.ts +0 -0
  191. /package/build/{user-event/event-builder → event-builder}/base.js +0 -0
@@ -1,5 +1,5 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toBeEmptyElement(this: jest.MatcherContext, element: HostElement): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toBeEmptyElement(this: jest.MatcherContext, instance: TestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -10,15 +10,15 @@ var _componentTree = require("../helpers/component-tree");
10
10
  var _formatElement = require("../helpers/format-element");
11
11
  var _utils = require("./utils");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- function toBeEmptyElement(element) {
14
- (0, _utils.checkHostElement)(element, toBeEmptyElement, this);
13
+ function toBeEmptyElement(instance) {
14
+ (0, _utils.checkHostElement)(instance, toBeEmptyElement, this);
15
15
 
16
16
  // TODO check
17
- const children = element.children.filter(child => (0, _componentTree.isHostElement)(child));
17
+ const children = instance.children.filter(child => (0, _componentTree.isTestInstance)(child));
18
18
  return {
19
19
  pass: children.length === 0,
20
20
  message: () => {
21
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''), '', 'Received:', `${(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _redent.default)((0, _formatElement.formatElementList)(children), 2))}`].join('\n');
21
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'instance', ''), '', 'Received:', `${(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _redent.default)((0, _formatElement.formatElementList)(children), 2))}`].join('\n');
22
22
  }
23
23
  };
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_componentTree","_formatElement","_utils","e","__esModule","default","toBeEmptyElement","element","checkHostElement","children","filter","child","isHostElement","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","redent","formatElementList","join"],"sources":["../../src/matchers/to-be-empty-element.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { isHostElement } from '../helpers/component-tree';\nimport { formatElementList } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeEmptyElement, this);\n\n // TODO check\n const children = element.children.filter((child) => isHostElement(child));\n\n return {\n pass: children.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(redent(formatElementList(children), 2))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,gBAAgBA,CAA4BC,OAAoB,EAAE;EAChF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;;EAEjD;EACA,MAAMG,QAAQ,GAAGF,OAAO,CAACE,QAAQ,CAACC,MAAM,CAAEC,KAAK,IAAK,IAAAC,4BAAa,EAACD,KAAK,CAAC,CAAC;EAEzE,OAAO;IACLE,IAAI,EAAEJ,QAAQ,CAACK,MAAM,KAAK,CAAC;IAC3BC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC1E,EAAE,EACF,WAAW,EACX,GAAG,IAAAC,gCAAc,EAAC,IAAAC,eAAM,EAAC,IAAAC,gCAAiB,EAACX,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAC5D,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_componentTree","_formatElement","_utils","e","__esModule","default","toBeEmptyElement","instance","checkHostElement","children","filter","child","isTestInstance","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","redent","formatElementList","join"],"sources":["../../src/matchers/to-be-empty-element.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { isTestInstance } from '../helpers/component-tree';\nimport { formatElementList } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, instance: TestInstance) {\n checkHostElement(instance, toBeEmptyElement, this);\n\n // TODO check\n const children = instance.children.filter((child) => isTestInstance(child));\n\n return {\n pass: children.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'instance', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(redent(formatElementList(children), 2))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,gBAAgBA,CAA4BC,QAAsB,EAAE;EAClF,IAAAC,uBAAgB,EAACD,QAAQ,EAAED,gBAAgB,EAAE,IAAI,CAAC;;EAElD;EACA,MAAMG,QAAQ,GAAGF,QAAQ,CAACE,QAAQ,CAACC,MAAM,CAAEC,KAAK,IAAK,IAAAC,6BAAc,EAACD,KAAK,CAAC,CAAC;EAE3E,OAAO;IACLE,IAAI,EAAEJ,QAAQ,CAACK,MAAM,KAAK,CAAC;IAC3BC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,UAAU,EAAE,EAAE,CAAC,EAC3E,EAAE,EACF,WAAW,EACX,GAAG,IAAAC,gCAAc,EAAC,IAAAC,eAAM,EAAC,IAAAC,gCAAiB,EAACX,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAC5D,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toBeExpanded(this: jest.MatcherContext, element: HostElement): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toBeExpanded(this: jest.MatcherContext, instance: TestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
6
- export declare function toBeCollapsed(this: jest.MatcherContext, element: HostElement): {
6
+ export declare function toBeCollapsed(this: jest.MatcherContext, instance: TestInstance): {
7
7
  pass: boolean;
8
8
  message: () => string;
9
9
  };
@@ -11,23 +11,23 @@ var _accessibility = require("../helpers/accessibility");
11
11
  var _formatElement = require("../helpers/format-element");
12
12
  var _utils = require("./utils");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function toBeExpanded(element) {
15
- (0, _utils.checkHostElement)(element, toBeExpanded, this);
14
+ function toBeExpanded(instance) {
15
+ (0, _utils.checkHostElement)(instance, toBeExpanded, this);
16
16
  return {
17
- pass: (0, _accessibility.computeAriaExpanded)(element) === true,
17
+ pass: (0, _accessibility.computeAriaExpanded)(instance) === true,
18
18
  message: () => {
19
- const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');
20
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}expanded:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
19
+ const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'instance', '');
20
+ return [matcher, '', `Received instance is ${this.isNot ? '' : 'not '}expanded:`, (0, _redent.default)((0, _formatElement.formatElement)(instance), 2)].join('\n');
21
21
  }
22
22
  };
23
23
  }
24
- function toBeCollapsed(element) {
25
- (0, _utils.checkHostElement)(element, toBeCollapsed, this);
24
+ function toBeCollapsed(instance) {
25
+ (0, _utils.checkHostElement)(instance, toBeCollapsed, this);
26
26
  return {
27
- pass: (0, _accessibility.computeAriaExpanded)(element) === false,
27
+ pass: (0, _accessibility.computeAriaExpanded)(instance) === false,
28
28
  message: () => {
29
- const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');
30
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}collapsed:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
29
+ const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'instance', '');
30
+ return [matcher, '', `Received instance is ${this.isNot ? '' : 'not '}collapsed:`, (0, _redent.default)((0, _formatElement.formatElement)(instance), 2)].join('\n');
31
31
  }
32
32
  };
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeExpanded","element","checkHostElement","pass","computeAriaExpanded","message","matcher","matcherHint","isNot","redent","formatElement","join","toBeCollapsed"],"sources":["../../src/matchers/to-be-expanded.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { computeAriaExpanded } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeExpanded, this);\n\n return {\n pass: computeAriaExpanded(element) === true,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}expanded:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeCollapsed(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeCollapsed, this);\n\n return {\n pass: computeAriaExpanded(element) === false,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}collapsed:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,YAAYA,CAA4BC,OAAoB,EAAE;EAC5E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC,KAAK,IAAI;IAC3CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC;MACtF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,WAAW,EAC1D,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,aAAaA,CAA4BX,OAAoB,EAAE;EAC7E,IAAAC,uBAAgB,EAACD,OAAO,EAAEW,aAAa,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLT,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC,KAAK,KAAK;IAC5CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,CAAC;MACvF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,YAAY,EAC3D,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeExpanded","instance","checkHostElement","pass","computeAriaExpanded","message","matcher","matcherHint","isNot","redent","formatElement","join","toBeCollapsed"],"sources":["../../src/matchers/to-be-expanded.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { computeAriaExpanded } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, instance: TestInstance) {\n checkHostElement(instance, toBeExpanded, this);\n\n return {\n pass: computeAriaExpanded(instance) === true,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'instance', '');\n return [\n matcher,\n '',\n `Received instance is ${this.isNot ? '' : 'not '}expanded:`,\n redent(formatElement(instance), 2),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeCollapsed(this: jest.MatcherContext, instance: TestInstance) {\n checkHostElement(instance, toBeCollapsed, this);\n\n return {\n pass: computeAriaExpanded(instance) === false,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'instance', '');\n return [\n matcher,\n '',\n `Received instance is ${this.isNot ? '' : 'not '}collapsed:`,\n redent(formatElement(instance), 2),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,YAAYA,CAA4BC,QAAsB,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,QAAQ,EAAED,YAAY,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLG,IAAI,EAAE,IAAAC,kCAAmB,EAACH,QAAQ,CAAC,KAAK,IAAI;IAC5CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,CAAC;MACvF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,wBAAwB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,WAAW,EAC3D,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,QAAQ,CAAC,EAAE,CAAC,CAAC,CACnC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,aAAaA,CAA4BX,QAAsB,EAAE;EAC/E,IAAAC,uBAAgB,EAACD,QAAQ,EAAEW,aAAa,EAAE,IAAI,CAAC;EAE/C,OAAO;IACLT,IAAI,EAAE,IAAAC,kCAAmB,EAACH,QAAQ,CAAC,KAAK,KAAK;IAC7CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,CAAC;MACxF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,wBAAwB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,YAAY,EAC5D,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,QAAQ,CAAC,EAAE,CAAC,CAAC,CACnC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toBeOnTheScreen(this: jest.MatcherContext, element: HostElement): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toBeOnTheScreen(this: jest.MatcherContext, instance: TestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -11,21 +11,21 @@ var _formatElement = require("../helpers/format-element");
11
11
  var _screen = require("../screen");
12
12
  var _utils = require("./utils");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function toBeOnTheScreen(element) {
15
- if (element !== null || !this.isNot) {
16
- (0, _utils.checkHostElement)(element, toBeOnTheScreen, this);
14
+ function toBeOnTheScreen(instance) {
15
+ if (instance !== null || !this.isNot) {
16
+ (0, _utils.checkHostElement)(instance, toBeOnTheScreen, this);
17
17
  }
18
- const pass = element === null ? false : _screen.screen.container === (0, _componentTree.getContainerElement)(element);
18
+ const pass = instance === null ? false : _screen.screen.container === (0, _componentTree.getContainerInstance)(instance);
19
19
  const errorFound = () => {
20
- return `expected element tree not to contain element, but found\n${(0, _redent.default)((0, _formatElement.formatElement)(element), 2)}`;
20
+ return `expected instance tree not to contain instance, but found\n${(0, _redent.default)((0, _formatElement.formatElement)(instance), 2)}`;
21
21
  };
22
22
  const errorNotFound = () => {
23
- return `element could not be found in the element tree`;
23
+ return `instance could not be found in the instance tree`;
24
24
  };
25
25
  return {
26
26
  pass,
27
27
  message: () => {
28
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'element', ''), '', (0, _jestMatcherUtils.RECEIVED_COLOR)(this.isNot ? errorFound() : errorNotFound())].join('\n');
28
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'instance', ''), '', (0, _jestMatcherUtils.RECEIVED_COLOR)(this.isNot ? errorFound() : errorNotFound())].join('\n');
29
29
  }
30
30
  };
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_componentTree","_formatElement","_screen","_utils","e","__esModule","default","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","container","getContainerElement","errorFound","redent","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { getContainerElement } from '../helpers/component-tree';\nimport { formatElement } from '../helpers/format-element';\nimport { screen } from '../screen';\nimport { checkHostElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, element: HostElement) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeOnTheScreen, this);\n }\n\n const pass = element === null ? false : screen.container === getContainerElement(element);\n\n const errorFound = () => {\n return `expected element tree not to contain element, but found\\n${redent(\n formatElement(element),\n 2,\n )}`;\n };\n\n const errorNotFound = () => {\n return `element could not be found in the element tree`;\n };\n\n return {\n pass,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'element', ''),\n '',\n RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,eAAeA,CAA4BC,OAAoB,EAAE;EAC/E,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,eAAe,EAAE,IAAI,CAAC;EAClD;EAEA,MAAMI,IAAI,GAAGH,OAAO,KAAK,IAAI,GAAG,KAAK,GAAGI,cAAM,CAACC,SAAS,KAAK,IAAAC,kCAAmB,EAACN,OAAO,CAAC;EAEzF,MAAMO,UAAU,GAAGA,CAAA,KAAM;IACvB,OAAO,4DAA4D,IAAAC,eAAM,EACvE,IAAAC,4BAAa,EAACT,OAAO,CAAC,EACtB,CACF,CAAC,EAAE;EACL,CAAC;EAED,MAAMU,aAAa,GAAGA,CAAA,KAAM;IAC1B,OAAO,gDAAgD;EACzD,CAAC;EAED,OAAO;IACLP,IAAI;IACJQ,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACX,KAAK,GAAG,MAAM,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,CAAC,EACzE,EAAE,EACF,IAAAY,gCAAc,EAAC,IAAI,CAACZ,KAAK,GAAGM,UAAU,CAAC,CAAC,GAAGG,aAAa,CAAC,CAAC,CAAC,CAC5D,CAACI,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_componentTree","_formatElement","_screen","_utils","e","__esModule","default","toBeOnTheScreen","instance","isNot","checkHostElement","pass","screen","container","getContainerInstance","errorFound","redent","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { getContainerInstance } from '../helpers/component-tree';\nimport { formatElement } from '../helpers/format-element';\nimport { screen } from '../screen';\nimport { checkHostElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, instance: TestInstance) {\n if (instance !== null || !this.isNot) {\n checkHostElement(instance, toBeOnTheScreen, this);\n }\n\n const pass = instance === null ? false : screen.container === getContainerInstance(instance);\n\n const errorFound = () => {\n return `expected instance tree not to contain instance, but found\\n${redent(\n formatElement(instance),\n 2,\n )}`;\n };\n\n const errorNotFound = () => {\n return `instance could not be found in the instance tree`;\n };\n\n return {\n pass,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'instance', ''),\n '',\n RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,eAAeA,CAA4BC,QAAsB,EAAE;EACjF,IAAIA,QAAQ,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACpC,IAAAC,uBAAgB,EAACF,QAAQ,EAAED,eAAe,EAAE,IAAI,CAAC;EACnD;EAEA,MAAMI,IAAI,GAAGH,QAAQ,KAAK,IAAI,GAAG,KAAK,GAAGI,cAAM,CAACC,SAAS,KAAK,IAAAC,mCAAoB,EAACN,QAAQ,CAAC;EAE5F,MAAMO,UAAU,GAAGA,CAAA,KAAM;IACvB,OAAO,8DAA8D,IAAAC,eAAM,EACzE,IAAAC,4BAAa,EAACT,QAAQ,CAAC,EACvB,CACF,CAAC,EAAE;EACL,CAAC;EAED,MAAMU,aAAa,GAAGA,CAAA,KAAM;IAC1B,OAAO,kDAAkD;EAC3D,CAAC;EAED,OAAO;IACLP,IAAI;IACJQ,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACX,KAAK,GAAG,MAAM,GAAG,EAAE,kBAAkB,EAAE,UAAU,EAAE,EAAE,CAAC,EAC1E,EAAE,EACF,IAAAY,gCAAc,EAAC,IAAI,CAACZ,KAAK,GAAGM,UAAU,CAAC,CAAC,GAAGG,aAAa,CAAC,CAAC,CAAC,CAC5D,CAACI,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toBePartiallyChecked(this: jest.MatcherContext, element: HostElement): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toBePartiallyChecked(this: jest.MatcherContext, instance: TestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -11,21 +11,21 @@ var _errors = require("../helpers/errors");
11
11
  var _formatElement = require("../helpers/format-element");
12
12
  var _utils = require("./utils");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function toBePartiallyChecked(element) {
15
- (0, _utils.checkHostElement)(element, toBePartiallyChecked, this);
16
- if (!hasValidAccessibilityRole(element)) {
14
+ function toBePartiallyChecked(instance) {
15
+ (0, _utils.checkHostElement)(instance, toBePartiallyChecked, this);
16
+ if (!hasValidAccessibilityRole(instance)) {
17
17
  throw new _errors.ErrorWithStack('toBePartiallyChecked() works only on accessibility elements with "checkbox" role.', toBePartiallyChecked);
18
18
  }
19
19
  return {
20
- pass: (0, _accessibility.computeAriaChecked)(element) === 'mixed',
20
+ pass: (0, _accessibility.computeAriaChecked)(instance) === 'mixed',
21
21
  message: () => {
22
22
  const is = this.isNot ? 'is' : 'is not';
23
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''), '', `Received element ${is} partially checked:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
23
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'instance', ''), '', `Received instance ${is} partially checked:`, (0, _redent.default)((0, _formatElement.formatElement)(instance), 2)].join('\n');
24
24
  }
25
25
  };
26
26
  }
27
- function hasValidAccessibilityRole(element) {
28
- const role = (0, _accessibility.getRole)(element);
29
- return (0, _accessibility.isAccessibilityElement)(element) && role === 'checkbox';
27
+ function hasValidAccessibilityRole(instance) {
28
+ const role = (0, _accessibility.getRole)(instance);
29
+ return (0, _accessibility.isAccessibilityElement)(instance) && role === 'checkbox';
30
30
  }
31
31
  //# sourceMappingURL=to-be-partially-checked.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-partially-checked.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_errors","_formatElement","_utils","e","__esModule","default","toBePartiallyChecked","element","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","redent","formatElement","join","role","getRole","isAccessibilityElement"],"sources":["../../src/matchers/to-be-partially-checked.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { computeAriaChecked, getRole, isAccessibilityElement } from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBePartiallyChecked(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBePartiallyChecked, this);\n\n if (!hasValidAccessibilityRole(element)) {\n throw new ErrorWithStack(\n 'toBePartiallyChecked() works only on accessibility elements with \"checkbox\" role.',\n toBePartiallyChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === 'mixed',\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''),\n '',\n `Received element ${is} partially checked:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction hasValidAccessibilityRole(element: HostElement) {\n const role = getRole(element);\n return isAccessibilityElement(element) && role === 'checkbox';\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,oBAAoBA,CAA4BC,OAAoB,EAAE;EACpF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAErD,IAAI,CAACG,yBAAyB,CAACF,OAAO,CAAC,EAAE;IACvC,MAAM,IAAIG,sBAAc,CACtB,mFAAmF,EACnFJ,oBACF,CAAC;EACH;EAEA,OAAO;IACLK,IAAI,EAAE,IAAAC,iCAAkB,EAACL,OAAO,CAAC,KAAK,OAAO;IAC7CM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,uBAAuB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC9E,EAAE,EACF,oBAAoBD,EAAE,qBAAqB,EAC3C,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACX,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASV,yBAAyBA,CAACF,OAAoB,EAAE;EACvD,MAAMa,IAAI,GAAG,IAAAC,sBAAO,EAACd,OAAO,CAAC;EAC7B,OAAO,IAAAe,qCAAsB,EAACf,OAAO,CAAC,IAAIa,IAAI,KAAK,UAAU;AAC/D","ignoreList":[]}
1
+ {"version":3,"file":"to-be-partially-checked.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_errors","_formatElement","_utils","e","__esModule","default","toBePartiallyChecked","instance","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","redent","formatElement","join","role","getRole","isAccessibilityElement"],"sources":["../../src/matchers/to-be-partially-checked.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { computeAriaChecked, getRole, isAccessibilityElement } from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBePartiallyChecked(this: jest.MatcherContext, instance: TestInstance) {\n checkHostElement(instance, toBePartiallyChecked, this);\n\n if (!hasValidAccessibilityRole(instance)) {\n throw new ErrorWithStack(\n 'toBePartiallyChecked() works only on accessibility elements with \"checkbox\" role.',\n toBePartiallyChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(instance) === 'mixed',\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'instance', ''),\n '',\n `Received instance ${is} partially checked:`,\n redent(formatElement(instance), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction hasValidAccessibilityRole(instance: TestInstance) {\n const role = getRole(instance);\n return isAccessibilityElement(instance) && role === 'checkbox';\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,oBAAoBA,CAA4BC,QAAsB,EAAE;EACtF,IAAAC,uBAAgB,EAACD,QAAQ,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAEtD,IAAI,CAACG,yBAAyB,CAACF,QAAQ,CAAC,EAAE;IACxC,MAAM,IAAIG,sBAAc,CACtB,mFAAmF,EACnFJ,oBACF,CAAC;EACH;EAEA,OAAO;IACLK,IAAI,EAAE,IAAAC,iCAAkB,EAACL,QAAQ,CAAC,KAAK,OAAO;IAC9CM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,uBAAuB,EAAE,UAAU,EAAE,EAAE,CAAC,EAC/E,EAAE,EACF,qBAAqBD,EAAE,qBAAqB,EAC5C,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACX,QAAQ,CAAC,EAAE,CAAC,CAAC,CACnC,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASV,yBAAyBA,CAACF,QAAsB,EAAE;EACzD,MAAMa,IAAI,GAAG,IAAAC,sBAAO,EAACd,QAAQ,CAAC;EAC9B,OAAO,IAAAe,qCAAsB,EAACf,QAAQ,CAAC,IAAIa,IAAI,KAAK,UAAU;AAChE","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toBeSelected(this: jest.MatcherContext, element: HostElement): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toBeSelected(this: jest.MatcherContext, instance: TestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -10,13 +10,13 @@ var _accessibility = require("../helpers/accessibility");
10
10
  var _formatElement = require("../helpers/format-element");
11
11
  var _utils = require("./utils");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- function toBeSelected(element) {
14
- (0, _utils.checkHostElement)(element, toBeSelected, this);
13
+ function toBeSelected(instance) {
14
+ (0, _utils.checkHostElement)(instance, toBeSelected, this);
15
15
  return {
16
- pass: (0, _accessibility.computeAriaSelected)(element),
16
+ pass: (0, _accessibility.computeAriaSelected)(instance),
17
17
  message: () => {
18
18
  const is = this.isNot ? 'is' : 'is not';
19
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeSelected`, 'element', ''), '', `Received element ${is} selected`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
19
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeSelected`, 'instance', ''), '', `Received instance ${is} selected`, (0, _redent.default)((0, _formatElement.formatElement)(instance), 2)].join('\n');
20
20
  }
21
21
  };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-selected.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeSelected","element","checkHostElement","pass","computeAriaSelected","message","is","isNot","matcherHint","redent","formatElement","join"],"sources":["../../src/matchers/to-be-selected.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { computeAriaSelected } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeSelected(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeSelected, this);\n\n return {\n pass: computeAriaSelected(element),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeSelected`, 'element', ''),\n '',\n `Received element ${is} selected`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,YAAYA,CAA4BC,OAAoB,EAAE;EAC5E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC;IAClCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC,EACtE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-selected.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeSelected","instance","checkHostElement","pass","computeAriaSelected","message","is","isNot","matcherHint","redent","formatElement","join"],"sources":["../../src/matchers/to-be-selected.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { computeAriaSelected } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeSelected(this: jest.MatcherContext, instance: TestInstance) {\n checkHostElement(instance, toBeSelected, this);\n\n return {\n pass: computeAriaSelected(instance),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeSelected`, 'instance', ''),\n '',\n `Received instance ${is} selected`,\n redent(formatElement(instance), 2),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,YAAYA,CAA4BC,QAAsB,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,QAAQ,EAAED,YAAY,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLG,IAAI,EAAE,IAAAC,kCAAmB,EAACH,QAAQ,CAAC;IACnCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,CAAC,EACvE,EAAE,EACF,qBAAqBD,EAAE,WAAW,EAClC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACT,QAAQ,CAAC,EAAE,CAAC,CAAC,CACnC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toBeVisible(this: jest.MatcherContext, element: HostElement): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toBeVisible(this: jest.MatcherContext, instance: TestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -12,43 +12,43 @@ var _formatElement = require("../helpers/format-element");
12
12
  var _hostComponentNames = require("../helpers/host-component-names");
13
13
  var _utils = require("./utils");
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function toBeVisible(element) {
16
- if (element !== null || !this.isNot) {
17
- (0, _utils.checkHostElement)(element, toBeVisible, this);
15
+ function toBeVisible(instance) {
16
+ if (instance !== null || !this.isNot) {
17
+ (0, _utils.checkHostElement)(instance, toBeVisible, this);
18
18
  }
19
19
  return {
20
- pass: isElementVisible(element),
20
+ pass: isElementVisible(instance),
21
21
  message: () => {
22
22
  const is = this.isNot ? 'is' : 'is not';
23
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''), '', `Received element ${is} visible:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
23
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeVisible`, 'instance', ''), '', `Received instance ${is} visible:`, (0, _redent.default)((0, _formatElement.formatElement)(instance), 2)].join('\n');
24
24
  }
25
25
  };
26
26
  }
27
- function isElementVisible(element, accessibilityCache) {
27
+ function isElementVisible(instance, accessibilityCache) {
28
28
  // Use cache to speed up repeated searches by `isHiddenFromAccessibility`.
29
29
  const cache = accessibilityCache ?? new WeakMap();
30
- if ((0, _accessibility.isHiddenFromAccessibility)(element, {
30
+ if ((0, _accessibility.isHiddenFromAccessibility)(instance, {
31
31
  cache
32
32
  })) {
33
33
  return false;
34
34
  }
35
- if (isHiddenForStyles(element)) {
35
+ if (isHiddenForStyles(instance)) {
36
36
  return false;
37
37
  }
38
38
 
39
39
  // Note: this seems to be a bug in React Native.
40
40
  // PR with fix: https://github.com/facebook/react-native/pull/39157
41
- if ((0, _hostComponentNames.isHostModal)(element) && element.props.visible === false) {
41
+ if ((0, _hostComponentNames.isHostModal)(instance) && instance.props.visible === false) {
42
42
  return false;
43
43
  }
44
- const parent = element.parent;
44
+ const parent = instance.parent;
45
45
  if (parent === null) {
46
46
  return true;
47
47
  }
48
48
  return isElementVisible(parent, cache);
49
49
  }
50
- function isHiddenForStyles(element) {
51
- const flatStyle = _reactNative.StyleSheet.flatten(element.props.style);
50
+ function isHiddenForStyles(instance) {
51
+ const flatStyle = _reactNative.StyleSheet.flatten(instance.props.style);
52
52
  return flatStyle?.display === 'none' || flatStyle?.opacity === 0;
53
53
  }
54
54
  //# sourceMappingURL=to-be-visible.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-visible.js","names":["_reactNative","require","_jestMatcherUtils","_redent","_interopRequireDefault","_accessibility","_formatElement","_hostComponentNames","_utils","e","__esModule","default","toBeVisible","element","isNot","checkHostElement","pass","isElementVisible","message","is","matcherHint","redent","formatElement","join","accessibilityCache","cache","WeakMap","isHiddenFromAccessibility","isHiddenForStyles","isHostModal","props","visible","parent","flatStyle","StyleSheet","flatten","style","display","opacity"],"sources":["../../src/matchers/to-be-visible.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { isHiddenFromAccessibility } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { isHostModal } from '../helpers/host-component-names';\nimport { checkHostElement } from './utils';\n\nexport function toBeVisible(this: jest.MatcherContext, element: HostElement) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeVisible, this);\n }\n\n return {\n pass: isElementVisible(element),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''),\n '',\n `Received element ${is} visible:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction isElementVisible(\n element: HostElement,\n accessibilityCache?: WeakMap<HostElement, boolean>,\n): boolean {\n // Use cache to speed up repeated searches by `isHiddenFromAccessibility`.\n const cache = accessibilityCache ?? new WeakMap<HostElement, boolean>();\n if (isHiddenFromAccessibility(element, { cache })) {\n return false;\n }\n\n if (isHiddenForStyles(element)) {\n return false;\n }\n\n // Note: this seems to be a bug in React Native.\n // PR with fix: https://github.com/facebook/react-native/pull/39157\n if (isHostModal(element) && element.props.visible === false) {\n return false;\n }\n\n const parent = element.parent;\n if (parent === null) {\n return true;\n }\n\n return isElementVisible(parent, cache);\n}\n\nfunction isHiddenForStyles(element: HostElement) {\n const flatStyle = StyleSheet.flatten(element.props.style);\n return flatStyle?.display === 'none' || flatStyle?.opacity === 0;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA2C,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,WAAWA,CAA4BC,OAAoB,EAAE;EAC3E,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAC9C;EAEA,OAAO;IACLI,IAAI,EAAEC,gBAAgB,CAACJ,OAAO,CAAC;IAC/BK,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACL,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAM,6BAAW,EAAC,GAAG,IAAI,CAACN,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBK,EAAE,WAAW,EACjC,IAAAE,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASN,gBAAgBA,CACvBJ,OAAoB,EACpBW,kBAAkD,EACzC;EACT;EACA,MAAMC,KAAK,GAAGD,kBAAkB,IAAI,IAAIE,OAAO,CAAuB,CAAC;EACvE,IAAI,IAAAC,wCAAyB,EAACd,OAAO,EAAE;IAAEY;EAAM,CAAC,CAAC,EAAE;IACjD,OAAO,KAAK;EACd;EAEA,IAAIG,iBAAiB,CAACf,OAAO,CAAC,EAAE;IAC9B,OAAO,KAAK;EACd;;EAEA;EACA;EACA,IAAI,IAAAgB,+BAAW,EAAChB,OAAO,CAAC,IAAIA,OAAO,CAACiB,KAAK,CAACC,OAAO,KAAK,KAAK,EAAE;IAC3D,OAAO,KAAK;EACd;EAEA,MAAMC,MAAM,GAAGnB,OAAO,CAACmB,MAAM;EAC7B,IAAIA,MAAM,KAAK,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,OAAOf,gBAAgB,CAACe,MAAM,EAAEP,KAAK,CAAC;AACxC;AAEA,SAASG,iBAAiBA,CAACf,OAAoB,EAAE;EAC/C,MAAMoB,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACtB,OAAO,CAACiB,KAAK,CAACM,KAAK,CAAC;EACzD,OAAOH,SAAS,EAAEI,OAAO,KAAK,MAAM,IAAIJ,SAAS,EAAEK,OAAO,KAAK,CAAC;AAClE","ignoreList":[]}
1
+ {"version":3,"file":"to-be-visible.js","names":["_reactNative","require","_jestMatcherUtils","_redent","_interopRequireDefault","_accessibility","_formatElement","_hostComponentNames","_utils","e","__esModule","default","toBeVisible","instance","isNot","checkHostElement","pass","isElementVisible","message","is","matcherHint","redent","formatElement","join","accessibilityCache","cache","WeakMap","isHiddenFromAccessibility","isHiddenForStyles","isHostModal","props","visible","parent","flatStyle","StyleSheet","flatten","style","display","opacity"],"sources":["../../src/matchers/to-be-visible.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { isHiddenFromAccessibility } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { isHostModal } from '../helpers/host-component-names';\nimport { checkHostElement } from './utils';\n\nexport function toBeVisible(this: jest.MatcherContext, instance: TestInstance) {\n if (instance !== null || !this.isNot) {\n checkHostElement(instance, toBeVisible, this);\n }\n\n return {\n pass: isElementVisible(instance),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeVisible`, 'instance', ''),\n '',\n `Received instance ${is} visible:`,\n redent(formatElement(instance), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction isElementVisible(\n instance: TestInstance,\n accessibilityCache?: WeakMap<TestInstance, boolean>,\n): boolean {\n // Use cache to speed up repeated searches by `isHiddenFromAccessibility`.\n const cache = accessibilityCache ?? new WeakMap<TestInstance, boolean>();\n if (isHiddenFromAccessibility(instance, { cache })) {\n return false;\n }\n\n if (isHiddenForStyles(instance)) {\n return false;\n }\n\n // Note: this seems to be a bug in React Native.\n // PR with fix: https://github.com/facebook/react-native/pull/39157\n if (isHostModal(instance) && instance.props.visible === false) {\n return false;\n }\n\n const parent = instance.parent;\n if (parent === null) {\n return true;\n }\n\n return isElementVisible(parent, cache);\n}\n\nfunction isHiddenForStyles(instance: TestInstance) {\n const flatStyle = StyleSheet.flatten(instance.props.style);\n return flatStyle?.display === 'none' || flatStyle?.opacity === 0;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA2C,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,WAAWA,CAA4BC,QAAsB,EAAE;EAC7E,IAAIA,QAAQ,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACpC,IAAAC,uBAAgB,EAACF,QAAQ,EAAED,WAAW,EAAE,IAAI,CAAC;EAC/C;EAEA,OAAO;IACLI,IAAI,EAAEC,gBAAgB,CAACJ,QAAQ,CAAC;IAChCK,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACL,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAM,6BAAW,EAAC,GAAG,IAAI,CAACN,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,CAAC,EACtE,EAAE,EACF,qBAAqBK,EAAE,WAAW,EAClC,IAAAE,eAAM,EAAC,IAAAC,4BAAa,EAACT,QAAQ,CAAC,EAAE,CAAC,CAAC,CACnC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASN,gBAAgBA,CACvBJ,QAAsB,EACtBW,kBAAmD,EAC1C;EACT;EACA,MAAMC,KAAK,GAAGD,kBAAkB,IAAI,IAAIE,OAAO,CAAwB,CAAC;EACxE,IAAI,IAAAC,wCAAyB,EAACd,QAAQ,EAAE;IAAEY;EAAM,CAAC,CAAC,EAAE;IAClD,OAAO,KAAK;EACd;EAEA,IAAIG,iBAAiB,CAACf,QAAQ,CAAC,EAAE;IAC/B,OAAO,KAAK;EACd;;EAEA;EACA;EACA,IAAI,IAAAgB,+BAAW,EAAChB,QAAQ,CAAC,IAAIA,QAAQ,CAACiB,KAAK,CAACC,OAAO,KAAK,KAAK,EAAE;IAC7D,OAAO,KAAK;EACd;EAEA,MAAMC,MAAM,GAAGnB,QAAQ,CAACmB,MAAM;EAC9B,IAAIA,MAAM,KAAK,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,OAAOf,gBAAgB,CAACe,MAAM,EAAEP,KAAK,CAAC;AACxC;AAEA,SAASG,iBAAiBA,CAACf,QAAsB,EAAE;EACjD,MAAMoB,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACtB,QAAQ,CAACiB,KAAK,CAACM,KAAK,CAAC;EAC1D,OAAOH,SAAS,EAAEI,OAAO,KAAK,MAAM,IAAIJ,SAAS,EAAEK,OAAO,KAAK,CAAC;AAClE","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { HostElement } from 'test-renderer';
2
- export declare function toContainElement(this: jest.MatcherContext, container: HostElement, element: HostElement | null): {
1
+ import type { TestInstance } from 'test-renderer';
2
+ export declare function toContainElement(this: jest.MatcherContext, container: TestInstance, instance: TestInstance | null): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -9,19 +9,19 @@ var _redent = _interopRequireDefault(require("redent"));
9
9
  var _formatElement = require("../helpers/format-element");
10
10
  var _utils = require("./utils");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function toContainElement(container, element) {
12
+ function toContainElement(container, instance) {
13
13
  (0, _utils.checkHostElement)(container, toContainElement, this);
14
- if (element !== null) {
15
- (0, _utils.checkHostElement)(element, toContainElement, this);
14
+ if (instance !== null) {
15
+ (0, _utils.checkHostElement)(instance, toContainElement, this);
16
16
  }
17
17
  let matches = [];
18
- if (element) {
19
- matches = container.queryAll(node => node === element);
18
+ if (instance) {
19
+ matches = container.queryAll(node => node === instance);
20
20
  }
21
21
  return {
22
22
  pass: matches.length > 0,
23
23
  message: () => {
24
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'element'), '', (0, _jestMatcherUtils.RECEIVED_COLOR)(`${(0, _redent.default)((0, _formatElement.formatElement)(container), 2)} ${this.isNot ? '\n\ncontains:\n\n' : '\n\ndoes not contain:\n\n'} ${(0, _redent.default)((0, _formatElement.formatElement)(element), 2)}
24
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'instance'), '', (0, _jestMatcherUtils.RECEIVED_COLOR)(`${(0, _redent.default)((0, _formatElement.formatElement)(container), 2)} ${this.isNot ? '\n\ncontains:\n\n' : '\n\ndoes not contain:\n\n'} ${(0, _redent.default)((0, _formatElement.formatElement)(instance), 2)}
25
25
  `)].join('\n');
26
26
  }
27
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-contain-element.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_formatElement","_utils","e","__esModule","default","toContainElement","container","element","checkHostElement","matches","queryAll","node","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","redent","formatElement","join"],"sources":["../../src/matchers/to-contain-element.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'test-renderer';\n\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toContainElement(\n this: jest.MatcherContext,\n container: HostElement,\n element: HostElement | null,\n) {\n checkHostElement(container, toContainElement, this);\n\n if (element !== null) {\n checkHostElement(element, toContainElement, this);\n }\n\n let matches: HostElement[] = [];\n if (element) {\n matches = container.queryAll((node) => node === element);\n }\n\n return {\n pass: matches.length > 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'element'),\n '',\n RECEIVED_COLOR(`${redent(formatElement(container), 2)} ${\n this.isNot ? '\\n\\ncontains:\\n\\n' : '\\n\\ndoes not contain:\\n\\n'\n } ${redent(formatElement(element), 2)}\n `),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA2C,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,gBAAgBA,CAE9BC,SAAsB,EACtBC,OAA2B,EAC3B;EACA,IAAAC,uBAAgB,EAACF,SAAS,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEnD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,IAAAC,uBAAgB,EAACD,OAAO,EAAEF,gBAAgB,EAAE,IAAI,CAAC;EACnD;EAEA,IAAII,OAAsB,GAAG,EAAE;EAC/B,IAAIF,OAAO,EAAE;IACXE,OAAO,GAAGH,SAAS,CAACI,QAAQ,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,OAAO,CAAC;EAC1D;EAEA,OAAO;IACLK,IAAI,EAAEH,OAAO,CAACI,MAAM,GAAG,CAAC;IACxBC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,WAAW,EAAE,SAAS,CAAC,EACnF,EAAE,EACF,IAAAC,gCAAc,EAAC,GAAG,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACb,SAAS,CAAC,EAAE,CAAC,CAAC,IACnD,IAAI,CAACU,KAAK,GAAG,mBAAmB,GAAG,2BAA2B,IAC5D,IAAAE,eAAM,EAAC,IAAAC,4BAAa,EAACZ,OAAO,CAAC,EAAE,CAAC,CAAC;AAC7C,SAAS,CAAC,CACH,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-contain-element.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_formatElement","_utils","e","__esModule","default","toContainElement","container","instance","checkHostElement","matches","queryAll","node","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","redent","formatElement","join"],"sources":["../../src/matchers/to-contain-element.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { TestInstance } from 'test-renderer';\n\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toContainElement(\n this: jest.MatcherContext,\n container: TestInstance,\n instance: TestInstance | null,\n) {\n checkHostElement(container, toContainElement, this);\n\n if (instance !== null) {\n checkHostElement(instance, toContainElement, this);\n }\n\n let matches: TestInstance[] = [];\n if (instance) {\n matches = container.queryAll((node) => node === instance);\n }\n\n return {\n pass: matches.length > 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'instance'),\n '',\n RECEIVED_COLOR(`${redent(formatElement(container), 2)} ${\n this.isNot ? '\\n\\ncontains:\\n\\n' : '\\n\\ndoes not contain:\\n\\n'\n } ${redent(formatElement(instance), 2)}\n `),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA2C,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,gBAAgBA,CAE9BC,SAAuB,EACvBC,QAA6B,EAC7B;EACA,IAAAC,uBAAgB,EAACF,SAAS,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEnD,IAAIE,QAAQ,KAAK,IAAI,EAAE;IACrB,IAAAC,uBAAgB,EAACD,QAAQ,EAAEF,gBAAgB,EAAE,IAAI,CAAC;EACpD;EAEA,IAAII,OAAuB,GAAG,EAAE;EAChC,IAAIF,QAAQ,EAAE;IACZE,OAAO,GAAGH,SAAS,CAACI,QAAQ,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,QAAQ,CAAC;EAC3D;EAEA,OAAO;IACLK,IAAI,EAAEH,OAAO,CAACI,MAAM,GAAG,CAAC;IACxBC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,CAAC,EACpF,EAAE,EACF,IAAAC,gCAAc,EAAC,GAAG,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACb,SAAS,CAAC,EAAE,CAAC,CAAC,IACnD,IAAI,CAACU,KAAK,GAAG,mBAAmB,GAAG,2BAA2B,IAC5D,IAAAE,eAAM,EAAC,IAAAC,4BAAa,EAACZ,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC9C,SAAS,CAAC,CACH,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { HostElement } from 'test-renderer';
1
+ import type { TestInstance } from 'test-renderer';
2
2
  import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
3
- export declare function toHaveAccessibilityValue(this: jest.MatcherContext, element: HostElement, expectedValue: AccessibilityValueMatcher): {
3
+ export declare function toHaveAccessibilityValue(this: jest.MatcherContext, instance: TestInstance, expectedValue: AccessibilityValueMatcher): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -9,14 +9,14 @@ var _accessibility = require("../helpers/accessibility");
9
9
  var _matchAccessibilityValue = require("../helpers/matchers/match-accessibility-value");
10
10
  var _object = require("../helpers/object");
11
11
  var _utils = require("./utils");
12
- function toHaveAccessibilityValue(element, expectedValue) {
13
- (0, _utils.checkHostElement)(element, toHaveAccessibilityValue, this);
14
- const receivedValue = (0, _accessibility.computeAriaValue)(element);
12
+ function toHaveAccessibilityValue(instance, expectedValue) {
13
+ (0, _utils.checkHostElement)(instance, toHaveAccessibilityValue, this);
14
+ const receivedValue = (0, _accessibility.computeAriaValue)(instance);
15
15
  return {
16
- pass: (0, _matchAccessibilityValue.matchAccessibilityValue)(element, expectedValue),
16
+ pass: (0, _matchAccessibilityValue.matchAccessibilityValue)(instance, expectedValue),
17
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)));
18
+ const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`, 'instance', (0, _jestMatcherUtils.stringify)(expectedValue));
19
+ return (0, _utils.formatMessage)(matcher, `Expected the instance ${this.isNot ? 'not to' : 'to'} have accessibility value`, (0, _jestMatcherUtils.stringify)(expectedValue), 'Received instance with accessibility value', (0, _jestMatcherUtils.stringify)((0, _object.removeUndefinedKeys)(receivedValue)));
20
20
  }
21
21
  };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-have-accessibility-value.js","names":["_jestMatcherUtils","require","_accessibility","_matchAccessibilityValue","_object","_utils","toHaveAccessibilityValue","element","expectedValue","checkHostElement","receivedValue","computeAriaValue","pass","matchAccessibilityValue","message","matcher","matcherHint","isNot","stringify","formatMessage","removeUndefinedKeys"],"sources":["../../src/matchers/to-have-accessibility-value.ts"],"sourcesContent":["import { matcherHint, stringify } from 'jest-matcher-utils';\nimport type { HostElement } from 'test-renderer';\n\nimport { computeAriaValue } from '../helpers/accessibility';\nimport type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';\nimport { matchAccessibilityValue } 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: HostElement,\n expectedValue: AccessibilityValueMatcher,\n) {\n checkHostElement(element, toHaveAccessibilityValue, this);\n\n const receivedValue = computeAriaValue(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 ${this.isNot ? 'not to' : 'to'} have accessibility value`,\n stringify(expectedValue),\n 'Received element with accessibility value',\n stringify(removeUndefinedKeys(receivedValue)),\n );\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,OAAoB,EACpBC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAEzD,MAAMI,aAAa,GAAG,IAAAC,+BAAgB,EAACJ,OAAO,CAAC;EAE/C,OAAO;IACLK,IAAI,EAAE,IAAAC,gDAAuB,EAACN,OAAO,EAAEC,aAAa,CAAC;IACrDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACzB,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,2BAA2B,EACtD,SAAS,EACT,IAAAC,2BAAS,EAACV,aAAa,CACzB,CAAC;MACD,OAAO,IAAAW,oBAAa,EAClBJ,OAAO,EACP,wBAAwB,IAAI,CAACE,KAAK,GAAG,QAAQ,GAAG,IAAI,2BAA2B,EAC/E,IAAAC,2BAAS,EAACV,aAAa,CAAC,EACxB,2CAA2C,EAC3C,IAAAU,2BAAS,EAAC,IAAAE,2BAAmB,EAACV,aAAa,CAAC,CAC9C,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-have-accessibility-value.js","names":["_jestMatcherUtils","require","_accessibility","_matchAccessibilityValue","_object","_utils","toHaveAccessibilityValue","instance","expectedValue","checkHostElement","receivedValue","computeAriaValue","pass","matchAccessibilityValue","message","matcher","matcherHint","isNot","stringify","formatMessage","removeUndefinedKeys"],"sources":["../../src/matchers/to-have-accessibility-value.ts"],"sourcesContent":["import { matcherHint, stringify } from 'jest-matcher-utils';\nimport type { TestInstance } from 'test-renderer';\n\nimport { computeAriaValue } from '../helpers/accessibility';\nimport type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';\nimport { matchAccessibilityValue } 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 instance: TestInstance,\n expectedValue: AccessibilityValueMatcher,\n) {\n checkHostElement(instance, toHaveAccessibilityValue, this);\n\n const receivedValue = computeAriaValue(instance);\n\n return {\n pass: matchAccessibilityValue(instance, expectedValue),\n message: () => {\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`,\n 'instance',\n stringify(expectedValue),\n );\n return formatMessage(\n matcher,\n `Expected the instance ${this.isNot ? 'not to' : 'to'} have accessibility value`,\n stringify(expectedValue),\n 'Received instance with accessibility value',\n stringify(removeUndefinedKeys(receivedValue)),\n );\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,QAAsB,EACtBC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,QAAQ,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAE1D,MAAMI,aAAa,GAAG,IAAAC,+BAAgB,EAACJ,QAAQ,CAAC;EAEhD,OAAO;IACLK,IAAI,EAAE,IAAAC,gDAAuB,EAACN,QAAQ,EAAEC,aAAa,CAAC;IACtDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACzB,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,2BAA2B,EACtD,UAAU,EACV,IAAAC,2BAAS,EAACV,aAAa,CACzB,CAAC;MACD,OAAO,IAAAW,oBAAa,EAClBJ,OAAO,EACP,yBAAyB,IAAI,CAACE,KAAK,GAAG,QAAQ,GAAG,IAAI,2BAA2B,EAChF,IAAAC,2BAAS,EAACV,aAAa,CAAC,EACxB,4CAA4C,EAC5C,IAAAU,2BAAS,EAAC,IAAAE,2BAAmB,EAACV,aAAa,CAAC,CAC9C,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { HostElement } from 'test-renderer';
1
+ import type { TestInstance } from 'test-renderer';
2
2
  import type { TextMatch, TextMatchOptions } from '../matches';
3
- export declare function toHaveAccessibleName(this: jest.MatcherContext, element: HostElement, expectedName?: TextMatch, options?: TextMatchOptions): {
3
+ export declare function toHaveAccessibleName(this: jest.MatcherContext, instance: TestInstance, expectedName?: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -8,20 +8,15 @@ var _jestMatcherUtils = require("jest-matcher-utils");
8
8
  var _accessibility = require("../helpers/accessibility");
9
9
  var _matches = require("../matches");
10
10
  var _utils = require("./utils");
11
- function toHaveAccessibleName(element, expectedName, options) {
12
- (0, _utils.checkHostElement)(element, toHaveAccessibleName, this);
13
- const receivedName = (0, _accessibility.computeAccessibleName)(element);
11
+ function toHaveAccessibleName(instance, expectedName, options) {
12
+ (0, _utils.checkHostElement)(instance, toHaveAccessibleName, this);
13
+ const receivedName = (0, _accessibility.computeAccessibleName)(instance);
14
14
  const missingExpectedValue = arguments.length === 1;
15
- let pass = false;
16
- if (missingExpectedValue) {
17
- pass = receivedName !== '';
18
- } else {
19
- pass = expectedName != null ? (0, _matches.matches)(expectedName, receivedName, options?.normalizer, options?.exact) : false;
20
- }
15
+ const pass = missingExpectedValue ? receivedName !== '' : expectedName != null ? (0, _matches.matches)(expectedName, receivedName, options?.normalizer, options?.exact) : false;
21
16
  return {
22
17
  pass,
23
18
  message: () => {
24
- return [(0, _utils.formatMessage)((0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveAccessibleName`, 'element', ''), `Expected element ${this.isNot ? 'not to' : 'to'} have accessible name`, expectedName, 'Received', receivedName)].join('\n');
19
+ return [(0, _utils.formatMessage)((0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveAccessibleName`, 'instance', ''), `Expected instance ${this.isNot ? 'not to' : 'to'} have accessible name`, expectedName, 'Received', receivedName)].join('\n');
25
20
  }
26
21
  };
27
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-have-accessible-name.js","names":["_jestMatcherUtils","require","_accessibility","_matches","_utils","toHaveAccessibleName","element","expectedName","options","checkHostElement","receivedName","computeAccessibleName","missingExpectedValue","arguments","length","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-accessible-name.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport type { HostElement } from 'test-renderer';\n\nimport { computeAccessibleName } from '../helpers/accessibility';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport { matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibleName(\n this: jest.MatcherContext,\n element: HostElement,\n expectedName?: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveAccessibleName, this);\n\n const receivedName = computeAccessibleName(element);\n const missingExpectedValue = arguments.length === 1;\n\n let pass = false;\n if (missingExpectedValue) {\n pass = receivedName !== '';\n } else {\n pass =\n expectedName != null\n ? matches(expectedName, receivedName, options?.normalizer, options?.exact)\n : false;\n }\n\n return {\n pass,\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveAccessibleName`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have accessible name`,\n expectedName,\n 'Received',\n receivedName,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAElCC,OAAoB,EACpBC,YAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAErD,MAAMK,YAAY,GAAG,IAAAC,oCAAqB,EAACL,OAAO,CAAC;EACnD,MAAMM,oBAAoB,GAAGC,SAAS,CAACC,MAAM,KAAK,CAAC;EAEnD,IAAIC,IAAI,GAAG,KAAK;EAChB,IAAIH,oBAAoB,EAAE;IACxBG,IAAI,GAAGL,YAAY,KAAK,EAAE;EAC5B,CAAC,MAAM;IACLK,IAAI,GACFR,YAAY,IAAI,IAAI,GAChB,IAAAS,gBAAO,EAACT,YAAY,EAAEG,YAAY,EAAEF,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC,GACxE,KAAK;EACb;EAEA,OAAO;IACLH,IAAI;IACJI,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,uBAAuB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC9E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,uBAAuB,EACvEf,YAAY,EACZ,UAAU,EACVG,YACF,CAAC,CACF,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-have-accessible-name.js","names":["_jestMatcherUtils","require","_accessibility","_matches","_utils","toHaveAccessibleName","instance","expectedName","options","checkHostElement","receivedName","computeAccessibleName","missingExpectedValue","arguments","length","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-accessible-name.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport type { TestInstance } from 'test-renderer';\n\nimport { computeAccessibleName } from '../helpers/accessibility';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport { matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibleName(\n this: jest.MatcherContext,\n instance: TestInstance,\n expectedName?: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(instance, toHaveAccessibleName, this);\n\n const receivedName = computeAccessibleName(instance);\n const missingExpectedValue = arguments.length === 1;\n\n const pass = missingExpectedValue\n ? receivedName !== ''\n : expectedName != null\n ? matches(expectedName, receivedName, options?.normalizer, options?.exact)\n : false;\n\n return {\n pass,\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveAccessibleName`, 'instance', ''),\n `Expected instance ${this.isNot ? 'not to' : 'to'} have accessible name`,\n expectedName,\n 'Received',\n receivedName,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAElCC,QAAsB,EACtBC,YAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,QAAQ,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAEtD,MAAMK,YAAY,GAAG,IAAAC,oCAAqB,EAACL,QAAQ,CAAC;EACpD,MAAMM,oBAAoB,GAAGC,SAAS,CAACC,MAAM,KAAK,CAAC;EAEnD,MAAMC,IAAI,GAAGH,oBAAoB,GAC7BF,YAAY,KAAK,EAAE,GACnBH,YAAY,IAAI,IAAI,GAClB,IAAAS,gBAAO,EAACT,YAAY,EAAEG,YAAY,EAAEF,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC,GACxE,KAAK;EAEX,OAAO;IACLH,IAAI;IACJI,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,uBAAuB,EAAE,UAAU,EAAE,EAAE,CAAC,EAC/E,qBAAqB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,uBAAuB,EACxEf,YAAY,EACZ,UAAU,EACVG,YACF,CAAC,CACF,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { HostElement } from 'test-renderer';
1
+ import type { TestInstance } from 'test-renderer';
2
2
  import type { TextMatch, TextMatchOptions } from '../matches';
3
- export declare function toHaveDisplayValue(this: jest.MatcherContext, element: HostElement, expectedValue: TextMatch, options?: TextMatchOptions): {
3
+ export declare function toHaveDisplayValue(this: jest.MatcherContext, instance: TestInstance, expectedValue: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -10,16 +10,16 @@ var _hostComponentNames = require("../helpers/host-component-names");
10
10
  var _textInput = require("../helpers/text-input");
11
11
  var _matches = require("../matches");
12
12
  var _utils = require("./utils");
13
- function toHaveDisplayValue(element, expectedValue, options) {
14
- (0, _utils.checkHostElement)(element, toHaveDisplayValue, this);
15
- if (!(0, _hostComponentNames.isHostTextInput)(element)) {
16
- throw new _errors.ErrorWithStack(`toHaveDisplayValue() works only with host "TextInput" elements. Passed element has type "${element.type}".`, toHaveDisplayValue);
13
+ function toHaveDisplayValue(instance, expectedValue, options) {
14
+ (0, _utils.checkHostElement)(instance, toHaveDisplayValue, this);
15
+ if (!(0, _hostComponentNames.isHostTextInput)(instance)) {
16
+ throw new _errors.ErrorWithStack(`toHaveDisplayValue() works only with host "TextInput" instances. Passed instance has type "${instance.type}".`, toHaveDisplayValue);
17
17
  }
18
- const receivedValue = (0, _textInput.getTextInputValue)(element);
18
+ const receivedValue = (0, _textInput.getTextInputValue)(instance);
19
19
  return {
20
20
  pass: (0, _matches.matches)(expectedValue, receivedValue, options?.normalizer, options?.exact),
21
21
  message: () => {
22
- return [(0, _utils.formatMessage)((0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'element', ''), `Expected element ${this.isNot ? 'not to' : 'to'} have display value`, expectedValue, 'Received', receivedValue)].join('\n');
22
+ return [(0, _utils.formatMessage)((0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'instance', ''), `Expected instance ${this.isNot ? 'not to' : 'to'} have display value`, expectedValue, 'Received', receivedValue)].join('\n');
23
23
  }
24
24
  };
25
25
  }