@testing-library/react-native 11.2.0 → 11.4.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 (100) hide show
  1. package/README.md +3 -0
  2. package/build/act.js +9 -15
  3. package/build/act.js.map +1 -1
  4. package/build/cleanup.js +0 -4
  5. package/build/cleanup.js.map +1 -1
  6. package/build/config.d.ts +15 -0
  7. package/build/config.js +27 -0
  8. package/build/config.js.map +1 -0
  9. package/build/fireEvent.js +3 -33
  10. package/build/fireEvent.js.map +1 -1
  11. package/build/flushMicroTasks.js +0 -3
  12. package/build/flushMicroTasks.js.map +1 -1
  13. package/build/helpers/accessiblity.d.ts +3 -0
  14. package/build/helpers/accessiblity.js +14 -20
  15. package/build/helpers/accessiblity.js.map +1 -1
  16. package/build/helpers/component-tree.d.ts +15 -0
  17. package/build/helpers/component-tree.js +49 -15
  18. package/build/helpers/component-tree.js.map +1 -1
  19. package/build/helpers/debugDeep.d.ts +5 -1
  20. package/build/helpers/debugDeep.js +7 -6
  21. package/build/helpers/debugDeep.js.map +1 -1
  22. package/build/helpers/debugShallow.js +0 -5
  23. package/build/helpers/debugShallow.js.map +1 -1
  24. package/build/helpers/errors.js +4 -25
  25. package/build/helpers/errors.js.map +1 -1
  26. package/build/helpers/filterNodeByType.js +0 -2
  27. package/build/helpers/filterNodeByType.js.map +1 -1
  28. package/build/helpers/format.d.ts +5 -1
  29. package/build/helpers/format.js +17 -7
  30. package/build/helpers/format.js.map +1 -1
  31. package/build/helpers/matchers/accessibilityState.d.ts +3 -0
  32. package/build/helpers/matchers/accessibilityState.js +28 -0
  33. package/build/helpers/matchers/accessibilityState.js.map +1 -0
  34. package/build/helpers/matchers/matchArrayProp.js +0 -3
  35. package/build/helpers/matchers/matchArrayProp.js.map +1 -1
  36. package/build/helpers/matchers/matchObjectProp.js +0 -2
  37. package/build/helpers/matchers/matchObjectProp.js.map +1 -1
  38. package/build/helpers/matchers/matchStringProp.js +0 -3
  39. package/build/helpers/matchers/matchStringProp.js.map +1 -1
  40. package/build/helpers/stringValidation.js +0 -7
  41. package/build/helpers/stringValidation.js.map +1 -1
  42. package/build/helpers/timers.js +11 -22
  43. package/build/helpers/timers.js.map +1 -1
  44. package/build/index.flow.js +74 -21
  45. package/build/index.js +0 -6
  46. package/build/index.js.map +1 -1
  47. package/build/matches.js +2 -4
  48. package/build/matches.js.map +1 -1
  49. package/build/pure.d.ts +2 -0
  50. package/build/pure.js +13 -12
  51. package/build/pure.js.map +1 -1
  52. package/build/queries/a11yState.d.ts +1 -1
  53. package/build/queries/a11yState.js +15 -13
  54. package/build/queries/a11yState.js.map +1 -1
  55. package/build/queries/a11yValue.js +0 -8
  56. package/build/queries/a11yValue.js.map +1 -1
  57. package/build/queries/displayValue.js +7 -26
  58. package/build/queries/displayValue.js.map +1 -1
  59. package/build/queries/hintText.d.ts +19 -18
  60. package/build/queries/hintText.js +10 -11
  61. package/build/queries/hintText.js.map +1 -1
  62. package/build/queries/labelText.d.ts +7 -6
  63. package/build/queries/labelText.js +10 -11
  64. package/build/queries/labelText.js.map +1 -1
  65. package/build/queries/makeQueries.d.ts +3 -3
  66. package/build/queries/makeQueries.js +40 -24
  67. package/build/queries/makeQueries.js.map +1 -1
  68. package/build/queries/placeholderText.js +6 -25
  69. package/build/queries/placeholderText.js.map +1 -1
  70. package/build/queries/role.d.ts +3 -2
  71. package/build/queries/role.js +23 -13
  72. package/build/queries/role.js.map +1 -1
  73. package/build/queries/testId.js +0 -9
  74. package/build/queries/testId.js.map +1 -1
  75. package/build/queries/text.js +21 -45
  76. package/build/queries/text.js.map +1 -1
  77. package/build/queries/unsafeProps.js +2 -11
  78. package/build/queries/unsafeProps.js.map +1 -1
  79. package/build/queries/unsafeType.js +2 -9
  80. package/build/queries/unsafeType.js.map +1 -1
  81. package/build/react-versions.js +0 -4
  82. package/build/react-versions.js.map +1 -1
  83. package/build/render.d.ts +32 -31
  84. package/build/render.js +21 -31
  85. package/build/render.js.map +1 -1
  86. package/build/renderHook.js +2 -12
  87. package/build/renderHook.js.map +1 -1
  88. package/build/screen.js +0 -6
  89. package/build/screen.js.map +1 -1
  90. package/build/shallow.js +0 -6
  91. package/build/shallow.js.map +1 -1
  92. package/build/waitFor.js +31 -53
  93. package/build/waitFor.js.map +1 -1
  94. package/build/waitForElementToBeRemoved.js +2 -11
  95. package/build/waitForElementToBeRemoved.js.map +1 -1
  96. package/build/within.d.ts +30 -30
  97. package/build/within.js +2 -14
  98. package/build/within.js.map +1 -1
  99. package/package.json +18 -17
  100. package/typings/index.flow.js +74 -21
@@ -4,40 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByDisplayValueQueries = void 0;
7
-
8
- var _errors = require("../helpers/errors");
9
-
7
+ var _reactNative = require("react-native");
10
8
  var _filterNodeByType = require("../helpers/filterNodeByType");
11
-
12
9
  var _matches = require("../matches");
13
-
14
10
  var _makeQueries = require("./makeQueries");
15
-
16
11
  const getTextInputNodeByDisplayValue = (node, value, options = {}) => {
17
- try {
18
- const {
19
- TextInput
20
- } = require('react-native');
21
-
22
- const {
23
- exact,
24
- normalizer
25
- } = options;
26
- const nodeValue = node.props.value !== undefined ? node.props.value : node.props.defaultValue;
27
- return (0, _filterNodeByType.filterNodeByType)(node, TextInput) && (0, _matches.matches)(value, nodeValue, normalizer, exact);
28
- } catch (error) {
29
- throw (0, _errors.createLibraryNotSupportedError)(error);
30
- }
12
+ const {
13
+ exact,
14
+ normalizer
15
+ } = options;
16
+ const nodeValue = node.props.value !== undefined ? node.props.value : node.props.defaultValue;
17
+ return (0, _filterNodeByType.filterNodeByType)(node, _reactNative.TextInput) && (0, _matches.matches)(value, nodeValue, normalizer, exact);
31
18
  };
32
-
33
19
  const queryAllByDisplayValue = instance => function queryAllByDisplayValueFn(displayValue, queryOptions) {
34
20
  return instance.findAll(node => getTextInputNodeByDisplayValue(node, displayValue, queryOptions));
35
21
  };
36
-
37
22
  const getMultipleError = displayValue => `Found multiple elements with display value: ${String(displayValue)} `;
38
-
39
23
  const getMissingError = displayValue => `Unable to find an element with displayValue: ${String(displayValue)}`;
