@testing-library/react-native 14.0.0-alpha.0 → 14.0.0-alpha.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 (233) hide show
  1. package/README.md +8 -12
  2. package/build/act.d.ts +2 -4
  3. package/build/act.js +4 -5
  4. package/build/act.js.map +1 -1
  5. package/build/cleanup.d.ts +3 -1
  6. package/build/cleanup.js +8 -0
  7. package/build/cleanup.js.map +1 -1
  8. package/build/event-handler.d.ts +7 -0
  9. package/build/event-handler.js +30 -0
  10. package/build/event-handler.js.map +1 -0
  11. package/build/fire-event.d.ts +11 -4
  12. package/build/fire-event.js +43 -37
  13. package/build/fire-event.js.map +1 -1
  14. package/build/helpers/accessibility.d.ts +2 -2
  15. package/build/helpers/accessibility.js +5 -2
  16. package/build/helpers/accessibility.js.map +1 -1
  17. package/build/helpers/component-tree.d.ts +8 -8
  18. package/build/helpers/component-tree.js +19 -16
  19. package/build/helpers/component-tree.js.map +1 -1
  20. package/build/helpers/debug.d.ts +3 -3
  21. package/build/helpers/debug.js +8 -11
  22. package/build/helpers/debug.js.map +1 -1
  23. package/build/helpers/errors.js +4 -4
  24. package/build/helpers/errors.js.map +1 -1
  25. package/build/helpers/find-all.d.ts +1 -1
  26. package/build/helpers/find-all.js +7 -27
  27. package/build/helpers/find-all.js.map +1 -1
  28. package/build/helpers/format-element.d.ts +18 -0
  29. package/build/helpers/format-element.js +80 -0
  30. package/build/helpers/format-element.js.map +1 -0
  31. package/build/helpers/host-component-names.d.ts +1 -1
  32. package/build/helpers/host-component-names.js +6 -7
  33. package/build/helpers/host-component-names.js.map +1 -1
  34. package/build/helpers/logger.d.ts +28 -0
  35. package/build/helpers/logger.js +42 -0
  36. package/build/helpers/logger.js.map +1 -0
  37. package/build/helpers/{format-default.d.ts → map-props.d.ts} +1 -0
  38. package/build/helpers/{format-default.js → map-props.js} +2 -2
  39. package/build/helpers/map-props.js.map +1 -0
  40. package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
  41. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  42. package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
  43. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  44. package/build/helpers/matchers/match-label-text.d.ts +2 -2
  45. package/build/helpers/matchers/match-label-text.js.map +1 -1
  46. package/build/helpers/matchers/match-string-prop.d.ts +1 -1
  47. package/build/helpers/matchers/match-string-prop.js.map +1 -1
  48. package/build/helpers/matchers/match-text-content.d.ts +2 -2
  49. package/build/helpers/matchers/match-text-content.js.map +1 -1
  50. package/build/helpers/object.d.ts +1 -1
  51. package/build/helpers/object.js.map +1 -1
  52. package/build/helpers/pointer-events.d.ts +1 -1
  53. package/build/helpers/pointer-events.js +9 -5
  54. package/build/helpers/pointer-events.js.map +1 -1
  55. package/build/helpers/text-content.d.ts +1 -1
  56. package/build/helpers/text-content.js.map +1 -1
  57. package/build/helpers/text-input.d.ts +1 -1
  58. package/build/helpers/text-input.js.map +1 -1
  59. package/build/helpers/timers.d.ts +1 -1
  60. package/build/helpers/timers.js.map +1 -1
  61. package/build/helpers/wrap-async.d.ts +0 -1
  62. package/build/helpers/wrap-async.js +0 -1
  63. package/build/helpers/wrap-async.js.map +1 -1
  64. package/build/index.d.ts +0 -1
  65. package/build/index.flow.js +33 -36
  66. package/build/index.js +4 -16
  67. package/build/index.js.map +1 -1
  68. package/build/matchers/extend-expect.js +2 -2
  69. package/build/matchers/extend-expect.js.map +1 -1
  70. package/build/matchers/index.d.ts +1 -1
  71. package/build/matchers/index.js.map +1 -1
  72. package/build/matchers/to-be-busy.d.ts +1 -1
  73. package/build/matchers/to-be-busy.js +4 -1
  74. package/build/matchers/to-be-busy.js.map +1 -1
  75. package/build/matchers/to-be-checked.d.ts +1 -1
  76. package/build/matchers/to-be-checked.js +4 -1
  77. package/build/matchers/to-be-checked.js.map +1 -1
  78. package/build/matchers/to-be-disabled.d.ts +1 -1
  79. package/build/matchers/to-be-disabled.js +5 -2
  80. package/build/matchers/to-be-disabled.js.map +1 -1
  81. package/build/matchers/to-be-empty-element.d.ts +1 -1
  82. package/build/matchers/to-be-empty-element.js +9 -3
  83. package/build/matchers/to-be-empty-element.js.map +1 -1
  84. package/build/matchers/to-be-expanded.d.ts +1 -1
  85. package/build/matchers/to-be-expanded.js +5 -2
  86. package/build/matchers/to-be-expanded.js.map +1 -1
  87. package/build/matchers/to-be-on-the-screen.d.ts +1 -1
  88. package/build/matchers/to-be-on-the-screen.js +4 -1
  89. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  90. package/build/matchers/to-be-partially-checked.d.ts +1 -1
  91. package/build/matchers/to-be-partially-checked.js +4 -1
  92. package/build/matchers/to-be-partially-checked.js.map +1 -1
  93. package/build/matchers/to-be-selected.d.ts +1 -1
  94. package/build/matchers/to-be-selected.js +4 -1
  95. package/build/matchers/to-be-selected.js.map +1 -1
  96. package/build/matchers/to-be-visible.d.ts +1 -1
  97. package/build/matchers/to-be-visible.js +8 -5
  98. package/build/matchers/to-be-visible.js.map +1 -1
  99. package/build/matchers/to-contain-element.d.ts +1 -1
  100. package/build/matchers/to-contain-element.js +5 -3
  101. package/build/matchers/to-contain-element.js.map +1 -1
  102. package/build/matchers/to-have-accessibility-value.d.ts +2 -2
  103. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  104. package/build/matchers/to-have-accessible-name.d.ts +2 -2
  105. package/build/matchers/to-have-accessible-name.js.map +1 -1
  106. package/build/matchers/to-have-display-value.d.ts +2 -2
  107. package/build/matchers/to-have-display-value.js +1 -1
  108. package/build/matchers/to-have-display-value.js.map +1 -1
  109. package/build/matchers/to-have-prop.d.ts +1 -1
  110. package/build/matchers/to-have-prop.js.map +1 -1
  111. package/build/matchers/to-have-style.d.ts +2 -2
  112. package/build/matchers/to-have-style.js +1 -1
  113. package/build/matchers/to-have-style.js.map +1 -1
  114. package/build/matchers/to-have-text-content.d.ts +2 -2
  115. package/build/matchers/to-have-text-content.js.map +1 -1
  116. package/build/matchers/types.d.ts +4 -4
  117. package/build/matchers/types.js.map +1 -1
  118. package/build/matchers/utils.d.ts +1 -8
  119. package/build/matchers/utils.js +3 -48
  120. package/build/matchers/utils.js.map +1 -1
  121. package/build/native-state.d.ts +3 -3
  122. package/build/native-state.js +1 -1
  123. package/build/native-state.js.map +1 -1
  124. package/build/pure.d.ts +6 -4
  125. package/build/pure.js +28 -2
  126. package/build/pure.js.map +1 -1
  127. package/build/queries/display-value.d.ts +3 -3
  128. package/build/queries/display-value.js +9 -9
  129. package/build/queries/display-value.js.map +1 -1
  130. package/build/queries/hint-text.d.ts +4 -4
  131. package/build/queries/hint-text.js +9 -9
  132. package/build/queries/hint-text.js.map +1 -1
  133. package/build/queries/label-text.d.ts +4 -4
  134. package/build/queries/label-text.js +9 -9
  135. package/build/queries/label-text.js.map +1 -1
  136. package/build/queries/make-queries.d.ts +3 -3
  137. package/build/queries/make-queries.js +15 -18
  138. package/build/queries/make-queries.js.map +1 -1
  139. package/build/queries/options.d.ts +1 -1
  140. package/build/queries/options.js.map +1 -1
  141. package/build/queries/placeholder-text.d.ts +3 -3
  142. package/build/queries/placeholder-text.js +10 -10
  143. package/build/queries/placeholder-text.js.map +1 -1
  144. package/build/queries/role.d.ts +7 -7
  145. package/build/queries/role.js +16 -9
  146. package/build/queries/role.js.map +1 -1
  147. package/build/queries/test-id.d.ts +3 -3
  148. package/build/queries/test-id.js +9 -9
  149. package/build/queries/test-id.js.map +1 -1
  150. package/build/queries/text.d.ts +3 -3
  151. package/build/queries/text.js +9 -9
  152. package/build/queries/text.js.map +1 -1
  153. package/build/react-versions.js +1 -2
  154. package/build/react-versions.js.map +1 -1
  155. package/build/render-act.d.ts +3 -0
  156. package/build/render-act.js +29 -0
  157. package/build/render-act.js.map +1 -0
  158. package/build/render-async.d.ts +83 -0
  159. package/build/render-async.js +96 -0
  160. package/build/render-async.js.map +1 -0
  161. package/build/render-hook.d.ts +18 -6
  162. package/build/render-hook.js +56 -26
  163. package/build/render-hook.js.map +1 -1
  164. package/build/render.d.ts +54 -48
  165. package/build/render.js +42 -30
  166. package/build/render.js.map +1 -1
  167. package/build/screen.d.ts +1 -1
  168. package/build/screen.js +7 -7
  169. package/build/screen.js.map +1 -1
  170. package/build/test-utils/console.d.ts +1 -0
  171. package/build/test-utils/console.js +17 -0
  172. package/build/test-utils/console.js.map +1 -0
  173. package/build/test-utils/json.d.ts +6 -0
  174. package/build/test-utils/json.js +33 -0
  175. package/build/test-utils/json.js.map +1 -0
  176. package/build/tsconfig.release.tsbuildinfo +1 -1
  177. package/build/types.d.ts +4 -0
  178. package/build/types.js.map +1 -1
  179. package/build/user-event/clear.d.ts +2 -2
  180. package/build/user-event/clear.js +6 -6
  181. package/build/user-event/clear.js.map +1 -1
  182. package/build/user-event/event-builder/base.d.ts +2 -2
  183. package/build/user-event/event-builder/base.js.map +1 -1
  184. package/build/user-event/event-builder/scroll-view.d.ts +1 -1
  185. package/build/user-event/event-builder/scroll-view.js.map +1 -1
  186. package/build/user-event/event-builder/text-input.d.ts +2 -2
  187. package/build/user-event/event-builder/text-input.js.map +1 -1
  188. package/build/user-event/index.d.ts +4 -4
  189. package/build/user-event/index.js.map +1 -1
  190. package/build/user-event/paste.d.ts +2 -2
  191. package/build/user-event/paste.js +8 -8
  192. package/build/user-event/paste.js.map +1 -1
  193. package/build/user-event/press/index.d.ts +1 -1
  194. package/build/user-event/press/index.js.map +1 -1
  195. package/build/user-event/press/press.d.ts +2 -2
  196. package/build/user-event/press/press.js +48 -49
  197. package/build/user-event/press/press.js.map +1 -1
  198. package/build/user-event/scroll/index.d.ts +1 -1
  199. package/build/user-event/scroll/index.js.map +1 -1
  200. package/build/user-event/scroll/scroll-to.d.ts +3 -3
  201. package/build/user-event/scroll/scroll-to.js +8 -8
  202. package/build/user-event/scroll/scroll-to.js.map +1 -1
  203. package/build/user-event/scroll/utils.d.ts +1 -1
  204. package/build/user-event/scroll/utils.js.map +1 -1
  205. package/build/user-event/setup/setup.d.ts +4 -4
  206. package/build/user-event/setup/setup.js.map +1 -1
  207. package/build/user-event/type/type.d.ts +3 -2
  208. package/build/user-event/type/type.js +16 -14
  209. package/build/user-event/type/type.js.map +1 -1
  210. package/build/user-event/utils/content-size.d.ts +1 -1
  211. package/build/user-event/utils/content-size.js.map +1 -1
  212. package/build/user-event/utils/dispatch-event.d.ts +2 -2
  213. package/build/user-event/utils/dispatch-event.js +5 -15
  214. package/build/user-event/utils/dispatch-event.js.map +1 -1
  215. package/build/user-event/utils/wait.d.ts +6 -2
  216. package/build/user-event/utils/wait.js +1 -1
  217. package/build/user-event/utils/wait.js.map +1 -1
  218. package/build/wait-for-element-to-be-removed.js +1 -1
  219. package/build/wait-for-element-to-be-removed.js.map +1 -1
  220. package/build/wait-for.js +4 -5
  221. package/build/wait-for.js.map +1 -1
  222. package/build/within.d.ts +20 -20
  223. package/build/within.js +8 -8
  224. package/build/within.js.map +1 -1
  225. package/package.json +38 -32
  226. package/typings/index.flow.js +33 -36
  227. package/build/helpers/format-default.js.map +0 -1
  228. package/build/helpers/format.d.ts +0 -7
  229. package/build/helpers/format.js +0 -31
  230. package/build/helpers/format.js.map +0 -1
  231. package/build/test-utils/index.d.ts +0 -1
  232. package/build/test-utils/index.js +0 -17
  233. package/build/test-utils/index.js.map +0 -1
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeBusy = toBeBusy;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
10
+ var _formatElement = require("../helpers/format-element");
9
11
  var _utils = require("./utils");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
