@testing-library/react-native 13.0.0-alpha.2 → 14.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/build/act.d.ts +4 -3
  2. package/build/act.js +1 -6
  3. package/build/act.js.map +1 -1
  4. package/build/config.d.ts +1 -11
  5. package/build/config.js +1 -2
  6. package/build/config.js.map +1 -1
  7. package/build/fire-event.d.ts +7 -7
  8. package/build/fire-event.js +26 -4
  9. package/build/fire-event.js.map +1 -1
  10. package/build/helpers/accessibility.d.ts +14 -14
  11. package/build/helpers/accessibility.js +2 -2
  12. package/build/helpers/accessibility.js.map +1 -1
  13. package/build/helpers/component-tree.d.ts +7 -31
  14. package/build/helpers/component-tree.js +15 -73
  15. package/build/helpers/component-tree.js.map +1 -1
  16. package/build/helpers/debug.d.ts +2 -2
  17. package/build/helpers/debug.js.map +1 -1
  18. package/build/helpers/find-all.d.ts +2 -3
  19. package/build/helpers/find-all.js +5 -5
  20. package/build/helpers/find-all.js.map +1 -1
  21. package/build/helpers/format.d.ts +3 -3
  22. package/build/helpers/format.js.map +1 -1
  23. package/build/helpers/host-component-names.d.ts +7 -8
  24. package/build/helpers/host-component-names.js +7 -6
  25. package/build/helpers/host-component-names.js.map +1 -1
  26. package/build/helpers/matchers/match-accessibility-state.d.ts +2 -2
  27. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  28. package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
  29. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  30. package/build/helpers/matchers/match-label-text.d.ts +2 -2
  31. package/build/helpers/matchers/match-label-text.js.map +1 -1
  32. package/build/helpers/matchers/match-text-content.d.ts +2 -2
  33. package/build/helpers/matchers/match-text-content.js.map +1 -1
  34. package/build/helpers/pointer-events.d.ts +2 -2
  35. package/build/helpers/pointer-events.js +1 -2
  36. package/build/helpers/pointer-events.js.map +1 -1
  37. package/build/helpers/text-content.d.ts +2 -2
  38. package/build/helpers/text-content.js.map +1 -1
  39. package/build/helpers/text-input.d.ts +3 -3
  40. package/build/helpers/text-input.js.map +1 -1
  41. package/build/helpers/wrap-async.d.ts +1 -0
  42. package/build/helpers/wrap-async.js +1 -0
  43. package/build/helpers/wrap-async.js.map +1 -1
  44. package/build/index.d.ts +1 -0
  45. package/build/index.flow.js +0 -1
  46. package/build/index.js +11 -0
  47. package/build/index.js.map +1 -1
  48. package/build/matchers/to-be-busy.d.ts +2 -2
  49. package/build/matchers/to-be-busy.js.map +1 -1
  50. package/build/matchers/to-be-checked.d.ts +2 -2
  51. package/build/matchers/to-be-checked.js.map +1 -1
  52. package/build/matchers/to-be-disabled.d.ts +3 -3
  53. package/build/matchers/to-be-disabled.js +1 -2
  54. package/build/matchers/to-be-disabled.js.map +1 -1
  55. package/build/matchers/to-be-empty-element.d.ts +2 -2
  56. package/build/matchers/to-be-empty-element.js +1 -2
  57. package/build/matchers/to-be-empty-element.js.map +1 -1
  58. package/build/matchers/to-be-expanded.d.ts +3 -3
  59. package/build/matchers/to-be-expanded.js.map +1 -1
  60. package/build/matchers/to-be-on-the-screen.d.ts +2 -2
  61. package/build/matchers/to-be-on-the-screen.js +1 -1
  62. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  63. package/build/matchers/to-be-partially-checked.d.ts +2 -2
  64. package/build/matchers/to-be-partially-checked.js.map +1 -1
  65. package/build/matchers/to-be-selected.d.ts +2 -2
  66. package/build/matchers/to-be-selected.js.map +1 -1
  67. package/build/matchers/to-be-visible.d.ts +2 -2
  68. package/build/matchers/to-be-visible.js +1 -2
  69. package/build/matchers/to-be-visible.js.map +1 -1
  70. package/build/matchers/to-contain-element.d.ts +2 -2
  71. package/build/matchers/to-contain-element.js +2 -1
  72. package/build/matchers/to-contain-element.js.map +1 -1
  73. package/build/matchers/to-have-accessibility-value.d.ts +2 -2
  74. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  75. package/build/matchers/to-have-accessible-name.d.ts +2 -2
  76. package/build/matchers/to-have-accessible-name.js.map +1 -1
  77. package/build/matchers/to-have-display-value.d.ts +2 -2
  78. package/build/matchers/to-have-display-value.js.map +1 -1
  79. package/build/matchers/to-have-prop.d.ts +2 -2
  80. package/build/matchers/to-have-prop.js.map +1 -1
  81. package/build/matchers/to-have-style.d.ts +2 -2
  82. package/build/matchers/to-have-style.js.map +1 -1
  83. package/build/matchers/to-have-text-content.d.ts +2 -2
  84. package/build/matchers/to-have-text-content.js.map +1 -1
  85. package/build/matchers/types.d.ts +2 -2
  86. package/build/matchers/types.js.map +1 -1
  87. package/build/matchers/utils.d.ts +5 -5
  88. package/build/matchers/utils.js +10 -6
  89. package/build/matchers/utils.js.map +1 -1
  90. package/build/native-state.d.ts +3 -3
  91. package/build/native-state.js.map +1 -1
  92. package/build/queries/display-value.d.ts +2 -2
  93. package/build/queries/display-value.js.map +1 -1
  94. package/build/queries/hint-text.d.ts +2 -2
  95. package/build/queries/hint-text.js.map +1 -1
  96. package/build/queries/label-text.d.ts +2 -2
  97. package/build/queries/label-text.js.map +1 -1
  98. package/build/queries/make-queries.d.ts +9 -9
  99. package/build/queries/make-queries.js +2 -2
  100. package/build/queries/make-queries.js.map +1 -1
  101. package/build/queries/placeholder-text.d.ts +2 -2
  102. package/build/queries/placeholder-text.js.map +1 -1
  103. package/build/queries/role.d.ts +2 -2
  104. package/build/queries/role.js.map +1 -1
  105. package/build/queries/test-id.d.ts +2 -2
  106. package/build/queries/test-id.js.map +1 -1
  107. package/build/queries/text.d.ts +2 -2
  108. package/build/queries/text.js.map +1 -1
  109. package/build/render.d.ts +47 -85
  110. package/build/render.js +25 -69
  111. package/build/render.js.map +1 -1
  112. package/build/screen.js +1 -9
  113. package/build/screen.js.map +1 -1
  114. package/build/tsconfig.release.tsbuildinfo +1 -1
  115. package/build/user-event/clear.d.ts +2 -2
  116. package/build/user-event/clear.js.map +1 -1
  117. package/build/user-event/index.d.ts +7 -7
  118. package/build/user-event/index.js.map +1 -1
  119. package/build/user-event/paste.d.ts +2 -2
  120. package/build/user-event/paste.js.map +1 -1
  121. package/build/user-event/press/press.d.ts +3 -3
  122. package/build/user-event/press/press.js +1 -2
  123. package/build/user-event/press/press.js.map +1 -1
  124. package/build/user-event/scroll/scroll-to.d.ts +2 -2
  125. package/build/user-event/scroll/scroll-to.js.map +1 -1
  126. package/build/user-event/setup/setup.d.ts +7 -7
  127. package/build/user-event/setup/setup.js.map +1 -1
  128. package/build/user-event/type/type.d.ts +3 -3
  129. package/build/user-event/type/type.js.map +1 -1
  130. package/build/user-event/utils/dispatch-event.d.ts +2 -2
  131. package/build/user-event/utils/dispatch-event.js.map +1 -1
  132. package/build/within.d.ts +20 -36
  133. package/build/within.js +7 -11
  134. package/build/within.js.map +1 -1
  135. package/package.json +10 -11
  136. package/typings/index.flow.js +0 -1
  137. package/build/helpers/string-validation.d.ts +0 -2
  138. package/build/helpers/string-validation.js +0 -31
  139. package/build/helpers/string-validation.js.map +0 -1
  140. package/build/queries/unsafe-props.d.ts +0 -16
  141. package/build/queries/unsafe-props.js +0 -49
  142. package/build/queries/unsafe-props.js.map +0 -1
  143. package/build/queries/unsafe-type.d.ts +0 -9
  144. package/build/queries/unsafe-type.js +0 -47
  145. package/build/queries/unsafe-type.js.map +0 -1
  146. package/build/render-act.d.ts +0 -2
  147. package/build/render-act.js +0 -22
  148. package/build/render-act.js.map +0 -1