40
-
41
24
  const {
42
25
  getBy,
43
26
  getAllBy,
@@ -46,7 +29,6 @@ const {
46
29
  findBy,
47
30
  findAllBy
48
31
  } = (0, _makeQueries.makeQueries)(queryAllByDisplayValue, getMissingError, getMultipleError);
49
-
50
32
  const bindByDisplayValueQueries = instance => ({
51
33
  getByDisplayValue: getBy(instance),
52
34
  getAllByDisplayValue: getAllBy(instance),
@@ -55,6 +37,5 @@ const bindByDisplayValueQueries = instance => ({
55
37
  findByDisplayValue: findBy(instance),
56
38
  findAllByDisplayValue: findAllBy(instance)
57
39
  });
58
-
59
40
  exports.bindByDisplayValueQueries = bindByDisplayValueQueries;
60
41
  //# sourceMappingURL=displayValue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"displayValue.js","names":["getTextInputNodeByDisplayValue","node","value","options","TextInput","require","exact","normalizer","nodeValue","props","undefined","defaultValue","filterNodeByType","matches","error","createLibraryNotSupportedError","queryAllByDisplayValue","instance","queryAllByDisplayValueFn","displayValue","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByDisplayValueQueries","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","findByDisplayValue","findAllByDisplayValue"],"sources":["../../src/queries/displayValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { createLibraryNotSupportedError } from '../helpers/errors';\nimport { filterNodeByType } from '../helpers/filterNodeByType';\nimport { matches, TextMatch } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { TextMatchOptions } from './text';\n\nconst getTextInputNodeByDisplayValue = (\n node: ReactTestInstance,\n value: TextMatch,\n options: TextMatchOptions = {}\n) => {\n try {\n const { TextInput } = require('react-native');\n const { exact, normalizer } = options;\n const nodeValue =\n node.props.value !== undefined\n ? node.props.value\n : node.props.defaultValue;\n return (\n filterNodeByType(node, TextInput) &&\n matches(value, nodeValue, normalizer, exact)\n );\n } catch (error) {\n throw createLibraryNotSupportedError(error);\n }\n};\n\nconst queryAllByDisplayValue = (\n instance: ReactTestInstance\n): ((\n displayValue: TextMatch,\n queryOptions?: TextMatchOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByDisplayValueFn(displayValue, queryOptions) {\n return instance.findAll((node) =>\n getTextInputNodeByDisplayValue(node, displayValue, queryOptions)\n );\n };\n\nconst getMultipleError = (displayValue: TextMatch) =>\n `Found multiple elements with display value: ${String(displayValue)} `;\nconst getMissingError = (displayValue: TextMatch) =>\n `Unable to find an element with displayValue: ${String(displayValue)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByDisplayValue,\n getMissingError,\n getMultipleError\n);\n\nexport type ByDisplayValueQueries = {\n getByDisplayValue: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByDisplayValue: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByDisplayValue: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByDisplayValue: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByDisplayValue: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByDisplayValue: FindAllByQuery<TextMatch, TextMatchOptions>;\n};\n\nexport const bindByDisplayValueQueries = (\n instance: ReactTestInstance\n): ByDisplayValueQueries => ({\n getByDisplayValue: getBy(instance),\n getAllByDisplayValue: getAllBy(instance),\n queryByDisplayValue: queryBy(instance),\n queryAllByDisplayValue: queryAllBy(instance),\n findByDisplayValue: findBy(instance),\n findAllByDisplayValue: findAllBy(instance),\n});\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AACA;;AAWA,MAAMA,8BAA8B,GAAG,CACrCC,IADqC,EAErCC,KAFqC,EAGrCC,OAAyB,GAAG,EAHS,KAIlC;EACH,IAAI;IACF,MAAM;MAAEC;IAAF,IAAgBC,OAAO,CAAC,cAAD,CAA7B;;IACA,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAwBJ,OAA9B;IACA,MAAMK,SAAS,GACbP,IAAI,CAACQ,KAAL,CAAWP,KAAX,KAAqBQ,SAArB,GACIT,IAAI,CAACQ,KAAL,CAAWP,KADf,GAEID,IAAI,CAACQ,KAAL,CAAWE,YAHjB;IAIA,OACE,IAAAC,kCAAA,EAAiBX,IAAjB,EAAuBG,SAAvB,KACA,IAAAS,gBAAA,EAAQX,KAAR,EAAeM,SAAf,EAA0BD,UAA1B,EAAsCD,KAAtC,CAFF;EAID,CAXD,CAWE,OAAOQ,KAAP,EAAc;IACd,MAAM,IAAAC,sCAAA,EAA+BD,KAA/B,CAAN;EACD;AACF,CAnBD;;AAqBA,MAAME,sBAAsB,GAC1BC,QAD6B,IAM7B,SAASC,wBAAT,CAAkCC,YAAlC,EAAgDC,YAAhD,EAA8D;EAC5D,OAAOH,QAAQ,CAACI,OAAT,CAAkBpB,IAAD,IACtBD,8BAA8B,CAACC,IAAD,EAAOkB,YAAP,EAAqBC,YAArB,CADzB,CAAP;AAGD,CAVH;;AAYA,MAAME,gBAAgB,GAAIH,YAAD,IACtB,+CAA8CI,MAAM,CAACJ,YAAD,CAAe,GADtE;;AAEA,MAAMK,eAAe,GAAIL,YAAD,IACrB,gDAA+CI,MAAM,CAACJ,YAAD,CAAe,EADvE;;AAGA,MAAM;EAAEM,KAAF;EAASC,QAAT;EAAmBC,OAAnB;EAA4BC,UAA5B;EAAwCC,MAAxC;EAAgDC;AAAhD,IAA8D,IAAAC,wBAAA,EAClEf,sBADkE,EAElEQ,eAFkE,EAGlEF,gBAHkE,CAApE;;AAeO,MAAMU,yBAAyB,GACpCf,QADuC,KAEZ;EAC3BgB,iBAAiB,EAAER,KAAK,CAACR,QAAD,CADG;EAE3BiB,oBAAoB,EAAER,QAAQ,CAACT,QAAD,CAFH;EAG3BkB,mBAAmB,EAAER,OAAO,CAACV,QAAD,CAHD;EAI3BD,sBAAsB,EAAEY,UAAU,CAACX,QAAD,CAJP;EAK3BmB,kBAAkB,EAAEP,MAAM,CAACZ,QAAD,CALC;EAM3BoB,qBAAqB,EAAEP,SAAS,CAACb,QAAD;AANL,CAFY,CAAlC"}
1
+ {"version":3,"file":"displayValue.js","names":["getTextInputNodeByDisplayValue","node","value","options","exact","normalizer","nodeValue","props","undefined","defaultValue","filterNodeByType","TextInput","matches","queryAllByDisplayValue","instance","queryAllByDisplayValueFn","displayValue","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByDisplayValueQueries","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","findByDisplayValue","findAllByDisplayValue"],"sources":["../../src/queries/displayValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { TextInput } from 'react-native';\nimport { filterNodeByType } from '../helpers/filterNodeByType';\nimport { matches, TextMatch } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { TextMatchOptions } from './text';\n\nconst getTextInputNodeByDisplayValue = (\n node: ReactTestInstance,\n value: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n const nodeValue =\n node.props.value !== undefined ? node.props.value : node.props.defaultValue;\n return (\n filterNodeByType(node, TextInput) &&\n matches(value, nodeValue, normalizer, exact)\n );\n};\n\nconst queryAllByDisplayValue = (\n instance: ReactTestInstance\n): ((\n displayValue: TextMatch,\n queryOptions?: TextMatchOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByDisplayValueFn(displayValue, queryOptions) {\n return instance.findAll((node) =>\n getTextInputNodeByDisplayValue(node, displayValue, queryOptions)\n );\n };\n\nconst getMultipleError = (displayValue: TextMatch) =>\n `Found multiple elements with display value: ${String(displayValue)} `;\nconst getMissingError = (displayValue: TextMatch) =>\n `Unable to find an element with displayValue: ${String(displayValue)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByDisplayValue,\n getMissingError,\n getMultipleError\n);\n\nexport type ByDisplayValueQueries = {\n getByDisplayValue: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByDisplayValue: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByDisplayValue: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByDisplayValue: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByDisplayValue: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByDisplayValue: FindAllByQuery<TextMatch, TextMatchOptions>;\n};\n\nexport const bindByDisplayValueQueries = (\n instance: ReactTestInstance\n): ByDisplayValueQueries => ({\n getByDisplayValue: getBy(instance),\n getAllByDisplayValue: getAllBy(instance),\n queryByDisplayValue: queryBy(instance),\n queryAllByDisplayValue: queryAllBy(instance),\n findByDisplayValue: findBy(instance),\n findAllByDisplayValue: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA;AACA;AACA;AACA;AAWA,MAAMA,8BAA8B,GAAG,CACrCC,IAAuB,EACvBC,KAAgB,EAChBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,MAAMG,SAAS,GACbL,IAAI,CAACM,KAAK,CAACL,KAAK,KAAKM,SAAS,GAAGP,IAAI,CAACM,KAAK,CAACL,KAAK,GAAGD,IAAI,CAACM,KAAK,CAACE,YAAY;EAC7E,OACE,IAAAC,kCAAgB,EAACT,IAAI,EAAEU,sBAAS,CAAC,IACjC,IAAAC,gBAAO,EAACV,KAAK,EAAEI,SAAS,EAAED,UAAU,EAAED,KAAK,CAAC;AAEhD,CAAC;AAED,MAAMS,sBAAsB,GAC1BC,QAA2B,IAK3B,SAASC,wBAAwB,CAACC,YAAY,EAAEC,YAAY,EAAE;EAC5D,OAAOH,QAAQ,CAACI,OAAO,CAAEjB,IAAI,IAC3BD,8BAA8B,CAACC,IAAI,EAAEe,YAAY,EAAEC,YAAY,CAAC,CACjE;AACH,CAAC;AAEH,MAAME,gBAAgB,GAAIH,YAAuB,IAC9C,+CAA8CI,MAAM,CAACJ,YAAY,CAAE,GAAE;AACxE,MAAMK,eAAe,GAAIL,YAAuB,IAC7C,gDAA+CI,MAAM,CAACJ,YAAY,CAAE,EAAC;AAExE,MAAM;EAAEM,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7Ef,sBAAsB,EACtBQ,eAAe,EACfF,gBAAgB,CACjB;AAWM,MAAMU,yBAAyB,GACpCf,QAA2B,KACA;EAC3BgB,iBAAiB,EAAER,KAAK,CAACR,QAAQ,CAAC;EAClCiB,oBAAoB,EAAER,QAAQ,CAACT,QAAQ,CAAC;EACxCkB,mBAAmB,EAAER,OAAO,CAACV,QAAQ,CAAC;EACtCD,sBAAsB,EAAEY,UAAU,CAACX,QAAQ,CAAC;EAC5CmB,kBAAkB,EAAEP,MAAM,CAACZ,QAAQ,CAAC;EACpCoB,qBAAqB,EAAEP,SAAS,CAACb,QAAQ;AAC3C,CAAC,CAAC;AAAC"}
@@ -1,24 +1,25 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch } from '../matches';
3
3
  import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
4
+ import { TextMatchOptions } from './text';
4
5
  export declare type ByHintTextQueries = {
5
- getByHintText: GetByQuery<TextMatch>;
6
- getAllByHintText: GetAllByQuery<TextMatch>;
7
- queryByHintText: QueryByQuery<TextMatch>;
8
- queryAllByHintText: QueryAllByQuery<TextMatch>;
9
- findByHintText: FindByQuery<TextMatch>;
10
- findAllByHintText: FindAllByQuery<TextMatch>;
11
- getByA11yHint: GetByQuery<TextMatch>;
12
- getAllByA11yHint: GetAllByQuery<TextMatch>;
13
- queryByA11yHint: QueryByQuery<TextMatch>;
14
- queryAllByA11yHint: QueryAllByQuery<TextMatch>;
15
- findByA11yHint: FindByQuery<TextMatch>;
16
- findAllByA11yHint: FindAllByQuery<TextMatch>;
17
- getByAccessibilityHint: GetByQuery<TextMatch>;
18
- getAllByAccessibilityHint: GetAllByQuery<TextMatch>;
19
- queryByAccessibilityHint: QueryByQuery<TextMatch>;
20
- queryAllByAccessibilityHint: QueryAllByQuery<TextMatch>;
21
- findByAccessibilityHint: FindByQuery<TextMatch>;
22
- findAllByAccessibilityHint: FindAllByQuery<TextMatch>;
6
+ getByHintText: GetByQuery<TextMatch, TextMatchOptions>;
7
+ getAllByHintText: GetAllByQuery<TextMatch, TextMatchOptions>;
8
+ queryByHintText: QueryByQuery<TextMatch, TextMatchOptions>;
9
+ queryAllByHintText: QueryAllByQuery<TextMatch, TextMatchOptions>;
10
+ findByHintText: FindByQuery<TextMatch, TextMatchOptions>;
11
+ findAllByHintText: FindAllByQuery<TextMatch, TextMatchOptions>;
12
+ getByA11yHint: GetByQuery<TextMatch, TextMatchOptions>;
13
+ getAllByA11yHint: GetAllByQuery<TextMatch, TextMatchOptions>;
14
+ queryByA11yHint: QueryByQuery<TextMatch, TextMatchOptions>;
15
+ queryAllByA11yHint: QueryAllByQuery<TextMatch, TextMatchOptions>;
16
+ findByA11yHint: FindByQuery<TextMatch, TextMatchOptions>;
17
+ findAllByA11yHint: FindAllByQuery<TextMatch, TextMatchOptions>;
18
+ getByAccessibilityHint: GetByQuery<TextMatch, TextMatchOptions>;
19
+ getAllByAccessibilityHint: GetAllByQuery<TextMatch, TextMatchOptions>;
20
+ queryByAccessibilityHint: QueryByQuery<TextMatch, TextMatchOptions>;
21
+ queryAllByAccessibilityHint: QueryAllByQuery<TextMatch, TextMatchOptions>;
22
+ findByAccessibilityHint: FindByQuery<TextMatch, TextMatchOptions>;
23
+ findAllByAccessibilityHint: FindAllByQuery<TextMatch, TextMatchOptions>;
23
24
  };
24
25
  export declare const bindByHintTextQueries: (instance: ReactTestInstance) => ByHintTextQueries;
@@ -4,19 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByHintTextQueries = void 0;
7
-
8
- var _matchStringProp = require("../helpers/matchers/matchStringProp");
9
-
7
+ var _matches = require("../matches");
10
8
  var _makeQueries = require("./makeQueries");
11
-
12
- const queryAllByHintText = instance => function queryAllByA11yHintFn(hint) {
13
- return instance.findAll(node => typeof node.type === 'string' && (0, _matchStringProp.matchStringProp)(node.props.accessibilityHint, hint));
9
+ const getNodeByHintText = (node, text, options = {}) => {
10
+ const {
11
+ exact,
12
+ normalizer
13
+ } = options;
14
+ return (0, _matches.matches)(text, node.props.accessibilityHint, normalizer, exact);
15
+ };
16
+ const queryAllByHintText = instance => function queryAllByA11yHintFn(hint, queryOptions) {
17
+ return instance.findAll(node => typeof node.type === 'string' && getNodeByHintText(node, hint, queryOptions));
14
18
  };
15
-
16
19
  const getMultipleError = hint => `Found multiple elements with accessibilityHint: ${String(hint)} `;
17
-
18
20
  const getMissingError = hint => `Unable to find an element with accessibilityHint: ${String(hint)}`;
19
-
20
21
  const {
21
22
  getBy,
22
23
  getAllBy,
@@ -25,7 +26,6 @@ const {
25
26
  findBy,
26
27
  findAllBy
27
28
  } = (0, _makeQueries.makeQueries)(queryAllByHintText, getMissingError, getMultipleError);
28
-
29
29
  const bindByHintTextQueries = instance => {
30
30
  const getByHintText = getBy(instance);
31
31
  const getAllByHintText = getAllBy(instance);
@@ -56,6 +56,5 @@ const bindByHintTextQueries = instance => {
56
56
  findAllByAccessibilityHint: findAllByHintText
57
57
  };
58
58
  };
59
-
60
59
  exports.bindByHintTextQueries = bindByHintTextQueries;
61
60
  //# sourceMappingURL=hintText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hintText.js","names":["queryAllByHintText","instance","queryAllByA11yHintFn","hint","findAll","node","type","matchStringProp","props","accessibilityHint","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByHintTextQueries","getByHintText","getAllByHintText","queryByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint"],"sources":["../../src/queries/hintText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { TextMatch } from '../matches';\nimport { matchStringProp } from '../helpers/matchers/matchStringProp';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\n\nconst queryAllByHintText = (\n instance: ReactTestInstance\n): ((hint: TextMatch) => Array<ReactTestInstance>) =>\n function queryAllByA11yHintFn(hint) {\n return instance.findAll(\n (node) =>\n typeof node.type === 'string' &&\n matchStringProp(node.props.accessibilityHint, hint)\n );\n };\n\nconst getMultipleError = (hint: TextMatch) =>\n `Found multiple elements with accessibilityHint: ${String(hint)} `;\nconst getMissingError = (hint: TextMatch) =>\n `Unable to find an element with accessibilityHint: ${String(hint)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByHintText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByHintTextQueries = {\n getByHintText: GetByQuery<TextMatch>;\n getAllByHintText: GetAllByQuery<TextMatch>;\n queryByHintText: QueryByQuery<TextMatch>;\n queryAllByHintText: QueryAllByQuery<TextMatch>;\n findByHintText: FindByQuery<TextMatch>;\n findAllByHintText: FindAllByQuery<TextMatch>;\n\n // a11yHint aliases\n getByA11yHint: GetByQuery<TextMatch>;\n getAllByA11yHint: GetAllByQuery<TextMatch>;\n queryByA11yHint: QueryByQuery<TextMatch>;\n queryAllByA11yHint: QueryAllByQuery<TextMatch>;\n findByA11yHint: FindByQuery<TextMatch>;\n findAllByA11yHint: FindAllByQuery<TextMatch>;\n\n // accessibilityHint aliases\n getByAccessibilityHint: GetByQuery<TextMatch>;\n getAllByAccessibilityHint: GetAllByQuery<TextMatch>;\n queryByAccessibilityHint: QueryByQuery<TextMatch>;\n queryAllByAccessibilityHint: QueryAllByQuery<TextMatch>;\n findByAccessibilityHint: FindByQuery<TextMatch>;\n findAllByAccessibilityHint: FindAllByQuery<TextMatch>;\n};\n\nexport const bindByHintTextQueries = (\n instance: ReactTestInstance\n): ByHintTextQueries => {\n const getByHintText = getBy(instance);\n const getAllByHintText = getAllBy(instance);\n const queryByHintText = queryBy(instance);\n const queryAllByHintText = queryAllBy(instance);\n const findByHintText = findBy(instance);\n const findAllByHintText = findAllBy(instance);\n\n return {\n getByHintText,\n getAllByHintText,\n queryByHintText,\n queryAllByHintText,\n findByHintText,\n findAllByHintText,\n\n // a11yHint aliases\n getByA11yHint: getByHintText,\n getAllByA11yHint: getAllByHintText,\n queryByA11yHint: queryByHintText,\n queryAllByA11yHint: queryAllByHintText,\n findByA11yHint: findByHintText,\n findAllByA11yHint: findAllByHintText,\n\n // accessibilityHint aliases\n getByAccessibilityHint: getByHintText,\n getAllByAccessibilityHint: getAllByHintText,\n queryByAccessibilityHint: queryByHintText,\n queryAllByAccessibilityHint: queryAllByHintText,\n findByAccessibilityHint: findByHintText,\n findAllByAccessibilityHint: findAllByHintText,\n };\n};\n"],"mappings":";;;;;;;AAEA;;AACA;;AAUA,MAAMA,kBAAkB,GACtBC,QADyB,IAGzB,SAASC,oBAAT,CAA8BC,IAA9B,EAAoC;EAClC,OAAOF,QAAQ,CAACG,OAAT,CACJC,IAAD,IACE,OAAOA,IAAI,CAACC,IAAZ,KAAqB,QAArB,IACA,IAAAC,gCAAA,EAAgBF,IAAI,CAACG,KAAL,CAAWC,iBAA3B,EAA8CN,IAA9C,CAHG,CAAP;AAKD,CATH;;AAWA,MAAMO,gBAAgB,GAAIP,IAAD,IACtB,mDAAkDQ,MAAM,CAACR,IAAD,CAAO,GADlE;;AAEA,MAAMS,eAAe,GAAIT,IAAD,IACrB,qDAAoDQ,MAAM,CAACR,IAAD,CAAO,EADpE;;AAGA,MAAM;EAAEU,KAAF;EAASC,QAAT;EAAmBC,OAAnB;EAA4BC,UAA5B;EAAwCC,MAAxC;EAAgDC;AAAhD,IAA8D,IAAAC,wBAAA,EAClEnB,kBADkE,EAElEY,eAFkE,EAGlEF,gBAHkE,CAApE;;AA+BO,MAAMU,qBAAqB,GAChCnB,QADmC,IAEb;EACtB,MAAMoB,aAAa,GAAGR,KAAK,CAACZ,QAAD,CAA3B;EACA,MAAMqB,gBAAgB,GAAGR,QAAQ,CAACb,QAAD,CAAjC;EACA,MAAMsB,eAAe,GAAGR,OAAO,CAACd,QAAD,CAA/B;EACA,MAAMD,kBAAkB,GAAGgB,UAAU,CAACf,QAAD,CAArC;EACA,MAAMuB,cAAc,GAAGP,MAAM,CAAChB,QAAD,CAA7B;EACA,MAAMwB,iBAAiB,GAAGP,SAAS,CAACjB,QAAD,CAAnC;EAEA,OAAO;IACLoB,aADK;IAELC,gBAFK;IAGLC,eAHK;IAILvB,kBAJK;IAKLwB,cALK;IAMLC,iBANK;IAQL;IACAC,aAAa,EAAEL,aATV;IAULM,gBAAgB,EAAEL,gBAVb;IAWLM,eAAe,EAAEL,eAXZ;IAYLM,kBAAkB,EAAE7B,kBAZf;IAaL8B,cAAc,EAAEN,cAbX;IAcLO,iBAAiB,EAAEN,iBAdd;IAgBL;IACAO,sBAAsB,EAAEX,aAjBnB;IAkBLY,yBAAyB,EAAEX,gBAlBtB;IAmBLY,wBAAwB,EAAEX,eAnBrB;IAoBLY,2BAA2B,EAAEnC,kBApBxB;IAqBLoC,uBAAuB,EAAEZ,cArBpB;IAsBLa,0BAA0B,EAAEZ;EAtBvB,CAAP;AAwBD,CAlCM"}
1
+ {"version":3,"file":"hintText.js","names":["getNodeByHintText","node","text","options","exact","normalizer","matches","props","accessibilityHint","queryAllByHintText","instance","queryAllByA11yHintFn","hint","queryOptions","findAll","type","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByHintTextQueries","getByHintText","getAllByHintText","queryByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint"],"sources":["../../src/queries/hintText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { TextMatchOptions } from './text';\n\nconst getNodeByHintText = (\n node: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return matches(text, node.props.accessibilityHint, normalizer, exact);\n};\n\nconst queryAllByHintText = (\n instance: ReactTestInstance\n): ((\n hint: TextMatch,\n queryOptions?: TextMatchOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByA11yHintFn(hint, queryOptions) {\n return instance.findAll(\n (node) =>\n typeof node.type === 'string' &&\n getNodeByHintText(node, hint, queryOptions)\n );\n };\n\nconst getMultipleError = (hint: TextMatch) =>\n `Found multiple elements with accessibilityHint: ${String(hint)} `;\nconst getMissingError = (hint: TextMatch) =>\n `Unable to find an element with accessibilityHint: ${String(hint)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByHintText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByHintTextQueries = {\n getByHintText: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByHintText: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByHintText: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByHintText: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByHintText: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByHintText: FindAllByQuery<TextMatch, TextMatchOptions>;\n\n // a11yHint aliases\n getByA11yHint: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByA11yHint: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByA11yHint: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByA11yHint: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByA11yHint: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByA11yHint: FindAllByQuery<TextMatch, TextMatchOptions>;\n\n // accessibilityHint aliases\n getByAccessibilityHint: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByAccessibilityHint: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByAccessibilityHint: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByAccessibilityHint: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByAccessibilityHint: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByAccessibilityHint: FindAllByQuery<TextMatch, TextMatchOptions>;\n};\n\nexport const bindByHintTextQueries = (\n instance: ReactTestInstance\n): ByHintTextQueries => {\n const getByHintText = getBy(instance);\n const getAllByHintText = getAllBy(instance);\n const queryByHintText = queryBy(instance);\n const queryAllByHintText = queryAllBy(instance);\n const findByHintText = findBy(instance);\n const findAllByHintText = findAllBy(instance);\n\n return {\n getByHintText,\n getAllByHintText,\n queryByHintText,\n queryAllByHintText,\n findByHintText,\n findAllByHintText,\n\n // a11yHint aliases\n getByA11yHint: getByHintText,\n getAllByA11yHint: getAllByHintText,\n queryByA11yHint: queryByHintText,\n queryAllByA11yHint: queryAllByHintText,\n findByA11yHint: findByHintText,\n findAllByA11yHint: findAllByHintText,\n\n // accessibilityHint aliases\n getByAccessibilityHint: getByHintText,\n getAllByAccessibilityHint: getAllByHintText,\n queryByAccessibilityHint: queryByHintText,\n queryAllByAccessibilityHint: queryAllByHintText,\n findByAccessibilityHint: findByHintText,\n findAllByAccessibilityHint: findAllByHintText,\n };\n};\n"],"mappings":";;;;;;AACA;AACA;AAWA,MAAMA,iBAAiB,GAAG,CACxBC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OAAO,IAAAG,gBAAO,EAACJ,IAAI,EAAED,IAAI,CAACM,KAAK,CAACC,iBAAiB,EAAEH,UAAU,EAAED,KAAK,CAAC;AACvE,CAAC;AAED,MAAMK,kBAAkB,GACtBC,QAA2B,IAK3B,SAASC,oBAAoB,CAACC,IAAI,EAAEC,YAAY,EAAE;EAChD,OAAOH,QAAQ,CAACI,OAAO,CACpBb,IAAI,IACH,OAAOA,IAAI,CAACc,IAAI,KAAK,QAAQ,IAC7Bf,iBAAiB,CAACC,IAAI,EAAEW,IAAI,EAAEC,YAAY,CAAC,CAC9C;AACH,CAAC;AAEH,MAAMG,gBAAgB,GAAIJ,IAAe,IACtC,mDAAkDK,MAAM,CAACL,IAAI,CAAE,GAAE;AACpE,MAAMM,eAAe,GAAIN,IAAe,IACrC,qDAAoDK,MAAM,CAACL,IAAI,CAAE,EAAC;AAErE,MAAM;EAAEO,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EhB,kBAAkB,EAClBS,eAAe,EACfF,gBAAgB,CACjB;AA2BM,MAAMU,qBAAqB,GAChChB,QAA2B,IACL;EACtB,MAAMiB,aAAa,GAAGR,KAAK,CAACT,QAAQ,CAAC;EACrC,MAAMkB,gBAAgB,GAAGR,QAAQ,CAACV,QAAQ,CAAC;EAC3C,MAAMmB,eAAe,GAAGR,OAAO,CAACX,QAAQ,CAAC;EACzC,MAAMD,kBAAkB,GAAGa,UAAU,CAACZ,QAAQ,CAAC;EAC/C,MAAMoB,cAAc,GAAGP,MAAM,CAACb,QAAQ,CAAC;EACvC,MAAMqB,iBAAiB,GAAGP,SAAS,CAACd,QAAQ,CAAC;EAE7C,OAAO;IACLiB,aAAa;IACbC,gBAAgB;IAChBC,eAAe;IACfpB,kBAAkB;IAClBqB,cAAc;IACdC,iBAAiB;IAEjB;IACAC,aAAa,EAAEL,aAAa;IAC5BM,gBAAgB,EAAEL,gBAAgB;IAClCM,eAAe,EAAEL,eAAe;IAChCM,kBAAkB,EAAE1B,kBAAkB;IACtC2B,cAAc,EAAEN,cAAc;IAC9BO,iBAAiB,EAAEN,iBAAiB;IAEpC;IACAO,sBAAsB,EAAEX,aAAa;IACrCY,yBAAyB,EAAEX,gBAAgB;IAC3CY,wBAAwB,EAAEX,eAAe;IACzCY,2BAA2B,EAAEhC,kBAAkB;IAC/CiC,uBAAuB,EAAEZ,cAAc;IACvCa,0BAA0B,EAAEZ;EAC9B,CAAC;AACH,CAAC;AAAC"}
@@ -1,12 +1,13 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch } from '../matches';
3
3
  import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
4
+ import { TextMatchOptions } from './text';
4
5
  export declare type ByLabelTextQueries = {
5
- getByLabelText: GetByQuery<TextMatch>;
6
- getAllByLabelText: GetAllByQuery<TextMatch>;
7
- queryByLabelText: QueryByQuery<TextMatch>;
8
- queryAllByLabelText: QueryAllByQuery<TextMatch>;
9
- findByLabelText: FindByQuery<TextMatch>;
10
- findAllByLabelText: FindAllByQuery<TextMatch>;
6
+ getByLabelText: GetByQuery<TextMatch, TextMatchOptions>;
7
+ getAllByLabelText: GetAllByQuery<TextMatch, TextMatchOptions>;
8
+ queryByLabelText: QueryByQuery<TextMatch, TextMatchOptions>;
9
+ queryAllByLabelText: QueryAllByQuery<TextMatch, TextMatchOptions>;
10
+ findByLabelText: FindByQuery<TextMatch, TextMatchOptions>;
11
+ findAllByLabelText: FindAllByQuery<TextMatch, TextMatchOptions>;
11
12
  };
12
13
  export declare const bindByLabelTextQueries: (instance: ReactTestInstance) => ByLabelTextQueries;
@@ -4,19 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByLabelTextQueries = void 0;
7
-
8
- var _matchStringProp = require("../helpers/matchers/matchStringProp");
9
-
7
+ var _matches = require("../matches");
10
8
  var _makeQueries = require("./makeQueries");
11
-
12
- const queryAllByLabelText = instance => function queryAllByLabelTextFn(text) {
13
- return instance.findAll(node => typeof node.type === 'string' && (0, _matchStringProp.matchStringProp)(node.props.accessibilityLabel, text));
9
+ const getNodeByLabelText = (node, text, options = {}) => {
10
+ const {
11
+ exact,
12
+ normalizer
13
+ } = options;
14
+ return (0, _matches.matches)(text, node.props.accessibilityLabel, normalizer, exact);
15
+ };
16
+ const queryAllByLabelText = instance => function queryAllByLabelTextFn(text, queryOptions) {
17
+ return instance.findAll(node => typeof node.type === 'string' && getNodeByLabelText(node, text, queryOptions));
14
18
  };
15
-
16
19
  const getMultipleError = labelText => `Found multiple elements with accessibilityLabel: ${String(labelText)} `;
17
-
18
20
  const getMissingError = labelText => `Unable to find an element with accessibilityLabel: ${String(labelText)}`;
19
-
20
21
  const {
21
22
  getBy,
22
23
  getAllBy,
@@ -25,7 +26,6 @@ const {
25
26
  findBy,
26
27
  findAllBy
27
28
  } = (0, _makeQueries.makeQueries)(queryAllByLabelText, getMissingError, getMultipleError);
28
-
29
29
  const bindByLabelTextQueries = instance => ({
30
30
  getByLabelText: getBy(instance),
31
31
  getAllByLabelText: getAllBy(instance),
@@ -34,6 +34,5 @@ const bindByLabelTextQueries = instance => ({
34
34
  findByLabelText: findBy(instance),
35
35
  findAllByLabelText: findAllBy(instance)
36
36
  });
37
-
38
37
  exports.bindByLabelTextQueries = bindByLabelTextQueries;
39
38
  //# sourceMappingURL=labelText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"labelText.js","names":["queryAllByLabelText","instance","queryAllByLabelTextFn","text","findAll","node","type","matchStringProp","props","accessibilityLabel","getMultipleError","labelText","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByLabelTextQueries","getByLabelText","getAllByLabelText","queryByLabelText","findByLabelText","findAllByLabelText"],"sources":["../../src/queries/labelText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { TextMatch } from '../matches';\nimport { matchStringProp } from '../helpers/matchers/matchStringProp';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\n\nconst queryAllByLabelText = (\n instance: ReactTestInstance\n): ((text: TextMatch) => Array<ReactTestInstance>) =>\n function queryAllByLabelTextFn(text) {\n return instance.findAll(\n (node) =>\n typeof node.type === 'string' &&\n matchStringProp(node.props.accessibilityLabel, text)\n );\n };\n\nconst getMultipleError = (labelText: TextMatch) =>\n `Found multiple elements with accessibilityLabel: ${String(labelText)} `;\nconst getMissingError = (labelText: TextMatch) =>\n `Unable to find an element with accessibilityLabel: ${String(labelText)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByLabelText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByLabelTextQueries = {\n getByLabelText: GetByQuery<TextMatch>;\n getAllByLabelText: GetAllByQuery<TextMatch>;\n queryByLabelText: QueryByQuery<TextMatch>;\n queryAllByLabelText: QueryAllByQuery<TextMatch>;\n findByLabelText: FindByQuery<TextMatch>;\n findAllByLabelText: FindAllByQuery<TextMatch>;\n};\n\nexport const bindByLabelTextQueries = (\n instance: ReactTestInstance\n): ByLabelTextQueries => ({\n getByLabelText: getBy(instance),\n getAllByLabelText: getAllBy(instance),\n queryByLabelText: queryBy(instance),\n queryAllByLabelText: queryAllBy(instance),\n findByLabelText: findBy(instance),\n findAllByLabelText: findAllBy(instance),\n});\n"],"mappings":";;;;;;;AAEA;;AACA;;AAUA,MAAMA,mBAAmB,GACvBC,QAD0B,IAG1B,SAASC,qBAAT,CAA+BC,IAA/B,EAAqC;EACnC,OAAOF,QAAQ,CAACG,OAAT,CACJC,IAAD,IACE,OAAOA,IAAI,CAACC,IAAZ,KAAqB,QAArB,IACA,IAAAC,gCAAA,EAAgBF,IAAI,CAACG,KAAL,CAAWC,kBAA3B,EAA+CN,IAA/C,CAHG,CAAP;AAKD,CATH;;AAWA,MAAMO,gBAAgB,GAAIC,SAAD,IACtB,oDAAmDC,MAAM,CAACD,SAAD,CAAY,GADxE;;AAEA,MAAME,eAAe,GAAIF,SAAD,IACrB,sDAAqDC,MAAM,CAACD,SAAD,CAAY,EAD1E;;AAGA,MAAM;EAAEG,KAAF;EAASC,QAAT;EAAmBC,OAAnB;EAA4BC,UAA5B;EAAwCC,MAAxC;EAAgDC;AAAhD,IAA8D,IAAAC,wBAAA,EAClEpB,mBADkE,EAElEa,eAFkE,EAGlEH,gBAHkE,CAApE;;AAeO,MAAMW,sBAAsB,GACjCpB,QADoC,KAEZ;EACxBqB,cAAc,EAAER,KAAK,CAACb,QAAD,CADG;EAExBsB,iBAAiB,EAAER,QAAQ,CAACd,QAAD,CAFH;EAGxBuB,gBAAgB,EAAER,OAAO,CAACf,QAAD,CAHD;EAIxBD,mBAAmB,EAAEiB,UAAU,CAAChB,QAAD,CAJP;EAKxBwB,eAAe,EAAEP,MAAM,CAACjB,QAAD,CALC;EAMxByB,kBAAkB,EAAEP,SAAS,CAAClB,QAAD;AANL,CAFY,CAA/B"}
1
+ {"version":3,"file":"labelText.js","names":["getNodeByLabelText","node","text","options","exact","normalizer","matches","props","accessibilityLabel","queryAllByLabelText","instance","queryAllByLabelTextFn","queryOptions","findAll","type","getMultipleError","labelText","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByLabelTextQueries","getByLabelText","getAllByLabelText","queryByLabelText","findByLabelText","findAllByLabelText"],"sources":["../../src/queries/labelText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { TextMatchOptions } from './text';\n\nconst getNodeByLabelText = (\n node: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return matches(text, node.props.accessibilityLabel, normalizer, exact);\n};\n\nconst queryAllByLabelText = (\n instance: ReactTestInstance\n): ((\n text: TextMatch,\n queryOptions?: TextMatchOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByLabelTextFn(text, queryOptions?: TextMatchOptions) {\n return instance.findAll(\n (node) =>\n typeof node.type === 'string' &&\n getNodeByLabelText(node, text, queryOptions)\n );\n };\n\nconst getMultipleError = (labelText: TextMatch) =>\n `Found multiple elements with accessibilityLabel: ${String(labelText)} `;\nconst getMissingError = (labelText: TextMatch) =>\n `Unable to find an element with accessibilityLabel: ${String(labelText)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByLabelText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByLabelTextQueries = {\n getByLabelText: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByLabelText: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByLabelText: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByLabelText: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByLabelText: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByLabelText: FindAllByQuery<TextMatch, TextMatchOptions>;\n};\n\nexport const bindByLabelTextQueries = (\n instance: ReactTestInstance\n): ByLabelTextQueries => ({\n getByLabelText: getBy(instance),\n getAllByLabelText: getAllBy(instance),\n queryByLabelText: queryBy(instance),\n queryAllByLabelText: queryAllBy(instance),\n findByLabelText: findBy(instance),\n findAllByLabelText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA;AACA;AAWA,MAAMA,kBAAkB,GAAG,CACzBC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OAAO,IAAAG,gBAAO,EAACJ,IAAI,EAAED,IAAI,CAACM,KAAK,CAACC,kBAAkB,EAAEH,UAAU,EAAED,KAAK,CAAC;AACxE,CAAC;AAED,MAAMK,mBAAmB,GACvBC,QAA2B,IAK3B,SAASC,qBAAqB,CAACT,IAAI,EAAEU,YAA+B,EAAE;EACpE,OAAOF,QAAQ,CAACG,OAAO,CACpBZ,IAAI,IACH,OAAOA,IAAI,CAACa,IAAI,KAAK,QAAQ,IAC7Bd,kBAAkB,CAACC,IAAI,EAAEC,IAAI,EAAEU,YAAY,CAAC,CAC/C;AACH,CAAC;AAEH,MAAMG,gBAAgB,GAAIC,SAAoB,IAC3C,oDAAmDC,MAAM,CAACD,SAAS,CAAE,GAAE;AAC1E,MAAME,eAAe,GAAIF,SAAoB,IAC1C,sDAAqDC,MAAM,CAACD,SAAS,CAAE,EAAC;AAE3E,MAAM;EAAEG,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EhB,mBAAmB,EACnBS,eAAe,EACfH,gBAAgB,CACjB;AAWM,MAAMW,sBAAsB,GACjChB,QAA2B,KACH;EACxBiB,cAAc,EAAER,KAAK,CAACT,QAAQ,CAAC;EAC/BkB,iBAAiB,EAAER,QAAQ,CAACV,QAAQ,CAAC;EACrCmB,gBAAgB,EAAER,OAAO,CAACX,QAAQ,CAAC;EACnCD,mBAAmB,EAAEa,UAAU,CAACZ,QAAQ,CAAC;EACzCoB,eAAe,EAAEP,MAAM,CAACb,QAAQ,CAAC;EACjCqB,kBAAkB,EAAEP,SAAS,CAACd,QAAQ;AACxC,CAAC,CAAC;AAAC"}
@@ -4,8 +4,8 @@ export declare type GetByQuery<Predicate, Options = void> = (predicate: Predicat
4
4
  export declare type GetAllByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options) => ReactTestInstance[];
5
5
  export declare type QueryByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options) => ReactTestInstance | null;
6
6
  export declare type QueryAllByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options) => ReactTestInstance[];
7
- export declare type FindByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options, waitForOptions?: WaitForOptions) => Promise<ReactTestInstance>;
8
- export declare type FindAllByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options, waitForOptions?: WaitForOptions) => Promise<ReactTestInstance[]>;
7
+ export declare type FindByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options & WaitForOptions, waitForOptions?: WaitForOptions) => Promise<ReactTestInstance>;
8
+ export declare type FindAllByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options & WaitForOptions, waitForOptions?: WaitForOptions) => Promise<ReactTestInstance[]>;
9
9
  declare type UnboundQuery<Query> = (instance: ReactTestInstance) => Query;
10
10
  export declare type UnboundQueries<Predicate, Options> = {
11
11
  getBy: UnboundQuery<GetByQuery<Predicate, Options>>;
@@ -15,5 +15,5 @@ export declare type UnboundQueries<Predicate, Options> = {
15
15
  findBy: UnboundQuery<FindByQuery<Predicate, Options>>;
16
16
  findAllBy: UnboundQuery<FindAllByQuery<Predicate, Options>>;
17
17
  };
18
- export declare function makeQueries<Predicate, Options>(queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>, getMissingError: (predicate: Predicate) => string, getMultipleError: (predicate: Predicate) => string): UnboundQueries<Predicate, Options>;
18
+ export declare function makeQueries<Predicate, Options>(queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>, getMissingError: (predicate: Predicate, options?: Options) => string, getMultipleError: (predicate: Predicate, options?: Options) => string): UnboundQueries<Predicate, Options>;
19
19
  export {};
@@ -4,70 +4,86 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.makeQueries = makeQueries;
7
-
8
7
  var _errors = require("../helpers/errors");
9
-
10
8
  var _waitFor = _interopRequireDefault(require("../waitFor"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const deprecatedKeys = ['timeout', 'interval', 'stackTraceError'];
13
11
 
12
+ // The WaitForOptions has been moved to the second option param of findBy* methods with the adding of TextMatchOptions
13
+ // To make the migration easier and avoid a breaking change, keep reading this options from the first param but warn
14
+ function extractDeprecatedWaitForOptions(options) {
15
+ if (!options) {
16
+ return undefined;
17
+ }
18
+ const waitForOptions = {
19
+ timeout: options.timeout,
20
+ interval: options.interval,
21
+ stackTraceError: options.stackTraceError
22
+ };
23
+ deprecatedKeys.forEach(key => {
24
+ const option = options[key];
25
+ if (option) {
26
+ // eslint-disable-next-line no-console
27
+ console.warn(`Use of option "${key}" in a findBy* query options (2nd parameter) is deprecated. Please pass this option in the waitForOptions (3rd parameter).
28
+ Example:
29
+
30
+ findByText(text, {}, { ${key}: ${option.toString()} })`);
31
+ }
32
+ });
33
+ return waitForOptions;
34
+ }
14
35
  function makeQueries(queryAllByQuery, getMissingError, getMultipleError) {
15
36
  function getAllByQuery(instance) {
16
37
  return function getAllFn(predicate, options) {
17
38
  const results = queryAllByQuery(instance)(predicate, options);
18
-
19
39
  if (results.length === 0) {
20
- throw new _errors.ErrorWithStack(getMissingError(predicate), getAllFn);
40
+ throw new _errors.ErrorWithStack(getMissingError(predicate, options), getAllFn);
21
41
  }
22
-
23
42
  return results;
24
43
  };
25
44
  }
26
-
27
45
  function queryByQuery(instance) {
28
46
  return function singleQueryFn(predicate, options) {
29
47
  const results = queryAllByQuery(instance)(predicate, options);
30
-
31
48
  if (results.length > 1) {
32
- throw new _errors.ErrorWithStack(getMultipleError(predicate), singleQueryFn);
49
+ throw new _errors.ErrorWithStack(getMultipleError(predicate, options), singleQueryFn);
33
50
  }
34
-
35
51
  if (results.length === 0) {
36
52
  return null;
37
53
  }
38
-
39
54
  return results[0];
40
55
  };
41
56
  }
42
-
43
57
  function getByQuery(instance) {
44
58
  return function getFn(predicate, options) {
45
59
  const results = queryAllByQuery(instance)(predicate, options);
46
-
47
60
  if (results.length > 1) {
48
- throw new _errors.ErrorWithStack(getMultipleError(predicate), getFn);
61
+ throw new _errors.ErrorWithStack(getMultipleError(predicate, options), getFn);
49
62
  }
50
-
51
63
  if (results.length === 0) {
52
- throw new _errors.ErrorWithStack(getMissingError(predicate), getFn);
64
+ throw new _errors.ErrorWithStack(getMissingError(predicate, options), getFn);
53
65
  }
54
-
55
66
  return results[0];
56
67
  };
57
68
  }
58
-
59
69
  function findAllByQuery(instance) {
60
- return function findAllFn(predicate, queryOptions, waitForOptions) {
61
- return (0, _waitFor.default)(() => getAllByQuery(instance)(predicate, queryOptions), waitForOptions);
70
+ return function findAllFn(predicate, queryOptions, waitForOptions = {}) {
71
+ const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);
72
+ return (0, _waitFor.default)(() => getAllByQuery(instance)(predicate, queryOptions), {
73
+ ...deprecatedWaitForOptions,
74
+ ...waitForOptions
75
+ });
62
76
  };
63
77
  }
64
-
65
78
  function findByQuery(instance) {
66
- return function findFn(predicate, queryOptions, waitForOptions) {
67
- return (0, _waitFor.default)(() => getByQuery(instance)(predicate, queryOptions), waitForOptions);
79
+ return function findFn(predicate, queryOptions, waitForOptions = {}) {
80
+ const deprecatedWaitForOptions = extractDeprecatedWaitForOptions(queryOptions);
81
+ return (0, _waitFor.default)(() => getByQuery(instance)(predicate, queryOptions), {
82
+ ...deprecatedWaitForOptions,
83
+ ...waitForOptions
84
+ });
68
85
  };
69
86
  }
70
-
71
87
  return {
72
88
  getBy: getByQuery,
73
89
  getAllBy: getAllByQuery,
@@ -1 +1 @@
1
- {"version":3,"file":"makeQueries.js","names":["makeQueries","queryAllByQuery","getMissingError","getMultipleError","getAllByQuery","instance","getAllFn","predicate","options","results","length","ErrorWithStack","queryByQuery","singleQueryFn","getByQuery","getFn","findAllByQuery","findAllFn","queryOptions","waitForOptions","waitFor","findByQuery","findFn","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy"],"sources":["../../src/queries/makeQueries.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { ErrorWithStack } from '../helpers/errors';\nimport waitFor from '../waitFor';\nimport type { WaitForOptions } from '../waitFor';\n\nexport type GetByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance;\n\nexport type GetAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance[];\n\nexport type QueryByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance | null;\n\nexport type QueryAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance[];\n\nexport type FindByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n waitForOptions?: WaitForOptions\n) => Promise<ReactTestInstance>;\n\nexport type FindAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options,\n waitForOptions?: WaitForOptions\n) => Promise<ReactTestInstance[]>;\n\ntype UnboundQuery<Query> = (instance: ReactTestInstance) => Query;\n\nexport type UnboundQueries<Predicate, Options> = {\n getBy: UnboundQuery<GetByQuery<Predicate, Options>>;\n getAllBy: UnboundQuery<GetAllByQuery<Predicate, Options>>;\n queryBy: UnboundQuery<QueryByQuery<Predicate, Options>>;\n queryAllBy: UnboundQuery<QueryAllByQuery<Predicate, Options>>;\n findBy: UnboundQuery<FindByQuery<Predicate, Options>>;\n findAllBy: UnboundQuery<FindAllByQuery<Predicate, Options>>;\n};\n\nexport function makeQueries<Predicate, Options>(\n queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>,\n getMissingError: (predicate: Predicate) => string,\n getMultipleError: (predicate: Predicate) => string\n): UnboundQueries<Predicate, Options> {\n function getAllByQuery(instance: ReactTestInstance) {\n return function getAllFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length === 0) {\n throw new ErrorWithStack(getMissingError(predicate), getAllFn);\n }\n\n return results;\n };\n }\n\n function queryByQuery(instance: ReactTestInstance) {\n return function singleQueryFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(getMultipleError(predicate), singleQueryFn);\n }\n\n if (results.length === 0) {\n return null;\n }\n\n return results[0];\n };\n }\n\n function getByQuery(instance: ReactTestInstance) {\n return function getFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(getMultipleError(predicate), getFn);\n }\n\n if (results.length === 0) {\n throw new ErrorWithStack(getMissingError(predicate), getFn);\n }\n\n return results[0];\n };\n }\n\n function findAllByQuery(instance: ReactTestInstance) {\n return function findAllFn(\n predicate: Predicate,\n queryOptions?: Options,\n waitForOptions?: WaitForOptions\n ) {\n return waitFor(\n () => getAllByQuery(instance)(predicate, queryOptions),\n waitForOptions\n );\n };\n }\n\n function findByQuery(instance: ReactTestInstance) {\n return function findFn(\n predicate: Predicate,\n queryOptions?: Options,\n waitForOptions?: WaitForOptions\n ) {\n return waitFor(\n () => getByQuery(instance)(predicate, queryOptions),\n waitForOptions\n );\n };\n }\n\n return {\n getBy: getByQuery,\n getAllBy: getAllByQuery,\n queryBy: queryByQuery,\n queryAllBy: queryAllByQuery,\n findBy: findByQuery,\n findAllBy: findAllByQuery,\n };\n}\n"],"mappings":";;;;;;;AACA;;AACA;;;;AA8CO,SAASA,WAAT,CACLC,eADK,EAELC,eAFK,EAGLC,gBAHK,EAI+B;EACpC,SAASC,aAAT,CAAuBC,QAAvB,EAAoD;IAClD,OAAO,SAASC,QAAT,CAAkBC,SAAlB,EAAwCC,OAAxC,EAA2D;MAChE,MAAMC,OAAO,GAAGR,eAAe,CAACI,QAAD,CAAf,CAA0BE,SAA1B,EAAqCC,OAArC,CAAhB;;MAEA,IAAIC,OAAO,CAACC,MAAR,KAAmB,CAAvB,EAA0B;QACxB,MAAM,IAAIC,sBAAJ,CAAmBT,eAAe,CAACK,SAAD,CAAlC,EAA+CD,QAA/C,CAAN;MACD;;MAED,OAAOG,OAAP;IACD,CARD;EASD;;EAED,SAASG,YAAT,CAAsBP,QAAtB,EAAmD;IACjD,OAAO,SAASQ,aAAT,CAAuBN,SAAvB,EAA6CC,OAA7C,EAAgE;MACrE,MAAMC,OAAO,GAAGR,eAAe,CAACI,QAAD,CAAf,CAA0BE,SAA1B,EAAqCC,OAArC,CAAhB;;MAEA,IAAIC,OAAO,CAACC,MAAR,GAAiB,CAArB,EAAwB;QACtB,MAAM,IAAIC,sBAAJ,CAAmBR,gBAAgB,CAACI,SAAD,CAAnC,EAAgDM,aAAhD,CAAN;MACD;;MAED,IAAIJ,OAAO,CAACC,MAAR,KAAmB,CAAvB,EAA0B;QACxB,OAAO,IAAP;MACD;;MAED,OAAOD,OAAO,CAAC,CAAD,CAAd;IACD,CAZD;EAaD;;EAED,SAASK,UAAT,CAAoBT,QAApB,EAAiD;IAC/C,OAAO,SAASU,KAAT,CAAeR,SAAf,EAAqCC,OAArC,EAAwD;MAC7D,MAAMC,OAAO,GAAGR,eAAe,CAACI,QAAD,CAAf,CAA0BE,SAA1B,EAAqCC,OAArC,CAAhB;;MAEA,IAAIC,OAAO,CAACC,MAAR,GAAiB,CAArB,EAAwB;QACtB,MAAM,IAAIC,sBAAJ,CAAmBR,gBAAgB,CAACI,SAAD,CAAnC,EAAgDQ,KAAhD,CAAN;MACD;;MAED,IAAIN,OAAO,CAACC,MAAR,KAAmB,CAAvB,EAA0B;QACxB,MAAM,IAAIC,sBAAJ,CAAmBT,eAAe,CAACK,SAAD,CAAlC,EAA+CQ,KAA/C,CAAN;MACD;;MAED,OAAON,OAAO,CAAC,CAAD,CAAd;IACD,CAZD;EAaD;;EAED,SAASO,cAAT,CAAwBX,QAAxB,EAAqD;IACnD,OAAO,SAASY,SAAT,CACLV,SADK,EAELW,YAFK,EAGLC,cAHK,EAIL;MACA,OAAO,IAAAC,gBAAA,EACL,MAAMhB,aAAa,CAACC,QAAD,CAAb,CAAwBE,SAAxB,EAAmCW,YAAnC,CADD,EAELC,cAFK,CAAP;IAID,CATD;EAUD;;EAED,SAASE,WAAT,CAAqBhB,QAArB,EAAkD;IAChD,OAAO,SAASiB,MAAT,CACLf,SADK,EAELW,YAFK,EAGLC,cAHK,EAIL;MACA,OAAO,IAAAC,gBAAA,EACL,MAAMN,UAAU,CAACT,QAAD,CAAV,CAAqBE,SAArB,EAAgCW,YAAhC,CADD,EAELC,cAFK,CAAP;IAID,CATD;EAUD;;EAED,OAAO;IACLI,KAAK,EAAET,UADF;IAELU,QAAQ,EAAEpB,aAFL;IAGLqB,OAAO,EAAEb,YAHJ;IAILc,UAAU,EAAEzB,eAJP;IAKL0B,MAAM,EAAEN,WALH;IAMLO,SAAS,EAAEZ;EANN,CAAP;AAQD"}
1
+ {"version":3,"file":"makeQueries.js","names":["deprecatedKeys","extractDeprecatedWaitForOptions","options","undefined","waitForOptions","timeout","interval","stackTraceError","forEach","key","option","console","warn","toString","makeQueries","queryAllByQuery","getMissingError","getMultipleError","getAllByQuery","instance","getAllFn","predicate","results","length","ErrorWithStack","queryByQuery","singleQueryFn","getByQuery","getFn","findAllByQuery","findAllFn","queryOptions","deprecatedWaitForOptions","waitFor","findByQuery","findFn","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy"],"sources":["../../src/queries/makeQueries.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { ErrorWithStack } from '../helpers/errors';\nimport waitFor from '../waitFor';\nimport type { WaitForOptions } from '../waitFor';\n\nexport type GetByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance;\n\nexport type GetAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance[];\n\nexport type QueryByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance | null;\n\nexport type QueryAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance[];\n\nexport type FindByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions\n) => Promise<ReactTestInstance>;\n\nexport type FindAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions\n) => Promise<ReactTestInstance[]>;\n\ntype UnboundQuery<Query> = (instance: ReactTestInstance) => Query;\n\nexport type UnboundQueries<Predicate, Options> = {\n getBy: UnboundQuery<GetByQuery<Predicate, Options>>;\n getAllBy: UnboundQuery<GetAllByQuery<Predicate, Options>>;\n queryBy: UnboundQuery<QueryByQuery<Predicate, Options>>;\n queryAllBy: UnboundQuery<QueryAllByQuery<Predicate, Options>>;\n findBy: UnboundQuery<FindByQuery<Predicate, Options>>;\n findAllBy: UnboundQuery<FindAllByQuery<Predicate, Options>>;\n};\n\nconst deprecatedKeys: (keyof WaitForOptions)[] = [\n 'timeout',\n 'interval',\n 'stackTraceError',\n];\n\n// The WaitForOptions has been moved to the second option param of findBy* methods with the adding of TextMatchOptions\n// To make the migration easier and avoid a breaking change, keep reading this options from the first param but warn\nfunction extractDeprecatedWaitForOptions(options?: WaitForOptions) {\n if (!options) {\n return undefined;\n }\n\n const waitForOptions: WaitForOptions = {\n timeout: options.timeout,\n interval: options.interval,\n stackTraceError: options.stackTraceError,\n };\n\n deprecatedKeys.forEach((key) => {\n const option = options[key];\n if (option) {\n // eslint-disable-next-line no-console\n console.warn(\n `Use of option \"${key}\" in a findBy* query options (2nd parameter) is deprecated. Please pass this option in the waitForOptions (3rd parameter). \nExample: \n\n findByText(text, {}, { ${key}: ${option.toString()} })`\n );\n }\n });\n\n return waitForOptions;\n}\n\nexport function makeQueries<Predicate, Options>(\n queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>,\n getMissingError: (predicate: Predicate, options?: Options) => string,\n getMultipleError: (predicate: Predicate, options?: Options) => string\n): UnboundQueries<Predicate, Options> {\n function getAllByQuery(instance: ReactTestInstance) {\n return function getAllFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length === 0) {\n throw new ErrorWithStack(getMissingError(predicate, options), getAllFn);\n }\n\n return results;\n };\n }\n\n function queryByQuery(instance: ReactTestInstance) {\n return function singleQueryFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(\n getMultipleError(predicate, options),\n singleQueryFn\n );\n }\n\n if (results.length === 0) {\n return null;\n }\n\n return results[0];\n };\n }\n\n function getByQuery(instance: ReactTestInstance) {\n return function getFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(getMultipleError(predicate, options), getFn);\n }\n\n if (results.length === 0) {\n throw new ErrorWithStack(getMissingError(predicate, options), getFn);\n }\n\n return results[0];\n };\n }\n\n function findAllByQuery(instance: ReactTestInstance) {\n return function findAllFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n waitForOptions: WaitForOptions = {}\n ) {\n const deprecatedWaitForOptions =\n extractDeprecatedWaitForOptions(queryOptions);\n return waitFor(() => getAllByQuery(instance)(predicate, queryOptions), {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n });\n };\n }\n\n function findByQuery(instance: ReactTestInstance) {\n return function findFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n waitForOptions: WaitForOptions = {}\n ) {\n const deprecatedWaitForOptions =\n extractDeprecatedWaitForOptions(queryOptions);\n return waitFor(() => getByQuery(instance)(predicate, queryOptions), {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n });\n };\n }\n\n return {\n getBy: getByQuery,\n getAllBy: getAllByQuery,\n queryBy: queryByQuery,\n queryAllBy: queryAllByQuery,\n findBy: findByQuery,\n findAllBy: findAllByQuery,\n };\n}\n"],"mappings":";;;;;;AACA;AACA;AAAiC;AAgDjC,MAAMA,cAAwC,GAAG,CAC/C,SAAS,EACT,UAAU,EACV,iBAAiB,CAClB;;AAED;AACA;AACA,SAASC,+BAA+B,CAACC,OAAwB,EAAE;EACjE,IAAI,CAACA,OAAO,EAAE;IACZ,OAAOC,SAAS;EAClB;EAEA,MAAMC,cAA8B,GAAG;IACrCC,OAAO,EAAEH,OAAO,CAACG,OAAO;IACxBC,QAAQ,EAAEJ,OAAO,CAACI,QAAQ;IAC1BC,eAAe,EAAEL,OAAO,CAACK;EAC3B,CAAC;EAEDP,cAAc,CAACQ,OAAO,CAAEC,GAAG,IAAK;IAC9B,MAAMC,MAAM,GAAGR,OAAO,CAACO,GAAG,CAAC;IAC3B,IAAIC,MAAM,EAAE;MACV;MACAC,OAAO,CAACC,IAAI,CACT,kBAAiBH,GAAI;AAC9B;AACA;AACA,2BAA2BA,GAAI,KAAIC,MAAM,CAACG,QAAQ,EAAG,KAAI,CAClD;IACH;EACF,CAAC,CAAC;EAEF,OAAOT,cAAc;AACvB;AAEO,SAASU,WAAW,CACzBC,eAAkE,EAClEC,eAAoE,EACpEC,gBAAqE,EACjC;EACpC,SAASC,aAAa,CAACC,QAA2B,EAAE;IAClD,OAAO,SAASC,QAAQ,CAACC,SAAoB,EAAEnB,OAAiB,EAAE;MAChE,MAAMoB,OAAO,GAAGP,eAAe,CAACI,QAAQ,CAAC,CAACE,SAAS,EAAEnB,OAAO,CAAC;MAE7D,IAAIoB,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIC,sBAAc,CAACR,eAAe,CAACK,SAAS,EAAEnB,OAAO,CAAC,EAAEkB,QAAQ,CAAC;MACzE;MAEA,OAAOE,OAAO;IAChB,CAAC;EACH;EAEA,SAASG,YAAY,CAACN,QAA2B,EAAE;IACjD,OAAO,SAASO,aAAa,CAACL,SAAoB,EAAEnB,OAAiB,EAAE;MACrE,MAAMoB,OAAO,GAAGP,eAAe,CAACI,QAAQ,CAAC,CAACE,SAAS,EAAEnB,OAAO,CAAC;MAE7D,IAAIoB,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;QACtB,MAAM,IAAIC,sBAAc,CACtBP,gBAAgB,CAACI,SAAS,EAAEnB,OAAO,CAAC,EACpCwB,aAAa,CACd;MACH;MAEA,IAAIJ,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,IAAI;MACb;MAEA,OAAOD,OAAO,CAAC,CAAC,CAAC;IACnB,CAAC;EACH;EAEA,SAASK,UAAU,CAACR,QAA2B,EAAE;IAC/C,OAAO,SAASS,KAAK,CAACP,SAAoB,EAAEnB,OAAiB,EAAE;MAC7D,MAAMoB,OAAO,GAAGP,eAAe,CAACI,QAAQ,CAAC,CAACE,SAAS,EAAEnB,OAAO,CAAC;MAE7D,IAAIoB,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;QACtB,MAAM,IAAIC,sBAAc,CAACP,gBAAgB,CAACI,SAAS,EAAEnB,OAAO,CAAC,EAAE0B,KAAK,CAAC;MACvE;MAEA,IAAIN,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;QACxB,MAAM,IAAIC,sBAAc,CAACR,eAAe,CAACK,SAAS,EAAEnB,OAAO,CAAC,EAAE0B,KAAK,CAAC;MACtE;MAEA,OAAON,OAAO,CAAC,CAAC,CAAC;IACnB,CAAC;EACH;EAEA,SAASO,cAAc,CAACV,QAA2B,EAAE;IACnD,OAAO,SAASW,SAAS,CACvBT,SAAoB,EACpBU,YAAuC,EACvC3B,cAA8B,GAAG,CAAC,CAAC,EACnC;MACA,MAAM4B,wBAAwB,GAC5B/B,+BAA+B,CAAC8B,YAAY,CAAC;MAC/C,OAAO,IAAAE,gBAAO,EAAC,MAAMf,aAAa,CAACC,QAAQ,CAAC,CAACE,SAAS,EAAEU,YAAY,CAAC,EAAE;QACrE,GAAGC,wBAAwB;QAC3B,GAAG5B;MACL,CAAC,CAAC;IACJ,CAAC;EACH;EAEA,SAAS8B,WAAW,CAACf,QAA2B,EAAE;IAChD,OAAO,SAASgB,MAAM,CACpBd,SAAoB,EACpBU,YAAuC,EACvC3B,cAA8B,GAAG,CAAC,CAAC,EACnC;MACA,MAAM4B,wBAAwB,GAC5B/B,+BAA+B,CAAC8B,YAAY,CAAC;MAC/C,OAAO,IAAAE,gBAAO,EAAC,MAAMN,UAAU,CAACR,QAAQ,CAAC,CAACE,SAAS,EAAEU,YAAY,CAAC,EAAE;QAClE,GAAGC,wBAAwB;QAC3B,GAAG5B;MACL,CAAC,CAAC;IACJ,CAAC;EACH;EAEA,OAAO;IACLgC,KAAK,EAAET,UAAU;IACjBU,QAAQ,EAAEnB,aAAa;IACvBoB,OAAO,EAAEb,YAAY;IACrBc,UAAU,EAAExB,eAAe;IAC3ByB,MAAM,EAAEN,WAAW;IACnBO,SAAS,EAAEZ;EACb,CAAC;AACH"}
@@ -4,39 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByPlaceholderTextQueries = void 0;
7
-
8
- var _errors = require("../helpers/errors");
9
-
7
+ var _reactNative = require("react-native");
10
8
  var _filterNodeByType = require("../helpers/filterNodeByType");
11
-
12
9
  var _matches = require("../matches");
13
-
14
10
  var _makeQueries = require("./makeQueries");
15
-
16
11
  const getTextInputNodeByPlaceholderText = (node, placeholder, options = {}) => {
17
- try {
18
- const {
19
- TextInput
20
- } = require('react-native');
21
-
22
- const {
23
- exact,
24
- normalizer
25
- } = options;
26
- return (0, _filterNodeByType.filterNodeByType)(node, TextInput) && (0, _matches.matches)(placeholder, node.props.placeholder, normalizer, exact);
27
- } catch (error) {
28
- throw (0, _errors.createLibraryNotSupportedError)(error);
29
- }
12
+ const {
13
+ exact,
14
+ normalizer
15
+ } = options;
16
+ return (0, _filterNodeByType.filterNodeByType)(node, _reactNative.TextInput) && (0, _matches.matches)(placeholder, node.props.placeholder, normalizer, exact);
30
17
  };
31
-
32
18
  const queryAllByPlaceholderText = instance => function queryAllByPlaceholderFn(placeholder, queryOptions) {
33
19
  return instance.findAll(node => getTextInputNodeByPlaceholderText(node, placeholder, queryOptions));
34
20
  };
35
-
36
21
  const getMultipleError = placeholder => `Found multiple elements with placeholder: ${String(placeholder)} `;
37
-
38
22
  const getMissingError = placeholder => `Unable to find an element with placeholder: ${String(placeholder)}`;
39
-
40
23
  const {
41
24
  getBy,
42
25
  getAllBy,
@@ -45,7 +28,6 @@ const {
45
28
  findBy,
46
29
  findAllBy
47
30
  } = (0, _makeQueries.makeQueries)(queryAllByPlaceholderText, getMissingError, getMultipleError);
48
-
49
31
  const bindByPlaceholderTextQueries = instance => ({
50
32
  getByPlaceholderText: getBy(instance),
51
33
  getAllByPlaceholderText: getAllBy(instance),
@@ -54,6 +36,5 @@ const bindByPlaceholderTextQueries = instance => ({
54
36
  findByPlaceholderText: findBy(instance),
55
37
  findAllByPlaceholderText: findAllBy(instance)
56
38
  });
57
-
58
39
  exports.bindByPlaceholderTextQueries = bindByPlaceholderTextQueries;
59
40
  //# sourceMappingURL=placeholderText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"placeholderText.js","names":["getTextInputNodeByPlaceholderText","node","placeholder","options","TextInput","require","exact","normalizer","filterNodeByType","matches","props","error","createLibraryNotSupportedError","queryAllByPlaceholderText","instance","queryAllByPlaceholderFn","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByPlaceholderTextQueries","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText"],"sources":["../../src/queries/placeholderText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { createLibraryNotSupportedError } from '../helpers/errors';\nimport { filterNodeByType } from '../helpers/filterNodeByType';\nimport { matches, TextMatch } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { TextMatchOptions } from './text';\n\nconst getTextInputNodeByPlaceholderText = (\n node: ReactTestInstance,\n placeholder: TextMatch,\n options: TextMatchOptions = {}\n) => {\n try {\n const { TextInput } = require('react-native');\n const { exact, normalizer } = options;\n return (\n filterNodeByType(node, TextInput) &&\n matches(placeholder, node.props.placeholder, normalizer, exact)\n );\n } catch (error) {\n throw createLibraryNotSupportedError(error);\n }\n};\n\nconst queryAllByPlaceholderText = (\n instance: ReactTestInstance\n): ((\n placeholder: TextMatch,\n queryOptions?: TextMatchOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByPlaceholderFn(placeholder, queryOptions) {\n return instance.findAll((node) =>\n getTextInputNodeByPlaceholderText(node, placeholder, queryOptions)\n );\n };\n\nconst getMultipleError = (placeholder: TextMatch) =>\n `Found multiple elements with placeholder: ${String(placeholder)} `;\nconst getMissingError = (placeholder: TextMatch) =>\n `Unable to find an element with placeholder: ${String(placeholder)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByPlaceholderText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByPlaceholderTextQueries = {\n getByPlaceholderText: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByPlaceholderText: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByPlaceholderText: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByPlaceholderText: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByPlaceholderText: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByPlaceholderText: FindAllByQuery<TextMatch, TextMatchOptions>;\n};\n\nexport const bindByPlaceholderTextQueries = (\n instance: ReactTestInstance\n): ByPlaceholderTextQueries => ({\n getByPlaceholderText: getBy(instance),\n getAllByPlaceholderText: getAllBy(instance),\n queryByPlaceholderText: queryBy(instance),\n queryAllByPlaceholderText: queryAllBy(instance),\n findByPlaceholderText: findBy(instance),\n findAllByPlaceholderText: findAllBy(instance),\n});\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AACA;;AAWA,MAAMA,iCAAiC,GAAG,CACxCC,IADwC,EAExCC,WAFwC,EAGxCC,OAAyB,GAAG,EAHY,KAIrC;EACH,IAAI;IACF,MAAM;MAAEC;IAAF,IAAgBC,OAAO,CAAC,cAAD,CAA7B;;IACA,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAwBJ,OAA9B;IACA,OACE,IAAAK,kCAAA,EAAiBP,IAAjB,EAAuBG,SAAvB,KACA,IAAAK,gBAAA,EAAQP,WAAR,EAAqBD,IAAI,CAACS,KAAL,CAAWR,WAAhC,EAA6CK,UAA7C,EAAyDD,KAAzD,CAFF;EAID,CAPD,CAOE,OAAOK,KAAP,EAAc;IACd,MAAM,IAAAC,sCAAA,EAA+BD,KAA/B,CAAN;EACD;AACF,CAfD;;AAiBA,MAAME,yBAAyB,GAC7BC,QADgC,IAMhC,SAASC,uBAAT,CAAiCb,WAAjC,EAA8Cc,YAA9C,EAA4D;EAC1D,OAAOF,QAAQ,CAACG,OAAT,CAAkBhB,IAAD,IACtBD,iCAAiC,CAACC,IAAD,EAAOC,WAAP,EAAoBc,YAApB,CAD5B,CAAP;AAGD,CAVH;;AAYA,MAAME,gBAAgB,GAAIhB,WAAD,IACtB,6CAA4CiB,MAAM,CAACjB,WAAD,CAAc,GADnE;;AAEA,MAAMkB,eAAe,GAAIlB,WAAD,IACrB,+CAA8CiB,MAAM,CAACjB,WAAD,CAAc,EADrE;;AAGA,MAAM;EAAEmB,KAAF;EAASC,QAAT;EAAmBC,OAAnB;EAA4BC,UAA5B;EAAwCC,MAAxC;EAAgDC;AAAhD,IAA8D,IAAAC,wBAAA,EAClEd,yBADkE,EAElEO,eAFkE,EAGlEF,gBAHkE,CAApE;;AAeO,MAAMU,4BAA4B,GACvCd,QAD0C,KAEZ;EAC9Be,oBAAoB,EAAER,KAAK,CAACP,QAAD,CADG;EAE9BgB,uBAAuB,EAAER,QAAQ,CAACR,QAAD,CAFH;EAG9BiB,sBAAsB,EAAER,OAAO,CAACT,QAAD,CAHD;EAI9BD,yBAAyB,EAAEW,UAAU,CAACV,QAAD,CAJP;EAK9BkB,qBAAqB,EAAEP,MAAM,CAACX,QAAD,CALC;EAM9BmB,wBAAwB,EAAEP,SAAS,CAACZ,QAAD;AANL,CAFY,CAArC"}
1
+ {"version":3,"file":"placeholderText.js","names":["getTextInputNodeByPlaceholderText","node","placeholder","options","exact","normalizer","filterNodeByType","TextInput","matches","props","queryAllByPlaceholderText","instance","queryAllByPlaceholderFn","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByPlaceholderTextQueries","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText"],"sources":["../../src/queries/placeholderText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { TextInput } from 'react-native';\nimport { filterNodeByType } from '../helpers/filterNodeByType';\nimport { matches, TextMatch } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { TextMatchOptions } from './text';\n\nconst getTextInputNodeByPlaceholderText = (\n node: ReactTestInstance,\n placeholder: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return (\n filterNodeByType(node, TextInput) &&\n matches(placeholder, node.props.placeholder, normalizer, exact)\n );\n};\n\nconst queryAllByPlaceholderText = (\n instance: ReactTestInstance\n): ((\n placeholder: TextMatch,\n queryOptions?: TextMatchOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByPlaceholderFn(placeholder, queryOptions) {\n return instance.findAll((node) =>\n getTextInputNodeByPlaceholderText(node, placeholder, queryOptions)\n );\n };\n\nconst getMultipleError = (placeholder: TextMatch) =>\n `Found multiple elements with placeholder: ${String(placeholder)} `;\nconst getMissingError = (placeholder: TextMatch) =>\n `Unable to find an element with placeholder: ${String(placeholder)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByPlaceholderText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByPlaceholderTextQueries = {\n getByPlaceholderText: GetByQuery<TextMatch, TextMatchOptions>;\n getAllByPlaceholderText: GetAllByQuery<TextMatch, TextMatchOptions>;\n queryByPlaceholderText: QueryByQuery<TextMatch, TextMatchOptions>;\n queryAllByPlaceholderText: QueryAllByQuery<TextMatch, TextMatchOptions>;\n findByPlaceholderText: FindByQuery<TextMatch, TextMatchOptions>;\n findAllByPlaceholderText: FindAllByQuery<TextMatch, TextMatchOptions>;\n};\n\nexport const bindByPlaceholderTextQueries = (\n instance: ReactTestInstance\n): ByPlaceholderTextQueries => ({\n getByPlaceholderText: getBy(instance),\n getAllByPlaceholderText: getAllBy(instance),\n queryByPlaceholderText: queryBy(instance),\n queryAllByPlaceholderText: queryAllBy(instance),\n findByPlaceholderText: findBy(instance),\n findAllByPlaceholderText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA;AACA;AACA;AACA;AAWA,MAAMA,iCAAiC,GAAG,CACxCC,IAAuB,EACvBC,WAAsB,EACtBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OACE,IAAAG,kCAAgB,EAACL,IAAI,EAAEM,sBAAS,CAAC,IACjC,IAAAC,gBAAO,EAACN,WAAW,EAAED,IAAI,CAACQ,KAAK,CAACP,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AAEnE,CAAC;AAED,MAAMM,yBAAyB,GAC7BC,QAA2B,IAK3B,SAASC,uBAAuB,CAACV,WAAW,EAAEW,YAAY,EAAE;EAC1D,OAAOF,QAAQ,CAACG,OAAO,CAAEb,IAAI,IAC3BD,iCAAiC,CAACC,IAAI,EAAEC,WAAW,EAAEW,YAAY,CAAC,CACnE;AACH,CAAC;AAEH,MAAME,gBAAgB,GAAIb,WAAsB,IAC7C,6CAA4Cc,MAAM,CAACd,WAAW,CAAE,GAAE;AACrE,MAAMe,eAAe,GAAIf,WAAsB,IAC5C,+CAA8Cc,MAAM,CAACd,WAAW,CAAE,EAAC;AAEtE,MAAM;EAAEgB,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7Ed,yBAAyB,EACzBO,eAAe,EACfF,gBAAgB,CACjB;AAWM,MAAMU,4BAA4B,GACvCd,QAA2B,KACG;EAC9Be,oBAAoB,EAAER,KAAK,CAACP,QAAQ,CAAC;EACrCgB,uBAAuB,EAAER,QAAQ,CAACR,QAAQ,CAAC;EAC3CiB,sBAAsB,EAAER,OAAO,CAACT,QAAQ,CAAC;EACzCD,yBAAyB,EAAEW,UAAU,CAACV,QAAQ,CAAC;EAC/CkB,qBAAqB,EAAEP,MAAM,CAACX,QAAQ,CAAC;EACvCmB,wBAAwB,EAAEP,SAAS,CAACZ,QAAQ;AAC9C,CAAC,CAAC;AAAC"}
@@ -1,9 +1,10 @@
1
+ import { type AccessibilityState } from 'react-native';
1
2
  import type { ReactTestInstance } from 'react-test-renderer';
2
- import { TextMatch } from '../matches';
3
+ import type { TextMatch } from '../matches';
3
4
  import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
4
5
  declare type ByRoleOptions = {
5
6
  name?: TextMatch;
6
- };
7
+ } & AccessibilityState;
7
8
  export declare type ByRoleQueries = {
8
9
  getByRole: GetByQuery<TextMatch, ByRoleOptions>;
9
10
  getAllByRole: GetAllByQuery<TextMatch, ByRoleOptions>;