13
  function toBeBusy(element) {
11
14
  (0, _utils.checkHostElement)(element, toBeBusy, this);
12
15
  return {
13
16
  pass: (0, _accessibility.computeAriaBusy)(element),
14
17
  message: () => {
15
18
  const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');
16
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}busy:`, (0, _utils.formatElement)(element)].join('\n');
19
+ return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}busy:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
17
20
  }
18
21
  };
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeBusy","element","checkHostElement","pass","computeAriaBusy","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-busy.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { computeAriaBusy } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: computeAriaBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,QAAQA,CAA4BC,OAAoB,EAAE;EACxE,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,8BAAe,EAACH,OAAO,CAAC;IAC9BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeBusy","element","checkHostElement","pass","computeAriaBusy","message","matcher","matcherHint","isNot","redent","formatElement","join"],"sources":["../../src/matchers/to-be-busy.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'universal-test-renderer';\n\nimport { computeAriaBusy } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: computeAriaBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\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,QAAQA,CAA4BC,OAAoB,EAAE;EACxE,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,8BAAe,EAACH,OAAO,CAAC;IAC9BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeChecked(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeChecked = toBeChecked;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
9
10
  var _errors = require("../helpers/errors");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _hostComponentNames = require("../helpers/host-component-names");
11
13
  var _utils = require("./utils");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
15
  function toBeChecked(element) {
13
16
  (0, _utils.checkHostElement)(element, toBeChecked, this);
14
17
  if (!(0, _hostComponentNames.isHostSwitch)(element) && !isSupportedAccessibilityElement(element)) {
@@ -18,7 +21,7 @@ function toBeChecked(element) {
18
21
  pass: (0, _accessibility.computeAriaChecked)(element) === true,
19
22
  message: () => {
20
23
  const is = this.isNot ? 'is' : 'is not';
21
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''), '', `Received element ${is} checked:`, (0, _utils.formatElement)(element)].join('\n');
24
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''), '', `Received element ${is} checked:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
22
25
  }
23
26
  };