@@ -7,7 +7,6 @@ exports.toBeDisabled = toBeDisabled;
7
7
  exports.toBeEnabled = toBeEnabled;
8
8
  var _jestMatcherUtils = require("jest-matcher-utils");
9
9
  var _accessibility = require("../helpers/accessibility");
10
- var _componentTree = require("../helpers/component-tree");
11
10
  var _utils = require("./utils");
12
11
  function toBeDisabled(element) {
13
12
  (0, _utils.checkHostElement)(element, toBeDisabled, this);
@@ -32,7 +31,7 @@ function toBeEnabled(element) {
32
31
  };
33
32
  }
34
33
  function isAncestorDisabled(element) {
35
- const parent = (0, _componentTree.getHostParent)(element);
34
+ const parent = element.parent;
36
35
  if (parent == null) {
37
36
  return false;
38
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_accessibility","_componentTree","_utils","toBeDisabled","element","checkHostElement","isDisabled","computeAriaDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","formatElement","join","toBeEnabled","isEnabled","parent","getHostParent"],"sources":["../../src/matchers/to-be-disabled.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaDisabled } from '../helpers/accessibility';\nimport { getHostParent } from '../helpers/component-tree';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: ReactTestInstance) {\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: ReactTestInstance) {\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: ReactTestInstance): boolean {\n const parent = getHostParent(element);\n if (parent == null) {\n return false;\n }\n\n return computeAriaDisabled(parent) || isAncestorDisabled(parent);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,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,OAA0B,EAAE;EACjF,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,OAA0B,EAAW;EAC/D,MAAMc,MAAM,GAAG,IAAAC,4BAAa,EAACf,OAAO,CAAC;EACrC,IAAIc,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","_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,5 +1,5 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeEmptyElement(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeEmptyElement = toBeEmptyElement;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
- var _componentTree = require("../helpers/component-tree");
9
8
  var _utils = require("./utils");
10
9
  function toBeEmptyElement(element) {
11
10
  (0, _utils.checkHostElement)(element, toBeEmptyElement, this);
12
- const hostChildren = (0, _componentTree.getHostChildren)(element);
11
+ const hostChildren = element.children;
13
12
  return {
14
13
  pass: hostChildren.length === 0,
15
14
  message: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_componentTree","_utils","toBeEmptyElement","element","checkHostElement","hostChildren","getHostChildren","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElementArray","join"],"sources":["../../src/matchers/to-be-empty-element.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getHostChildren } from '../helpers/component-tree';\nimport { checkHostElement, formatElementArray } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEmptyElement, this);\n\n const hostChildren = getHostChildren(element);\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":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,gBAAgBA,CAA4BC,OAA0B,EAAE;EACtF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEjD,MAAMG,YAAY,GAAG,IAAAC,8BAAe,EAACH,OAAO,CAAC;EAE7C,OAAO;IACLI,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","_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,9 +1,9 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeExpanded(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
6
- export declare function toBeCollapsed(this: jest.MatcherContext, element: ReactTestInstance): {
6
+ export declare function toBeCollapsed(this: jest.MatcherContext, element: HostElement): {
7
7
  pass: boolean;
8
8
  message: () => string;
9
9
  };
@@ -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 { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaExpanded } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance) {\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: ReactTestInstance) {\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":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,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,OAA0B,EAAE;EACnF,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","_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,5 +1,5 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeOnTheScreen(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeOnTheScreen(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -12,7 +12,7 @@ function toBeOnTheScreen(element) {
12
12
  if (element !== null || !this.isNot) {
13
13
  (0, _utils.checkHostElement)(element, toBeOnTheScreen, this);
14
14
  }
15
- const pass = element === null ? false : _screen.screen.UNSAFE_root === (0, _componentTree.getUnsafeRootElement)(element);
15
+ const pass = element === null ? false : _screen.screen.container === (0, _componentTree.getContainerElement)(element);
16
16
  const errorFound = () => {
17
17
  return `expected element tree not to contain element, but found\n${(0, _utils.formatElement)(element)}`;
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_componentTree","_screen","_utils","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","UNSAFE_root","getUnsafeRootElement","errorFound","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getUnsafeRootElement } from '../helpers/component-tree';\nimport { screen } from '../screen';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeOnTheScreen, this);\n }\n\n const pass = element === null ? false : screen.UNSAFE_root === getUnsafeRootElement(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":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,eAAeA,CAA4BC,OAA0B,EAAE;EACrF,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,WAAW,KAAK,IAAAC,mCAAoB,EAACN,OAAO,CAAC;EAE5F,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","_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,5 +1,5 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBePartiallyChecked(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBePartiallyChecked(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -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 type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\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: ReactTestInstance) {\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: ReactTestInstance) {\n const role = getRole(element);\n return isAccessibilityElement(element) && role === 'checkbox';\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAA4BC,OAA0B,EAAE;EAC1F,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,OAA0B,EAAE;EAC7D,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","_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,5 +1,5 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeSelected(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeSelected(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -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 { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaSelected } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeSelected(this: jest.MatcherContext, element: ReactTestInstance) {\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":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,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","_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,5 +1,5 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeVisible(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeVisible(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -7,7 +7,6 @@ exports.toBeVisible = toBeVisible;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
8
  var _reactNative = require("react-native");
9
9
  var _accessibility = require("../helpers/accessibility");
10
- var _componentTree = require("../helpers/component-tree");
11
10
  var _hostComponentNames = require("../helpers/host-component-names");
12
11
  var _utils = require("./utils");
13
12
  function toBeVisible(element) {
@@ -39,7 +38,7 @@ function isElementVisible(element, accessibilityCache) {
39
38
  if ((0, _hostComponentNames.isHostModal)(element) && element.props.visible === false) {
40
39
  return false;
41
40
  }
42
- const hostParent = (0, _componentTree.getHostParent)(element);
41
+ const hostParent = element.parent;
43
42
  if (hostParent === null) {
44
43
  return true;
45
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-visible.js","names":["_jestMatcherUtils","require","_reactNative","_accessibility","_componentTree","_hostComponentNames","_utils","toBeVisible","element","isNot","checkHostElement","pass","isElementVisible","message","is","matcherHint","formatElement","join","accessibilityCache","cache","WeakMap","isHiddenFromAccessibility","isHiddenForStyles","isHostModal","props","visible","hostParent","getHostParent","flatStyle","StyleSheet","flatten","style","display","opacity"],"sources":["../../src/matchers/to-be-visible.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { StyleSheet } from 'react-native';\nimport { isHiddenFromAccessibility } from '../helpers/accessibility';\nimport { getHostParent } from '../helpers/component-tree';\nimport { isHostModal } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeVisible(this: jest.MatcherContext, element: ReactTestInstance) {\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: ReactTestInstance,\n accessibilityCache?: WeakMap<ReactTestInstance, boolean>,\n): boolean {\n // Use cache to speed up repeated searches by `isHiddenFromAccessibility`.\n const cache = accessibilityCache ?? new WeakMap<ReactTestInstance, 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 = getHostParent(element);\n if (hostParent === null) {\n return true;\n }\n\n return isElementVisible(hostParent, cache);\n}\n\nfunction isHiddenForStyles(element: ReactTestInstance) {\n const flatStyle = StyleSheet.flatten(element.props.style);\n return flatStyle?.display === 'none' || flatStyle?.opacity === 0;\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,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,OAA0B,EAC1BU,kBAAwD,EAC/C;EACT;EACA,MAAMC,KAAK,GAAGD,kBAAkB,IAAI,IAAIE,OAAO,CAA6B,CAAC;EAC7E,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,GAAG,IAAAC,4BAAa,EAACnB,OAAO,CAAC;EACzC,IAAIkB,UAAU,KAAK,IAAI,EAAE;IACvB,OAAO,IAAI;EACb;EAEA,OAAOd,gBAAgB,CAACc,UAAU,EAAEP,KAAK,CAAC;AAC5C;AAEA,SAASG,iBAAiBA,CAACd,OAA0B,EAAE;EACrD,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":["_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,5 +1,5 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toContainElement(this: jest.MatcherContext, container: ReactTestInstance, element: ReactTestInstance | null): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toContainElement(this: jest.MatcherContext, container: HostElement, element: HostElement | null): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -5,6 +5,7 @@ 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
9
  var _utils = require("./utils");
9
10
  function toContainElement(container, element) {
10
11
  (0, _utils.checkHostElement)(container, toContainElement, this);
@@ -13,7 +14,7 @@ function toContainElement(container, element) {
13
14
  }
14
15
  let matches = [];
15
16
  if (element) {
16
- matches = container.findAll(node => node === element);
17
+ matches = (0, _findAll.findAll)(container, node => node === element);
17
18
  }
18
19
  return {
19
20
  pass: matches.length > 0,
@@ -1 +1 @@
1
- {"version":3,"file":"to-contain-element.js","names":["_jestMatcherUtils","require","_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 { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toContainElement(\n this: jest.MatcherContext,\n container: ReactTestInstance,\n element: ReactTestInstance | null,\n) {\n checkHostElement(container, toContainElement, this);\n\n if (element !== null) {\n checkHostElement(element, toContainElement, this);\n }\n\n let matches: ReactTestInstance[] = [];\n if (element) {\n matches = container.findAll((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":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,gBAAgBA,CAE9BC,SAA4B,EAC5BC,OAAiC,EACjC;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,OAA4B,GAAG,EAAE;EACrC,IAAIF,OAAO,EAAE;IACXE,OAAO,GAAGH,SAAS,CAACI,OAAO,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,OAAO,CAAC;EACzD;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","_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,6 +1,6 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
3
- export declare function toHaveAccessibilityValue(this: jest.MatcherContext, element: ReactTestInstance, expectedValue: AccessibilityValueMatcher): {
3
+ export declare function toHaveAccessibilityValue(this: jest.MatcherContext, element: HostElement, expectedValue: AccessibilityValueMatcher): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -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 type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, stringify } from 'jest-matcher-utils';\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: ReactTestInstance,\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":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,OAA0B,EAC1BC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAEzD,MAAMI,aAAa,GAAG,IAAAC,+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 { 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,6 +1,6 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- export declare function toHaveAccessibleName(this: jest.MatcherContext, element: ReactTestInstance, expectedName?: TextMatch, options?: TextMatchOptions): {
3
+ export declare function toHaveAccessibleName(this: jest.MatcherContext, element: HostElement, expectedName?: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -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 type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\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: ReactTestInstance,\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":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAElCC,OAA0B,EAC1BC,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 { 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,6 +1,6 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- export declare function toHaveDisplayValue(this: jest.MatcherContext, element: ReactTestInstance, expectedValue: TextMatch, options?: TextMatchOptions): {
3
+ export declare function toHaveDisplayValue(this: jest.MatcherContext, element: HostElement, expectedValue: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-have-display-value.js","names":["_jestMatcherUtils","require","_hostComponentNames","_errors","_textInput","_matches","_utils","toHaveDisplayValue","element","expectedValue","options","checkHostElement","isHostTextInput","ErrorWithStack","type","receivedValue","getTextInputValue","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-display-value.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { getTextInputValue } from '../helpers/text-input';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveDisplayValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveDisplayValue, this);\n\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `toHaveDisplayValue() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n toHaveDisplayValue,\n );\n }\n\n const receivedValue = getTextInputValue(element);\n\n return {\n pass: matches(expectedValue, receivedValue, options?.normalizer, options?.exact),\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have display value`,\n expectedValue,\n 'Received',\n receivedValue,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,kBAAkBA,CAEhCC,OAA0B,EAC1BC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,kBAAkB,EAAE,IAAI,CAAC;EAEnD,IAAI,CAAC,IAAAK,mCAAe,EAACJ,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,sBAAc,CACtB,4FAA4FL,OAAO,CAACM,IAAI,IAAI,EAC5GP,kBACF,CAAC;EACH;EAEA,MAAMQ,aAAa,GAAG,IAAAC,4BAAiB,EAACR,OAAO,CAAC;EAEhD,OAAO;IACLS,IAAI,EAAE,IAAAC,gBAAO,EAACT,aAAa,EAAEM,aAAa,EAAEL,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC;IAChFC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC5E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,qBAAqB,EACrEf,aAAa,EACb,UAAU,EACVM,aACF,CAAC,CACF,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-have-display-value.js","names":["_jestMatcherUtils","require","_hostComponentNames","_errors","_textInput","_matches","_utils","toHaveDisplayValue","element","expectedValue","options","checkHostElement","isHostTextInput","ErrorWithStack","type","receivedValue","getTextInputValue","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-display-value.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { getTextInputValue } from '../helpers/text-input';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveDisplayValue(\n this: jest.MatcherContext,\n element: HostElement,\n expectedValue: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveDisplayValue, this);\n\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `toHaveDisplayValue() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n toHaveDisplayValue,\n );\n }\n\n const receivedValue = getTextInputValue(element);\n\n return {\n pass: matches(expectedValue, receivedValue, options?.normalizer, options?.exact),\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have display value`,\n expectedValue,\n 'Received',\n receivedValue,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,kBAAkBA,CAEhCC,OAAoB,EACpBC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,kBAAkB,EAAE,IAAI,CAAC;EAEnD,IAAI,CAAC,IAAAK,mCAAe,EAACJ,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,sBAAc,CACtB,4FAA4FL,OAAO,CAACM,IAAI,IAAI,EAC5GP,kBACF,CAAC;EACH;EAEA,MAAMQ,aAAa,GAAG,IAAAC,4BAAiB,EAACR,OAAO,CAAC;EAEhD,OAAO;IACLS,IAAI,EAAE,IAAAC,gBAAO,EAACT,aAAa,EAAEM,aAAa,EAAEL,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC;IAChFC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC5E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,qBAAqB,EACrEf,aAAa,EACb,UAAU,EACVM,aACF,CAAC,CACF,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toHaveProp(this: jest.MatcherContext, element: ReactTestInstance, name: string, expectedValue: unknown): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toHaveProp(this: jest.MatcherContext, element: HostElement, name: string, expectedValue: unknown): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-have-prop.js","names":["_jestMatcherUtils","require","_utils","toHaveProp","element","name","expectedValue","checkHostElement","isExpectedValueDefined","undefined","hasProp","props","receivedValue","pass","equals","message","to","isNot","matcher","matcherHint","printExpected","secondArgument","formatMessage","formatProp","value","stringify"],"sources":["../../src/matchers/to-have-prop.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, stringify, printExpected } from 'jest-matcher-utils';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveProp(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n name: string,\n expectedValue: unknown,\n) {\n checkHostElement(element, toHaveProp, this);\n\n const isExpectedValueDefined = expectedValue !== undefined;\n const hasProp = name in element.props;\n const receivedValue = element.props[name];\n\n const pass = isExpectedValueDefined\n ? hasProp && this.equals(expectedValue, receivedValue)\n : hasProp;\n\n return {\n pass,\n message: () => {\n const to = this.isNot ? 'not to' : 'to';\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveProp`,\n 'element',\n printExpected(name),\n {\n secondArgument: isExpectedValueDefined ? printExpected(expectedValue) : undefined,\n },\n );\n return formatMessage(\n matcher,\n `Expected element ${to} have prop`,\n formatProp(name, expectedValue),\n 'Received',\n hasProp ? formatProp(name, receivedValue) : undefined,\n );\n },\n };\n}\n\nfunction formatProp(name: string, value: unknown) {\n if (value === undefined) {\n return name;\n }\n\n if (typeof value === 'string') {\n return `${name}=\"${value}\"`;\n }\n\n return `${name}={${stringify(value)}}`;\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,UAAUA,CAExBC,OAA0B,EAC1BC,IAAY,EACZC,aAAsB,EACtB;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,UAAU,EAAE,IAAI,CAAC;EAE3C,MAAMK,sBAAsB,GAAGF,aAAa,KAAKG,SAAS;EAC1D,MAAMC,OAAO,GAAGL,IAAI,IAAID,OAAO,CAACO,KAAK;EACrC,MAAMC,aAAa,GAAGR,OAAO,CAACO,KAAK,CAACN,IAAI,CAAC;EAEzC,MAAMQ,IAAI,GAAGL,sBAAsB,GAC/BE,OAAO,IAAI,IAAI,CAACI,MAAM,CAACR,aAAa,EAAEM,aAAa,CAAC,GACpDF,OAAO;EAEX,OAAO;IACLG,IAAI;IACJE,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,QAAQ,GAAG,IAAI;MACvC,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACzB,GAAG,IAAI,CAACF,KAAK,GAAG,MAAM,GAAG,EAAE,aAAa,EACxC,SAAS,EACT,IAAAG,+BAAa,EAACf,IAAI,CAAC,EACnB;QACEgB,cAAc,EAAEb,sBAAsB,GAAG,IAAAY,+BAAa,EAACd,aAAa,CAAC,GAAGG;MAC1E,CACF,CAAC;MACD,OAAO,IAAAa,oBAAa,EAClBJ,OAAO,EACP,oBAAoBF,EAAE,YAAY,EAClCO,UAAU,CAAClB,IAAI,EAAEC,aAAa,CAAC,EAC/B,UAAU,EACVI,OAAO,GAAGa,UAAU,CAAClB,IAAI,EAAEO,aAAa,CAAC,GAAGH,SAC9C,CAAC;IACH;EACF,CAAC;AACH;AAEA,SAASc,UAAUA,CAAClB,IAAY,EAAEmB,KAAc,EAAE;EAChD,IAAIA,KAAK,KAAKf,SAAS,EAAE;IACvB,OAAOJ,IAAI;EACb;EAEA,IAAI,OAAOmB,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,GAAGnB,IAAI,KAAKmB,KAAK,GAAG;EAC7B;EAEA,OAAO,GAAGnB,IAAI,KAAK,IAAAoB,2BAAS,EAACD,KAAK,CAAC,GAAG;AACxC","ignoreList":[]}
1
+ {"version":3,"file":"to-have-prop.js","names":["_jestMatcherUtils","require","_utils","toHaveProp","element","name","expectedValue","checkHostElement","isExpectedValueDefined","undefined","hasProp","props","receivedValue","pass","equals","message","to","isNot","matcher","matcherHint","printExpected","secondArgument","formatMessage","formatProp","value","stringify"],"sources":["../../src/matchers/to-have-prop.ts"],"sourcesContent":["import { matcherHint, stringify, printExpected } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveProp(\n this: jest.MatcherContext,\n element: HostElement,\n name: string,\n expectedValue: unknown,\n) {\n checkHostElement(element, toHaveProp, this);\n\n const isExpectedValueDefined = expectedValue !== undefined;\n const hasProp = name in element.props;\n const receivedValue = element.props[name];\n\n const pass = isExpectedValueDefined\n ? hasProp && this.equals(expectedValue, receivedValue)\n : hasProp;\n\n return {\n pass,\n message: () => {\n const to = this.isNot ? 'not to' : 'to';\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveProp`,\n 'element',\n printExpected(name),\n {\n secondArgument: isExpectedValueDefined ? printExpected(expectedValue) : undefined,\n },\n );\n return formatMessage(\n matcher,\n `Expected element ${to} have prop`,\n formatProp(name, expectedValue),\n 'Received',\n hasProp ? formatProp(name, receivedValue) : undefined,\n );\n },\n };\n}\n\nfunction formatProp(name: string, value: unknown) {\n if (value === undefined) {\n return name;\n }\n\n if (typeof value === 'string') {\n return `${name}=\"${value}\"`;\n }\n\n return `${name}={${stringify(value)}}`;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,UAAUA,CAExBC,OAAoB,EACpBC,IAAY,EACZC,aAAsB,EACtB;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,UAAU,EAAE,IAAI,CAAC;EAE3C,MAAMK,sBAAsB,GAAGF,aAAa,KAAKG,SAAS;EAC1D,MAAMC,OAAO,GAAGL,IAAI,IAAID,OAAO,CAACO,KAAK;EACrC,MAAMC,aAAa,GAAGR,OAAO,CAACO,KAAK,CAACN,IAAI,CAAC;EAEzC,MAAMQ,IAAI,GAAGL,sBAAsB,GAC/BE,OAAO,IAAI,IAAI,CAACI,MAAM,CAACR,aAAa,EAAEM,aAAa,CAAC,GACpDF,OAAO;EAEX,OAAO;IACLG,IAAI;IACJE,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,QAAQ,GAAG,IAAI;MACvC,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACzB,GAAG,IAAI,CAACF,KAAK,GAAG,MAAM,GAAG,EAAE,aAAa,EACxC,SAAS,EACT,IAAAG,+BAAa,EAACf,IAAI,CAAC,EACnB;QACEgB,cAAc,EAAEb,sBAAsB,GAAG,IAAAY,+BAAa,EAACd,aAAa,CAAC,GAAGG;MAC1E,CACF,CAAC;MACD,OAAO,IAAAa,oBAAa,EAClBJ,OAAO,EACP,oBAAoBF,EAAE,YAAY,EAClCO,UAAU,CAAClB,IAAI,EAAEC,aAAa,CAAC,EAC/B,UAAU,EACVI,OAAO,GAAGa,UAAU,CAAClB,IAAI,EAAEO,aAAa,CAAC,GAAGH,SAC9C,CAAC;IACH;EACF,CAAC;AACH;AAEA,SAASc,UAAUA,CAAClB,IAAY,EAAEmB,KAAc,EAAE;EAChD,IAAIA,KAAK,KAAKf,SAAS,EAAE;IACvB,OAAOJ,IAAI;EACb;EAEA,IAAI,OAAOmB,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,GAAGnB,IAAI,KAAKmB,KAAK,GAAG;EAC7B;EAEA,OAAO,GAAGnB,IAAI,KAAK,IAAAoB,2BAAS,EAACD,KAAK,CAAC,GAAG;AACxC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
1
  import { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ import { HostElement } from 'universal-test-renderer';
3
3
  export type Style = ViewStyle | TextStyle | ImageStyle;
4
- export declare function toHaveStyle(this: jest.MatcherContext, element: ReactTestInstance, style: StyleProp<Style>): {
4
+ export declare function toHaveStyle(this: jest.MatcherContext, element: HostElement, style: StyleProp<Style>): {
5
5
  pass: boolean;
6
6
  message: () => string;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-have-style.js","names":["_reactNative","require","_jestMatcherUtils","_utils","toHaveStyle","element","style","checkHostElement","expected","StyleSheet","flatten","received","props","pass","Object","keys","every","key","equals","message","to","isNot","matcher","matcherHint","formatMessage","formatStyles","pickReceivedStyles","expectedDiff","join","receivedNarrow","diff","result","forEach","undefined","sort","map","prop","Array","isArray","JSON","stringify"],"sources":["../../src/matchers/to-have-style.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { ImageStyle, StyleProp, StyleSheet, TextStyle, ViewStyle } from 'react-native';\nimport { matcherHint, diff } from 'jest-matcher-utils';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport type Style = ViewStyle | TextStyle | ImageStyle;\n\ntype StyleLike = Record<string, unknown>;\n\nexport function toHaveStyle(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n style: StyleProp<Style>,\n) {\n checkHostElement(element, toHaveStyle, this);\n\n const expected = (StyleSheet.flatten(style) as StyleLike) ?? {};\n const received = (StyleSheet.flatten(element.props.style) as StyleLike) ?? {};\n\n const pass = Object.keys(expected).every((key) => this.equals(expected[key], received[key]));\n\n return {\n pass,\n message: () => {\n const to = this.isNot ? 'not to' : 'to';\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toHaveStyle`, 'element', '');\n\n if (pass) {\n return formatMessage(\n matcher,\n `Expected element ${to} have style`,\n formatStyles(expected),\n 'Received',\n formatStyles(pickReceivedStyles(expected, received)),\n );\n } else {\n return [matcher, '', expectedDiff(expected, received)].join('\\n');\n }\n },\n };\n}\n\n/**\n * Generate diff between `expected` and `received` styles.\n */\nfunction expectedDiff(expected: StyleLike, received: StyleLike) {\n const receivedNarrow = pickReceivedStyles(expected, received);\n return diff(formatStyles(expected), formatStyles(receivedNarrow));\n}\n\n/**\n * Pick from `received` style only the keys present in `expected` style.\n */\nfunction pickReceivedStyles(expected: StyleLike, received: StyleLike) {\n const result: StyleLike = {};\n Object.keys(received).forEach((key) => {\n if (expected[key] !== undefined) {\n result[key] = received[key];\n }\n });\n\n return result;\n}\n\nfunction formatStyles(style: StyleLike) {\n return Object.keys(style)\n .sort()\n .map((prop) =>\n Array.isArray(style[prop])\n ? `${prop}: ${JSON.stringify(style[prop], null, 2)};`\n : `${prop}: ${style[prop]};`,\n )\n .join('\\n');\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAMO,SAASG,WAAWA,CAEzBC,OAA0B,EAC1BC,KAAuB,EACvB;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMI,QAAQ,GAAIC,uBAAU,CAACC,OAAO,CAACJ,KAAK,CAAC,IAAkB,CAAC,CAAC;EAC/D,MAAMK,QAAQ,GAAIF,uBAAU,CAACC,OAAO,CAACL,OAAO,CAACO,KAAK,CAACN,KAAK,CAAC,IAAkB,CAAC,CAAC;EAE7E,MAAMO,IAAI,GAAGC,MAAM,CAACC,IAAI,CAACP,QAAQ,CAAC,CAACQ,KAAK,CAAEC,GAAG,IAAK,IAAI,CAACC,MAAM,CAACV,QAAQ,CAACS,GAAG,CAAC,EAAEN,QAAQ,CAACM,GAAG,CAAC,CAAC,CAAC;EAE5F,OAAO;IACLJ,IAAI;IACJM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,QAAQ,GAAG,IAAI;MACvC,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACF,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC;MAErF,IAAIR,IAAI,EAAE;QACR,OAAO,IAAAW,oBAAa,EAClBF,OAAO,EACP,oBAAoBF,EAAE,aAAa,EACnCK,YAAY,CAACjB,QAAQ,CAAC,EACtB,UAAU,EACViB,YAAY,CAACC,kBAAkB,CAAClB,QAAQ,EAAEG,QAAQ,CAAC,CACrD,CAAC;MACH,CAAC,MAAM;QACL,OAAO,CAACW,OAAO,EAAE,EAAE,EAAEK,YAAY,CAACnB,QAAQ,EAAEG,QAAQ,CAAC,CAAC,CAACiB,IAAI,CAAC,IAAI,CAAC;MACnE;IACF;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,SAASD,YAAYA,CAACnB,QAAmB,EAAEG,QAAmB,EAAE;EAC9D,MAAMkB,cAAc,GAAGH,kBAAkB,CAAClB,QAAQ,EAAEG,QAAQ,CAAC;EAC7D,OAAO,IAAAmB,sBAAI,EAACL,YAAY,CAACjB,QAAQ,CAAC,EAAEiB,YAAY,CAACI,cAAc,CAAC,CAAC;AACnE;;AAEA;AACA;AACA;AACA,SAASH,kBAAkBA,CAAClB,QAAmB,EAAEG,QAAmB,EAAE;EACpE,MAAMoB,MAAiB,GAAG,CAAC,CAAC;EAC5BjB,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,CAACqB,OAAO,CAAEf,GAAG,IAAK;IACrC,IAAIT,QAAQ,CAACS,GAAG,CAAC,KAAKgB,SAAS,EAAE;MAC/BF,MAAM,CAACd,GAAG,CAAC,GAAGN,QAAQ,CAACM,GAAG,CAAC;IAC7B;EACF,CAAC,CAAC;EAEF,OAAOc,MAAM;AACf;AAEA,SAASN,YAAYA,CAACnB,KAAgB,EAAE;EACtC,OAAOQ,MAAM,CAACC,IAAI,CAACT,KAAK,CAAC,CACtB4B,IAAI,CAAC,CAAC,CACNC,GAAG,CAAEC,IAAI,IACRC,KAAK,CAACC,OAAO,CAAChC,KAAK,CAAC8B,IAAI,CAAC,CAAC,GACtB,GAAGA,IAAI,KAAKG,IAAI,CAACC,SAAS,CAAClC,KAAK,CAAC8B,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,GACnD,GAAGA,IAAI,KAAK9B,KAAK,CAAC8B,IAAI,CAAC,GAC7B,CAAC,CACAR,IAAI,CAAC,IAAI,CAAC;AACf","ignoreList":[]}
1
+ {"version":3,"file":"to-have-style.js","names":["_reactNative","require","_jestMatcherUtils","_utils","toHaveStyle","element","style","checkHostElement","expected","StyleSheet","flatten","received","props","pass","Object","keys","every","key","equals","message","to","isNot","matcher","matcherHint","formatMessage","formatStyles","pickReceivedStyles","expectedDiff","join","receivedNarrow","diff","result","forEach","undefined","sort","map","prop","Array","isArray","JSON","stringify"],"sources":["../../src/matchers/to-have-style.ts"],"sourcesContent":["import { ImageStyle, StyleProp, StyleSheet, TextStyle, ViewStyle } from 'react-native';\nimport { matcherHint, diff } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport type Style = ViewStyle | TextStyle | ImageStyle;\n\ntype StyleLike = Record<string, unknown>;\n\nexport function toHaveStyle(\n this: jest.MatcherContext,\n element: HostElement,\n style: StyleProp<Style>,\n) {\n checkHostElement(element, toHaveStyle, this);\n\n const expected = (StyleSheet.flatten(style) as StyleLike) ?? {};\n const received = (StyleSheet.flatten(element.props.style) as StyleLike) ?? {};\n\n const pass = Object.keys(expected).every((key) => this.equals(expected[key], received[key]));\n\n return {\n pass,\n message: () => {\n const to = this.isNot ? 'not to' : 'to';\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toHaveStyle`, 'element', '');\n\n if (pass) {\n return formatMessage(\n matcher,\n `Expected element ${to} have style`,\n formatStyles(expected),\n 'Received',\n formatStyles(pickReceivedStyles(expected, received)),\n );\n } else {\n return [matcher, '', expectedDiff(expected, received)].join('\\n');\n }\n },\n };\n}\n\n/**\n * Generate diff between `expected` and `received` styles.\n */\nfunction expectedDiff(expected: StyleLike, received: StyleLike) {\n const receivedNarrow = pickReceivedStyles(expected, received);\n return diff(formatStyles(expected), formatStyles(receivedNarrow));\n}\n\n/**\n * Pick from `received` style only the keys present in `expected` style.\n */\nfunction pickReceivedStyles(expected: StyleLike, received: StyleLike) {\n const result: StyleLike = {};\n Object.keys(received).forEach((key) => {\n if (expected[key] !== undefined) {\n result[key] = received[key];\n }\n });\n\n return result;\n}\n\nfunction formatStyles(style: StyleLike) {\n return Object.keys(style)\n .sort()\n .map((prop) =>\n Array.isArray(style[prop])\n ? `${prop}: ${JSON.stringify(style[prop], null, 2)};`\n : `${prop}: ${style[prop]};`,\n )\n .join('\\n');\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAMO,SAASG,WAAWA,CAEzBC,OAAoB,EACpBC,KAAuB,EACvB;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMI,QAAQ,GAAIC,uBAAU,CAACC,OAAO,CAACJ,KAAK,CAAC,IAAkB,CAAC,CAAC;EAC/D,MAAMK,QAAQ,GAAIF,uBAAU,CAACC,OAAO,CAACL,OAAO,CAACO,KAAK,CAACN,KAAK,CAAC,IAAkB,CAAC,CAAC;EAE7E,MAAMO,IAAI,GAAGC,MAAM,CAACC,IAAI,CAACP,QAAQ,CAAC,CAACQ,KAAK,CAAEC,GAAG,IAAK,IAAI,CAACC,MAAM,CAACV,QAAQ,CAACS,GAAG,CAAC,EAAEN,QAAQ,CAACM,GAAG,CAAC,CAAC,CAAC;EAE5F,OAAO;IACLJ,IAAI;IACJM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,QAAQ,GAAG,IAAI;MACvC,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACF,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC;MAErF,IAAIR,IAAI,EAAE;QACR,OAAO,IAAAW,oBAAa,EAClBF,OAAO,EACP,oBAAoBF,EAAE,aAAa,EACnCK,YAAY,CAACjB,QAAQ,CAAC,EACtB,UAAU,EACViB,YAAY,CAACC,kBAAkB,CAAClB,QAAQ,EAAEG,QAAQ,CAAC,CACrD,CAAC;MACH,CAAC,MAAM;QACL,OAAO,CAACW,OAAO,EAAE,EAAE,EAAEK,YAAY,CAACnB,QAAQ,EAAEG,QAAQ,CAAC,CAAC,CAACiB,IAAI,CAAC,IAAI,CAAC;MACnE;IACF;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,SAASD,YAAYA,CAACnB,QAAmB,EAAEG,QAAmB,EAAE;EAC9D,MAAMkB,cAAc,GAAGH,kBAAkB,CAAClB,QAAQ,EAAEG,QAAQ,CAAC;EAC7D,OAAO,IAAAmB,sBAAI,EAACL,YAAY,CAACjB,QAAQ,CAAC,EAAEiB,YAAY,CAACI,cAAc,CAAC,CAAC;AACnE;;AAEA;AACA;AACA;AACA,SAASH,kBAAkBA,CAAClB,QAAmB,EAAEG,QAAmB,EAAE;EACpE,MAAMoB,MAAiB,GAAG,CAAC,CAAC;EAC5BjB,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,CAACqB,OAAO,CAAEf,GAAG,IAAK;IACrC,IAAIT,QAAQ,CAACS,GAAG,CAAC,KAAKgB,SAAS,EAAE;MAC/BF,MAAM,CAACd,GAAG,CAAC,GAAGN,QAAQ,CAACM,GAAG,CAAC;IAC7B;EACF,CAAC,CAAC;EAEF,OAAOc,MAAM;AACf;AAEA,SAASN,YAAYA,CAACnB,KAAgB,EAAE;EACtC,OAAOQ,MAAM,CAACC,IAAI,CAACT,KAAK,CAAC,CACtB4B,IAAI,CAAC,CAAC,CACNC,GAAG,CAAEC,IAAI,IACRC,KAAK,CAACC,OAAO,CAAChC,KAAK,CAAC8B,IAAI,CAAC,CAAC,GACtB,GAAGA,IAAI,KAAKG,IAAI,CAACC,SAAS,CAAClC,KAAK,CAAC8B,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,GACnD,GAAGA,IAAI,KAAK9B,KAAK,CAAC8B,IAAI,CAAC,GAC7B,CAAC,CACAR,IAAI,CAAC,IAAI,CAAC;AACf","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- export declare function toHaveTextContent(this: jest.MatcherContext, element: ReactTestInstance, expectedText: TextMatch, options?: TextMatchOptions): {
3
+ export declare function toHaveTextContent(this: jest.MatcherContext, element: HostElement, expectedText: TextMatch, options?: TextMatchOptions): {
4
4
  pass: boolean;
5
5
  message: () => string;
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-have-text-content.js","names":["_jestMatcherUtils","require","_textContent","_matches","_utils","toHaveTextContent","element","expectedText","options","checkHostElement","text","getTextContent","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-text-content.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { getTextContent } from '../helpers/text-content';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveTextContent(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedText: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveTextContent, this);\n\n const text = getTextContent(element);\n\n return {\n pass: matches(expectedText, text, options?.normalizer, options?.exact),\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveTextContent`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have text content`,\n expectedText,\n 'Received',\n text,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,iBAAiBA,CAE/BC,OAA0B,EAC1BC,YAAuB,EACvBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,iBAAiB,EAAE,IAAI,CAAC;EAElD,MAAMK,IAAI,GAAG,IAAAC,2BAAc,EAACL,OAAO,CAAC;EAEpC,OAAO;IACLM,IAAI,EAAE,IAAAC,gBAAO,EAACN,YAAY,EAAEG,IAAI,EAAEF,OAAO,EAAEM,UAAU,EAAEN,OAAO,EAAEO,KAAK,CAAC;IACtEC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,oBAAoB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC3E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,oBAAoB,EACpEZ,YAAY,EACZ,UAAU,EACVG,IACF,CAAC,CACF,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-have-text-content.js","names":["_jestMatcherUtils","require","_textContent","_matches","_utils","toHaveTextContent","element","expectedText","options","checkHostElement","text","getTextContent","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-text-content.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { getTextContent } from '../helpers/text-content';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveTextContent(\n this: jest.MatcherContext,\n element: HostElement,\n expectedText: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveTextContent, this);\n\n const text = getTextContent(element);\n\n return {\n pass: matches(expectedText, text, options?.normalizer, options?.exact),\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveTextContent`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have text content`,\n expectedText,\n 'Received',\n text,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,iBAAiBA,CAE/BC,OAAoB,EACpBC,YAAuB,EACvBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,iBAAiB,EAAE,IAAI,CAAC;EAElD,MAAMK,IAAI,GAAG,IAAAC,2BAAc,EAACL,OAAO,CAAC;EAEpC,OAAO;IACLM,IAAI,EAAE,IAAAC,gBAAO,EAACN,YAAY,EAAEG,IAAI,EAAEF,OAAO,EAAEM,UAAU,EAAEN,OAAO,EAAEO,KAAK,CAAC;IACtEC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,oBAAoB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC3E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,oBAAoB,EACpEZ,YAAY,EACZ,UAAU,EACVG,IACF,CAAC,CACF,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { StyleProp } from 'react-native';
2
- import type { ReactTestInstance } from 'react-test-renderer';
2
+ import { HostElement } from 'universal-test-renderer';
3
3
  import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
4
4
  import { TextMatch, TextMatchOptions } from '../matches';
5
5
  import { Style } from './to-have-style';
@@ -176,7 +176,7 @@ export interface JestNativeMatchers<R> {
176
176
  *
177
177
  * expect(getByTestId('outer')).toContainElement(getByTestId('inner'));
178
178
  */
179
- toContainElement(element: ReactTestInstance | null): R;
179
+ toContainElement(element: HostElement | null): R;
180
180
  /**
181
181
  * Assert whether a host element has a given accessbility value.
182
182
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/matchers/types.ts"],"sourcesContent":["import type { StyleProp } from 'react-native';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { Style } from './to-have-style';\n\nexport interface JestNativeMatchers<R> {\n /**\n * Assert whether a host element is present in the element tree (screen) or not.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeonthescreen)\n *\n * @example\n * <Text>Hello</Text>\n *\n * expect(getByText('Hello')).toBeOnTheScreen()\n * expect(queryByText('Other')).not.toBeOnTheScreen()\n */\n toBeOnTheScreen(): R;\n\n /**\n * Assert whether a host element is checked based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobechecked)\n *\n * @see {@link toBePartiallyChecked} for a related matcher.\n *\n * @example\n * <View accessible role=\"checkbox\" aria-checked aria-label=\"Enable\" />\n *\n * expect(getByRole('checkbox', { name: \"Enable\" })).toBeChecked()\n */\n toBeChecked(): R;\n\n /**\n * Assert whether a host element is collapsed based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeexpanded)\n *\n * @see {@link toBeExpanded} for an inverse matcher.\n *\n * @example\n * <View testID=\"details\" aria-expanded={false} />\n *\n * expect(getByTestId('details').toBeCollapsed()\n */\n toBeCollapsed(): R;\n\n /**\n * Assert whether a host element is disabled based on accessibility props.\n *\n * This matcher will check ancestor elements for their disabled state as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeenabled)\n *\n * @see {@link toBeEnabled} for an inverse matcher.\n *\n * @example\n * <View role=\"button\" aria-disabled />\n *\n * expect(getByRole('button').toBeDisabled()\n *\n */\n toBeDisabled(): R;\n\n /**\n * Assert whether a host element is busy based on accessibility props.\n *\n * This matcher will check ancestor elements for their disabled state as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobebusy)\n *\n * @example\n * <View testID=\"loader\" aria-busy />\n *\n * expect(getByTestId('loader')).toBeBusy()\n */\n toBeBusy(): R;\n\n /**\n * Assert whether a host element has no host children or text content.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeemptyelement)\n *\n * @example\n * <View testID=\"not-empty\">\n * <View testID=\"empty\" />\n * </View>\n *\n * expect(getByTestId('empty')).toBeEmptyElement()\n * expect(getByTestId('not-mepty')).not.toBeEmptyElement()\n */\n toBeEmptyElement(): R;\n\n /**\n * Assert whether a host element is enabled based on accessibility props.\n *\n * This matcher will check ancestor elements for their disabled state as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeenabled)\n *\n * @see {@link toBeDisabled} for inverse matcher.\n *\n * @example\n * <View role=\"button\" aria-disabled={false} />\n *\n * expect(getByRole('button').toBeEnabled()\n */\n toBeEnabled(): R;\n\n /**\n * Assert whether a host element is expanded based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeexpanded)\n *\n * @see {@link toBeCollapsed} for inverse matcher.\n *\n * @example\n * <View testID=\"details\" aria-expanded />\n *\n * expect(getByTestId('details').toBeExpanded()\n */\n toBeExpanded(): R;\n\n /**\n * Assert whether a host element is partially checked based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobechecked)\n *\n * @see {@link toBeChecked} for related matcher.\n *\n * @example\n * <View accessible role=\"checkbox\" aria-checked=\"mixed\" aria-label=\"Enable\" />\n *\n * expect(getByRole('checkbox', { name: \"Enable\" })).toBePartiallyChecked()\n */\n toBePartiallyChecked(): R;\n\n /**\n * Assert whether a host element is selected based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeselected)\n *\n * @example\n * <View testID=\"view\" aria-selected />\n *\n * expect(getByTestId('view')).toBeSelected()\n */\n toBeSelected(): R;\n\n /**\n * Assert whether a host element is visible based on style and accessibility props.\n *\n * This matcher will check ancestor elements for their visibility as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobevisible)\n *\n * @example\n * <View testID=\"visible\" />\n * <View testID=\"not-visible\" style={{ display: 'none' }} />\n *\n * expect(getByTestId('visible')).toBeVisible()\n * expect(getByTestId('not-visible')).not.toBeVisible()\n */\n toBeVisible(): R;\n\n /**\n * Assert whether a host element contains another host element.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tocontainelement)\n *\n * @example\n * <View testID=\"outer\">\n * <View testID=\"inner\" />\n * </View>\n *\n * expect(getByTestId('outer')).toContainElement(getByTestId('inner'));\n */\n toContainElement(element: ReactTestInstance | null): R;\n\n /**\n * Assert whether a host element has a given accessbility value.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohaveaccessibilityvalue)\n *\n *\n * @example\n * <View testID=\"view\" aria-valuetext=\"33%\" />\n *\n * expect(getByTestId('view')).toHaveAccessibilityValue({ text: '33%' });\n */\n toHaveAccessibilityValue(expectedValue: AccessibilityValueMatcher): R;\n\n /**\n * Assert whether a host element has a given accessibile name based on the accessibility label or text content.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohaveaccessiblename)\n *\n * @example\n * <View testID=\"view\" aria-label=\"Hello\" />\n *\n * expect(getByTestId('view')).toHaveAccessibleName('Hello');\n */\n toHaveAccessibleName(expectedName?: TextMatch, options?: TextMatchOptions): R;\n\n /**\n * Assert whether a host `TextInput` element has a given display value based on `value` prop, unmanaged native state, and `defaultValue` prop.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohavedisplayvalue)\n *\n * @example\n * <TextInput testID=\"input\" value=\"Hello\" />\n *\n * expect(getByTestId('input')).toHaveDisplayValue('Hello');\n */\n toHaveDisplayValue(expectedValue: TextMatch, options?: TextMatchOptions): R;\n\n /**\n * Assert whether a host element has a given prop.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohaveprop)\n *\n * @example\n * <Text testID=\"text\" numberOfLines={1]} />\n *\n * expect(getByTestId('text')).toHaveProp('numberOfLines');\n * expect(getByTestId('text')).toHaveProp('numberOfLines', 1);\n */\n toHaveProp(name: string, expectedValue?: unknown): R;\n\n /**\n * Assert whether a host element has a given style.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohavestyle)\n *\n * @example\n * <View testID=\"view\" style={{ width: '100%' }} />\n *\n * expect(getByTestId('view')).toHaveStyle({ width: '100%' });\n * expect(getByTestId('view')).not.toHaveStyle({ width: '50%' });\n */\n toHaveStyle(style: StyleProp<Style>): R;\n\n /**\n * Assert whether a host element has a given text content.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohavetextcontent)\n *\n * @example\n * <View testID=\"view\">\n * <Text>Hello World</Text>\n * </View>\n *\n * expect(getByTestId('view')).toHaveTextContent('Hello World');\n * expect(getByTestId('view')).toHaveTextContent('Hello', { exact: false }});\n * expect(getByTestId('view')).toHaveTextContent(/hello/i);\n * expect(getByTestId('view')).not.toHaveTextContent('Hello');\n */\n toHaveTextContent(expectedText: TextMatch, options?: TextMatchOptions): R;\n}\n\n// Implicit Jest global `expect`.\ndeclare global {\n namespace jest {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface Matchers<R, T = {}> extends JestNativeMatchers<R> {}\n }\n}\n\n// Explicit `@jest/globals` `expect` matchers.\n// @ts-ignore\ndeclare module '@jest/expect' {\n interface Matchers<R extends void | Promise<void>> extends JestNativeMatchers<R> {}\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/matchers/types.ts"],"sourcesContent":["import type { StyleProp } from 'react-native';\nimport { HostElement } from 'universal-test-renderer';\nimport { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { Style } from './to-have-style';\n\nexport interface JestNativeMatchers<R> {\n /**\n * Assert whether a host element is present in the element tree (screen) or not.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeonthescreen)\n *\n * @example\n * <Text>Hello</Text>\n *\n * expect(getByText('Hello')).toBeOnTheScreen()\n * expect(queryByText('Other')).not.toBeOnTheScreen()\n */\n toBeOnTheScreen(): R;\n\n /**\n * Assert whether a host element is checked based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobechecked)\n *\n * @see {@link toBePartiallyChecked} for a related matcher.\n *\n * @example\n * <View accessible role=\"checkbox\" aria-checked aria-label=\"Enable\" />\n *\n * expect(getByRole('checkbox', { name: \"Enable\" })).toBeChecked()\n */\n toBeChecked(): R;\n\n /**\n * Assert whether a host element is collapsed based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeexpanded)\n *\n * @see {@link toBeExpanded} for an inverse matcher.\n *\n * @example\n * <View testID=\"details\" aria-expanded={false} />\n *\n * expect(getByTestId('details').toBeCollapsed()\n */\n toBeCollapsed(): R;\n\n /**\n * Assert whether a host element is disabled based on accessibility props.\n *\n * This matcher will check ancestor elements for their disabled state as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeenabled)\n *\n * @see {@link toBeEnabled} for an inverse matcher.\n *\n * @example\n * <View role=\"button\" aria-disabled />\n *\n * expect(getByRole('button').toBeDisabled()\n *\n */\n toBeDisabled(): R;\n\n /**\n * Assert whether a host element is busy based on accessibility props.\n *\n * This matcher will check ancestor elements for their disabled state as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobebusy)\n *\n * @example\n * <View testID=\"loader\" aria-busy />\n *\n * expect(getByTestId('loader')).toBeBusy()\n */\n toBeBusy(): R;\n\n /**\n * Assert whether a host element has no host children or text content.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeemptyelement)\n *\n * @example\n * <View testID=\"not-empty\">\n * <View testID=\"empty\" />\n * </View>\n *\n * expect(getByTestId('empty')).toBeEmptyElement()\n * expect(getByTestId('not-mepty')).not.toBeEmptyElement()\n */\n toBeEmptyElement(): R;\n\n /**\n * Assert whether a host element is enabled based on accessibility props.\n *\n * This matcher will check ancestor elements for their disabled state as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeenabled)\n *\n * @see {@link toBeDisabled} for inverse matcher.\n *\n * @example\n * <View role=\"button\" aria-disabled={false} />\n *\n * expect(getByRole('button').toBeEnabled()\n */\n toBeEnabled(): R;\n\n /**\n * Assert whether a host element is expanded based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeexpanded)\n *\n * @see {@link toBeCollapsed} for inverse matcher.\n *\n * @example\n * <View testID=\"details\" aria-expanded />\n *\n * expect(getByTestId('details').toBeExpanded()\n */\n toBeExpanded(): R;\n\n /**\n * Assert whether a host element is partially checked based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobechecked)\n *\n * @see {@link toBeChecked} for related matcher.\n *\n * @example\n * <View accessible role=\"checkbox\" aria-checked=\"mixed\" aria-label=\"Enable\" />\n *\n * expect(getByRole('checkbox', { name: \"Enable\" })).toBePartiallyChecked()\n */\n toBePartiallyChecked(): R;\n\n /**\n * Assert whether a host element is selected based on accessibility props.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobeselected)\n *\n * @example\n * <View testID=\"view\" aria-selected />\n *\n * expect(getByTestId('view')).toBeSelected()\n */\n toBeSelected(): R;\n\n /**\n * Assert whether a host element is visible based on style and accessibility props.\n *\n * This matcher will check ancestor elements for their visibility as well.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tobevisible)\n *\n * @example\n * <View testID=\"visible\" />\n * <View testID=\"not-visible\" style={{ display: 'none' }} />\n *\n * expect(getByTestId('visible')).toBeVisible()\n * expect(getByTestId('not-visible')).not.toBeVisible()\n */\n toBeVisible(): R;\n\n /**\n * Assert whether a host element contains another host element.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tocontainelement)\n *\n * @example\n * <View testID=\"outer\">\n * <View testID=\"inner\" />\n * </View>\n *\n * expect(getByTestId('outer')).toContainElement(getByTestId('inner'));\n */\n toContainElement(element: HostElement | null): R;\n\n /**\n * Assert whether a host element has a given accessbility value.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohaveaccessibilityvalue)\n *\n *\n * @example\n * <View testID=\"view\" aria-valuetext=\"33%\" />\n *\n * expect(getByTestId('view')).toHaveAccessibilityValue({ text: '33%' });\n */\n toHaveAccessibilityValue(expectedValue: AccessibilityValueMatcher): R;\n\n /**\n * Assert whether a host element has a given accessibile name based on the accessibility label or text content.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohaveaccessiblename)\n *\n * @example\n * <View testID=\"view\" aria-label=\"Hello\" />\n *\n * expect(getByTestId('view')).toHaveAccessibleName('Hello');\n */\n toHaveAccessibleName(expectedName?: TextMatch, options?: TextMatchOptions): R;\n\n /**\n * Assert whether a host `TextInput` element has a given display value based on `value` prop, unmanaged native state, and `defaultValue` prop.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohavedisplayvalue)\n *\n * @example\n * <TextInput testID=\"input\" value=\"Hello\" />\n *\n * expect(getByTestId('input')).toHaveDisplayValue('Hello');\n */\n toHaveDisplayValue(expectedValue: TextMatch, options?: TextMatchOptions): R;\n\n /**\n * Assert whether a host element has a given prop.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohaveprop)\n *\n * @example\n * <Text testID=\"text\" numberOfLines={1]} />\n *\n * expect(getByTestId('text')).toHaveProp('numberOfLines');\n * expect(getByTestId('text')).toHaveProp('numberOfLines', 1);\n */\n toHaveProp(name: string, expectedValue?: unknown): R;\n\n /**\n * Assert whether a host element has a given style.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohavestyle)\n *\n * @example\n * <View testID=\"view\" style={{ width: '100%' }} />\n *\n * expect(getByTestId('view')).toHaveStyle({ width: '100%' });\n * expect(getByTestId('view')).not.toHaveStyle({ width: '50%' });\n */\n toHaveStyle(style: StyleProp<Style>): R;\n\n /**\n * Assert whether a host element has a given text content.\n *\n * @see\n * [Jest Matchers docs](https://callstack.github.io/react-native-testing-library/docs/jest-matchers#tohavetextcontent)\n *\n * @example\n * <View testID=\"view\">\n * <Text>Hello World</Text>\n * </View>\n *\n * expect(getByTestId('view')).toHaveTextContent('Hello World');\n * expect(getByTestId('view')).toHaveTextContent('Hello', { exact: false }});\n * expect(getByTestId('view')).toHaveTextContent(/hello/i);\n * expect(getByTestId('view')).not.toHaveTextContent('Hello');\n */\n toHaveTextContent(expectedText: TextMatch, options?: TextMatchOptions): R;\n}\n\n// Implicit Jest global `expect`.\ndeclare global {\n namespace jest {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n interface Matchers<R, T = {}> extends JestNativeMatchers<R> {}\n }\n}\n\n// Explicit `@jest/globals` `expect` matchers.\n// @ts-ignore\ndeclare module '@jest/expect' {\n interface Matchers<R extends void | Promise<void>> extends JestNativeMatchers<R> {}\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,17 +1,17 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement, HostNode } from 'universal-test-renderer';
2
2
  /**
3
3
  * Throws HostElementTypeError if passed element is not a host element.
4
4
  *
5
- * @param element ReactTestInstance to check.
5
+ * @param element HostElement to check.
6
6
  * @param matcherFn Matcher function calling the check used for formatting error.
7
7
  * @param context Jest matcher context used for formatting error.
8
8
  */
9
- export declare function checkHostElement(element: ReactTestInstance | null | undefined, matcherFn: jest.CustomMatcher, context: jest.MatcherContext): asserts element is ReactTestInstance;
9
+ export declare function checkHostElement(element: HostElement | null | undefined, matcherFn: jest.CustomMatcher, context: jest.MatcherContext): asserts element is HostElement;
10
10
  /***
11
11
  * Format given element as a pretty-printed string.
12
12
  *
13
13
  * @param element Element to format.
14
14
  */
15
- export declare function formatElement(element: ReactTestInstance | null): string;
16
- export declare function formatElementArray(elements: ReactTestInstance[]): string;
15
+ export declare function formatElement(element: HostNode | null): string;
16
+ export declare function formatElementArray(elements: HostNode[]): string;
17
17
  export declare function formatMessage(matcher: string, expectedLabel: string, expectedValue: string | RegExp | null | undefined, receivedLabel: string, receivedValue: string | null | undefined): string;