24
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_hostComponentNames","_utils","toBeChecked","element","checkHostElement","isHostSwitch","isSupportedAccessibilityElement","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","formatElement","join","isAccessibilityElement","role","getRole","rolesSupportingCheckedState"],"sources":["../../src/matchers/to-be-checked.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport {\n computeAriaChecked,\n getRole,\n isAccessibilityElement,\n rolesSupportingCheckedState,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostSwitch } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeChecked, this);\n\n if (!isHostSwitch(element) && !isSupportedAccessibilityElement(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on host \"Switch\" elements or accessibility elements with \"checkbox\", \"radio\" or \"switch\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isSupportedAccessibilityElement(element: HostElement) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getRole(element);\n return rolesSupportingCheckedState[role];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,WAAWA,CAA4BC,OAAoB,EAAE;EAC3E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAAC,IAAAG,gCAAY,EAACF,OAAO,CAAC,IAAI,CAACG,+BAA+B,CAACH,OAAO,CAAC,EAAE;IACvE,MAAM,IAAII,sBAAc,CACtB,yHAAyH,EACzHL,WACF,CAAC;EACH;EAEA,OAAO;IACLM,IAAI,EAAE,IAAAC,iCAAkB,EAACN,OAAO,CAAC,KAAK,IAAI;IAC1CO,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,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACX,OAAO,CAAC,CACvB,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,+BAA+BA,CAACH,OAAoB,EAAE;EAC7D,IAAI,CAAC,IAAAa,qCAAsB,EAACb,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMc,IAAI,GAAG,IAAAC,sBAAO,EAACf,OAAO,CAAC;EAC7B,OAAOgB,0CAA2B,CAACF,IAAI,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_errors","_formatElement","_hostComponentNames","_utils","e","__esModule","default","toBeChecked","element","checkHostElement","isHostSwitch","isSupportedAccessibilityElement","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","redent","formatElement","join","isAccessibilityElement","role","getRole","rolesSupportingCheckedState"],"sources":["../../src/matchers/to-be-checked.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'universal-test-renderer';\n\nimport {\n computeAriaChecked,\n getRole,\n isAccessibilityElement,\n rolesSupportingCheckedState,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { formatElement } from '../helpers/format-element';\nimport { isHostSwitch } from '../helpers/host-component-names';\nimport { checkHostElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeChecked, this);\n\n if (!isHostSwitch(element) && !isSupportedAccessibilityElement(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on host \"Switch\" elements or accessibility elements with \"checkbox\", \"radio\" or \"switch\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction isSupportedAccessibilityElement(element: HostElement) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getRole(element);\n return rolesSupportingCheckedState[role];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AAMA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA2C,SAAAE,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,WAAWA,CAA4BC,OAAoB,EAAE;EAC3E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAAC,IAAAG,gCAAY,EAACF,OAAO,CAAC,IAAI,CAACG,+BAA+B,CAACH,OAAO,CAAC,EAAE;IACvE,MAAM,IAAII,sBAAc,CACtB,yHAAyH,EACzHL,WACF,CAAC;EACH;EAEA,OAAO;IACLM,IAAI,EAAE,IAAAC,iCAAkB,EAACN,OAAO,CAAC,KAAK,IAAI;IAC1CO,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,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACZ,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASV,+BAA+BA,CAACH,OAAoB,EAAE;EAC7D,IAAI,CAAC,IAAAc,qCAAsB,EAACd,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMe,IAAI,GAAG,IAAAC,sBAAO,EAAChB,OAAO,CAAC;EAC7B,OAAOiB,0CAA2B,CAACF,IAAI,CAAC;AAC1C","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeDisabled(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.toBeDisabled = toBeDisabled;
7
7
  exports.toBeEnabled = toBeEnabled;
8
8
  var _jestMatcherUtils = require("jest-matcher-utils");
9
+ var _redent = _interopRequireDefault(require("redent"));
9
10
  var _accessibility = require("../helpers/accessibility");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBeDisabled(element) {
12
15
  (0, _utils.checkHostElement)(element, toBeDisabled, this);
13
16
  const isDisabled = (0, _accessibility.computeAriaDisabled)(element) || isAncestorDisabled(element);
@@ -15,7 +18,7 @@ function toBeDisabled(element) {
15
18
  pass: isDisabled,
16
19
  message: () => {
17
20
  const is = this.isNot ? 'is' : 'is not';
18
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''), '', `Received element ${is} disabled:`, (0, _utils.formatElement)(element)].join('\n');
21
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''), '', `Received element ${is} disabled:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
19
22
  }
20
23
  };
21
24
  }
@@ -26,7 +29,7 @@ function toBeEnabled(element) {
26
29
  pass: isEnabled,
27
30
  message: () => {
28
31
  const is = this.isNot ? 'is' : 'is not';
29
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''), '', `Received element ${is} enabled:`, (0, _utils.formatElement)(element)].join('\n');
32
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''), '', `Received element ${is} enabled:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
30
33
  }
31
34
  };
32
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeDisabled","element","checkHostElement","isDisabled","computeAriaDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","formatElement","join","toBeEnabled","isEnabled","parent"],"sources":["../../src/matchers/to-be-disabled.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { computeAriaDisabled } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeDisabled, this);\n\n const isDisabled = computeAriaDisabled(element) || isAncestorDisabled(element);\n\n return {\n pass: isDisabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''),\n '',\n `Received element ${is} disabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeEnabled(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeEnabled, this);\n\n const isEnabled = !computeAriaDisabled(element) && !isAncestorDisabled(element);\n\n return {\n pass: isEnabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''),\n '',\n `Received element ${is} enabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isAncestorDisabled(element: HostElement): boolean {\n const parent = element.parent;\n if (parent == null) {\n return false;\n }\n\n return computeAriaDisabled(parent) || isAncestorDisabled(parent);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAAoB,EAAE;EAC5E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,MAAMG,UAAU,GAAG,IAAAC,kCAAmB,EAACH,OAAO,CAAC,IAAII,kBAAkB,CAACJ,OAAO,CAAC;EAE9E,OAAO;IACLK,IAAI,EAAEH,UAAU;IAChBI,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,YAAY,EAClC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,WAAWA,CAA4BZ,OAAoB,EAAE;EAC3E,IAAAC,uBAAgB,EAACD,OAAO,EAAEY,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMC,SAAS,GAAG,CAAC,IAAAV,kCAAmB,EAACH,OAAO,CAAC,IAAI,CAACI,kBAAkB,CAACJ,OAAO,CAAC;EAE/E,OAAO;IACLK,IAAI,EAAEQ,SAAS;IACfP,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,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASP,kBAAkBA,CAACJ,OAAoB,EAAW;EACzD,MAAMc,MAAM,GAAGd,OAAO,CAACc,MAAM;EAC7B,IAAIA,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAX,kCAAmB,EAACW,MAAM,CAAC,IAAIV,kBAAkB,CAACU,MAAM,CAAC;AAClE","ignoreList":[]}
1
+ {"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeDisabled","element","checkHostElement","isDisabled","computeAriaDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","redent","formatElement","join","toBeEnabled","isEnabled","parent"],"sources":["../../src/matchers/to-be-disabled.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\nimport type { HostElement } from 'universal-test-renderer';\n\nimport { computeAriaDisabled } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeDisabled, this);\n\n const isDisabled = computeAriaDisabled(element) || isAncestorDisabled(element);\n\n return {\n pass: isDisabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''),\n '',\n `Received element ${is} disabled:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeEnabled(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeEnabled, this);\n\n const isEnabled = !computeAriaDisabled(element) && !isAncestorDisabled(element);\n\n return {\n pass: isEnabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''),\n '',\n `Received element ${is} enabled:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction isAncestorDisabled(element: HostElement): boolean {\n const parent = element.parent;\n if (parent == null) {\n return false;\n }\n\n return computeAriaDisabled(parent) || isAncestorDisabled(parent);\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,MAAMG,UAAU,GAAG,IAAAC,kCAAmB,EAACH,OAAO,CAAC,IAAII,kBAAkB,CAACJ,OAAO,CAAC;EAE9E,OAAO;IACLK,IAAI,EAAEH,UAAU;IAChBI,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,YAAY,EAClC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACX,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,WAAWA,CAA4Bb,OAAoB,EAAE;EAC3E,IAAAC,uBAAgB,EAACD,OAAO,EAAEa,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMC,SAAS,GAAG,CAAC,IAAAX,kCAAmB,EAACH,OAAO,CAAC,IAAI,CAACI,kBAAkB,CAACJ,OAAO,CAAC;EAE/E,OAAO;IACLK,IAAI,EAAES,SAAS;IACfR,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,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACX,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASR,kBAAkBA,CAACJ,OAAoB,EAAW;EACzD,MAAMe,MAAM,GAAGf,OAAO,CAACe,MAAM;EAC7B,IAAIA,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAZ,kCAAmB,EAACY,MAAM,CAAC,IAAIX,kBAAkB,CAACW,MAAM,CAAC;AAClE","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeEmptyElement(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,14 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeEmptyElement = toBeEmptyElement;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
9
+ var _componentTree = require("../helpers/component-tree");
10
+ var _formatElement = require("../helpers/format-element");
8
11
  var _utils = require("./utils");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
13
  function toBeEmptyElement(element) {
10
14
  (0, _utils.checkHostElement)(element, toBeEmptyElement, this);
11
- const hostChildren = element.children;
15
+
16
+ // TODO check
17
+ const children = element.children.filter(child => (0, _componentTree.isHostElement)(child));
12
18
  return {
13
- pass: hostChildren.length === 0,
19
+ pass: children.length === 0,
14
20
  message: () => {
15
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''), '', 'Received:', `${(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _utils.formatElementArray)(hostChildren))}`].join('\n');
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');
16
22
  }
17
23
  };
18
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_utils","toBeEmptyElement","element","checkHostElement","hostChildren","children","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElementArray","join"],"sources":["../../src/matchers/to-be-empty-element.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { checkHostElement, formatElementArray } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeEmptyElement, this);\n\n const hostChildren = element.children;\n\n return {\n pass: hostChildren.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(formatElementArray(hostChildren))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,gBAAgBA,CAA4BC,OAAoB,EAAE;EAChF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEjD,MAAMG,YAAY,GAAGF,OAAO,CAACG,QAAQ;EAErC,OAAO;IACLC,IAAI,EAAEF,YAAY,CAACG,MAAM,KAAK,CAAC;IAC/BC,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,yBAAkB,EAACR,YAAY,CAAC,CAAC,EAAE,CACtD,CAACS,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","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 'universal-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,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeExpanded(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -6,15 +6,18 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.toBeCollapsed = toBeCollapsed;
7
7
  exports.toBeExpanded = toBeExpanded;
8
8
  var _jestMatcherUtils = require("jest-matcher-utils");
9
+ var _redent = _interopRequireDefault(require("redent"));
9
10
  var _accessibility = require("../helpers/accessibility");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBeExpanded(element) {
12
15
  (0, _utils.checkHostElement)(element, toBeExpanded, this);
13
16
  return {
14
17
  pass: (0, _accessibility.computeAriaExpanded)(element) === true,
15
18
  message: () => {
16
19
  const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');
17
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}expanded:`, (0, _utils.formatElement)(element)].join('\n');
20
+ return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}expanded:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
18
21
  }
19
22
  };
20
23
  }
@@ -24,7 +27,7 @@ function toBeCollapsed(element) {
24
27
  pass: (0, _accessibility.computeAriaExpanded)(element) === false,
25
28
  message: () => {
26
29
  const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');
27
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}collapsed:`, (0, _utils.formatElement)(element)].join('\n');
30
+ return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}collapsed:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
28
31
  }
29
32
  };
30
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeExpanded","element","checkHostElement","pass","computeAriaExpanded","message","matcher","matcherHint","isNot","formatElement","join","toBeCollapsed"],"sources":["../../src/matchers/to-be-expanded.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { computeAriaExpanded } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } 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 formatElement(element),\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 formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,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,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,aAAaA,CAA4BV,OAAoB,EAAE;EAC7E,IAAAC,uBAAgB,EAACD,OAAO,EAAEU,aAAa,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLR,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,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,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","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 'universal-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,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeOnTheScreen(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,16 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeOnTheScreen = toBeOnTheScreen;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _componentTree = require("../helpers/component-tree");
10
+ var _formatElement = require("../helpers/format-element");
9
11
  var _screen = require("../screen");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBeOnTheScreen(element) {
12
15
  if (element !== null || !this.isNot) {
13
16
  (0, _utils.checkHostElement)(element, toBeOnTheScreen, this);
14
17
  }
15
18
  const pass = element === null ? false : _screen.screen.container === (0, _componentTree.getContainerElement)(element);
16
19
  const errorFound = () => {
17
- return `expected element tree not to contain element, but found\n${(0, _utils.formatElement)(element)}`;
20
+ return `expected element tree not to contain element, but found\n${(0, _redent.default)((0, _formatElement.formatElement)(element), 2)}`;
18
21
  };
19
22
  const errorNotFound = () => {
20
23
  return `element could not be found in the element tree`;
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_componentTree","_screen","_utils","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","container","getContainerElement","errorFound","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 { HostElement } from 'universal-test-renderer';\nimport { getContainerElement } from '../helpers/component-tree';\nimport { screen } from '../screen';\nimport { checkHostElement, formatElement } 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${formatElement(element)}`;\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;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,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,oBAAa,EAACR,OAAO,CAAC,EAAE;EAC7F,CAAC;EAED,MAAMS,aAAa,GAAGA,CAAA,KAAM;IAC1B,OAAO,gDAAgD;EACzD,CAAC;EAED,OAAO;IACLN,IAAI;IACJO,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACV,KAAK,GAAG,MAAM,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,CAAC,EACzE,EAAE,EACF,IAAAW,gCAAc,EAAC,IAAI,CAACX,KAAK,GAAGM,UAAU,CAAC,CAAC,GAAGE,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","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 'universal-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,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBePartiallyChecked(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBePartiallyChecked = toBePartiallyChecked;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
9
10
  var _errors = require("../helpers/errors");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBePartiallyChecked(element) {
12
15
  (0, _utils.checkHostElement)(element, toBePartiallyChecked, this);
13
16
  if (!hasValidAccessibilityRole(element)) {
@@ -17,7 +20,7 @@ function toBePartiallyChecked(element) {
17
20
  pass: (0, _accessibility.computeAriaChecked)(element) === 'mixed',
18
21
  message: () => {
19
22
  const is = this.isNot ? 'is' : 'is not';
20
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''), '', `Received element ${is} partially checked:`, (0, _utils.formatElement)(element)].join('\n');
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');
21
24
  }
22
25
  };
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-partially-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_utils","toBePartiallyChecked","element","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","formatElement","join","role","getRole","isAccessibilityElement"],"sources":["../../src/matchers/to-be-partially-checked.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { computeAriaChecked, getRole, isAccessibilityElement } from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { checkHostElement, formatElement } 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 formatElement(element),\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;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,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,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,yBAAyBA,CAACF,OAAoB,EAAE;EACvD,MAAMY,IAAI,GAAG,IAAAC,sBAAO,EAACb,OAAO,CAAC;EAC7B,OAAO,IAAAc,qCAAsB,EAACd,OAAO,CAAC,IAAIY,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","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 'universal-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,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeSelected(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeSelected = toBeSelected;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
10
+ var _formatElement = require("../helpers/format-element");
9
11
  var _utils = require("./utils");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
13
  function toBeSelected(element) {
11
14
  (0, _utils.checkHostElement)(element, toBeSelected, this);
12
15
  return {
13
16
  pass: (0, _accessibility.computeAriaSelected)(element),
14
17
  message: () => {
15
18
  const is = this.isNot ? 'is' : 'is not';
16
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeSelected`, 'element', ''), '', `Received element ${is} selected`, (0, _utils.formatElement)(element)].join('\n');
19
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeSelected`, 'element', ''), '', `Received element ${is} selected`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
17
20
  }
18
21
  };
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-selected.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeSelected","element","checkHostElement","pass","computeAriaSelected","message","is","isNot","matcherHint","formatElement","join"],"sources":["../../src/matchers/to-be-selected.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { computeAriaSelected } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } 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 formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,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,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,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","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 'universal-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,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toBeVisible(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -4,11 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.toBeVisible = toBeVisible;
7
- var _jestMatcherUtils = require("jest-matcher-utils");
8
7
  var _reactNative = require("react-native");
8
+ var _jestMatcherUtils = require("jest-matcher-utils");
9
+ var _redent = _interopRequireDefault(require("redent"));
9
10
  var _accessibility = require("../helpers/accessibility");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _hostComponentNames = require("../helpers/host-component-names");
11
13
  var _utils = require("./utils");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
15
  function toBeVisible(element) {
13
16
  if (element !== null || !this.isNot) {
14
17
  (0, _utils.checkHostElement)(element, toBeVisible, this);
@@ -17,7 +20,7 @@ function toBeVisible(element) {
17
20
  pass: isElementVisible(element),
18
21
  message: () => {
19
22
  const is = this.isNot ? 'is' : 'is not';
20
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''), '', `Received element ${is} visible:`, (0, _utils.formatElement)(element)].join('\n');
23
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''), '', `Received element ${is} visible:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
21
24
  }
22
25
  };
23
26
  }
@@ -38,11 +41,11 @@ function isElementVisible(element, accessibilityCache) {
38
41
  if ((0, _hostComponentNames.isHostModal)(element) && element.props.visible === false) {
39
42
  return false;
40
43
  }
41
- const hostParent = element.parent;
42
- if (hostParent === null) {
44
+ const parent = element.parent;
45
+ if (parent === null) {
43
46
  return true;
44
47
  }
45
- return isElementVisible(hostParent, cache);
48
+ return isElementVisible(parent, cache);
46
49
  }
47
50
  function isHiddenForStyles(element) {
48
51
  const flatStyle = _reactNative.StyleSheet.flatten(element.props.style);
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-visible.js","names":["_jestMatcherUtils","require","_reactNative","_accessibility","_hostComponentNames","_utils","toBeVisible","element","isNot","checkHostElement","pass","isElementVisible","message","is","matcherHint","formatElement","join","accessibilityCache","cache","WeakMap","isHiddenFromAccessibility","isHiddenForStyles","isHostModal","props","visible","hostParent","parent","flatStyle","StyleSheet","flatten","style","display","opacity"],"sources":["../../src/matchers/to-be-visible.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { StyleSheet } from 'react-native';\nimport { HostElement } from 'universal-test-renderer';\nimport { isHiddenFromAccessibility } from '../helpers/accessibility';\nimport { isHostModal } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } 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 formatElement(element),\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 hostParent = element.parent;\n if (hostParent === null) {\n return true;\n }\n\n return isElementVisible(hostParent, 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,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,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,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASL,gBAAgBA,CACvBJ,OAAoB,EACpBU,kBAAkD,EACzC;EACT;EACA,MAAMC,KAAK,GAAGD,kBAAkB,IAAI,IAAIE,OAAO,CAAuB,CAAC;EACvE,IAAI,IAAAC,wCAAyB,EAACb,OAAO,EAAE;IAAEW;EAAM,CAAC,CAAC,EAAE;IACjD,OAAO,KAAK;EACd;EAEA,IAAIG,iBAAiB,CAACd,OAAO,CAAC,EAAE;IAC9B,OAAO,KAAK;EACd;;EAEA;EACA;EACA,IAAI,IAAAe,+BAAW,EAACf,OAAO,CAAC,IAAIA,OAAO,CAACgB,KAAK,CAACC,OAAO,KAAK,KAAK,EAAE;IAC3D,OAAO,KAAK;EACd;EAEA,MAAMC,UAAU,GAAGlB,OAAO,CAACmB,MAAM;EACjC,IAAID,UAAU,KAAK,IAAI,EAAE;IACvB,OAAO,IAAI;EACb;EAEA,OAAOd,gBAAgB,CAACc,UAAU,EAAEP,KAAK,CAAC;AAC5C;AAEA,SAASG,iBAAiBA,CAACd,OAAoB,EAAE;EAC/C,MAAMoB,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACtB,OAAO,CAACgB,KAAK,CAACO,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","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 'universal-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,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export declare function toContainElement(this: jest.MatcherContext, container: HostElement, element: HostElement | null): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toContainElement = toContainElement;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
- var _findAll = require("../helpers/find-all");
8
+ var _redent = _interopRequireDefault(require("redent"));
9
+ var _formatElement = require("../helpers/format-element");
9
10
  var _utils = require("./utils");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
12
  function toContainElement(container, element) {
11
13
  (0, _utils.checkHostElement)(container, toContainElement, this);
12
14
  if (element !== null) {
@@ -14,12 +16,12 @@ function toContainElement(container, element) {
14
16
  }
15
17
  let matches = [];
16
18
  if (element) {
17
- matches = (0, _findAll.findAll)(container, node => node === element);
19
+ matches = container.queryAll(node => node === element);
18
20
  }
19
21
  return {
20
22
  pass: matches.length > 0,
21
23
  message: () => {
22
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'element'), '', (0, _jestMatcherUtils.RECEIVED_COLOR)(`${(0, _utils.formatElement)(container)} ${this.isNot ? '\n\ncontains:\n\n' : '\n\ndoes not contain:\n\n'} ${(0, _utils.formatElement)(element)}
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)}
23
25
  `)].join('\n');
24
26
  }
25
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-contain-element.js","names":["_jestMatcherUtils","require","_findAll","_utils","toContainElement","container","element","checkHostElement","matches","findAll","node","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElement","join"],"sources":["../../src/matchers/to-contain-element.ts"],"sourcesContent":["import { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { checkHostElement, formatElement } 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 = findAll(container, (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(`${formatElement(container)} ${\n this.isNot ? '\\n\\ncontains:\\n\\n' : '\\n\\ndoes not contain:\\n\\n'\n } ${formatElement(element)}\n `),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,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,GAAG,IAAAC,gBAAO,EAACJ,SAAS,EAAGK,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,oBAAa,EAACZ,SAAS,CAAC,IACxC,IAAI,CAACU,KAAK,GAAG,mBAAmB,GAAG,2BAA2B,IAC5D,IAAAE,oBAAa,EAACX,OAAO,CAAC;AAClC,SAAS,CAAC,CACH,CAACY,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","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 'universal-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,5 +1,5 @@
1
- import { HostElement } from 'universal-test-renderer';
2
- import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
1
+ import type { HostElement } from 'universal-test-renderer';
2
+ import type { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
3
3
  export declare function toHaveAccessibilityValue(this: jest.MatcherContext, element: HostElement, expectedValue: AccessibilityValueMatcher): {
4
4
  pass: boolean;
5
5
  message: () => string;
@@ -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 { HostElement } from 'universal-test-renderer';\nimport { computeAriaValue } from '../helpers/accessibility';\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: 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;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,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","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 'universal-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,5 +1,5 @@
1
- import { HostElement } from 'universal-test-renderer';
2
- import { TextMatch, TextMatchOptions } from '../matches';
1
+ import type { HostElement } from 'universal-test-renderer';
2
+ import type { TextMatch, TextMatchOptions } from '../matches';
3
3
  export declare function toHaveAccessibleName(this: jest.MatcherContext, element: HostElement, expectedName?: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
@@ -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 { HostElement } from 'universal-test-renderer';\nimport { computeAccessibleName } from '../helpers/accessibility';\nimport { TextMatch, TextMatchOptions, 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;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,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","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 'universal-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,5 +1,5 @@
1
- import { HostElement } from 'universal-test-renderer';
2
- import { TextMatch, TextMatchOptions } from '../matches';
1
+ import type { HostElement } from 'universal-test-renderer';
2
+ import type { TextMatch, TextMatchOptions } from '../matches';
3
3
  export declare function toHaveDisplayValue(this: jest.MatcherContext, element: HostElement, expectedValue: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toHaveDisplayValue = toHaveDisplayValue;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
- var _hostComponentNames = require("../helpers/host-component-names");
9
8
  var _errors = require("../helpers/errors");
9
+ 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");