@testing-library/react-native 12.2.2 → 12.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/act.js +1 -2
- package/build/act.js.map +1 -1
- package/build/config.d.ts +2 -0
- package/build/config.js.map +1 -1
- package/build/fireEvent.js +3 -3
- package/build/fireEvent.js.map +1 -1
- package/build/helpers/accessiblity.d.ts +11 -0
- package/build/helpers/accessiblity.js +108 -8
- package/build/helpers/accessiblity.js.map +1 -1
- package/build/helpers/component-tree.d.ts +7 -0
- package/build/helpers/component-tree.js +18 -0
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/format-default.d.ts +1 -2
- package/build/helpers/format-default.js +22 -13
- package/build/helpers/format-default.js.map +1 -1
- package/build/helpers/format.js +4 -8
- package/build/helpers/format.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +10 -0
- package/build/helpers/host-component-names.js +27 -3
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/accessibilityState.js +3 -3
- package/build/helpers/matchers/accessibilityState.js.map +1 -1
- package/build/helpers/matchers/accessibilityValue.js +3 -2
- package/build/helpers/matchers/accessibilityValue.js.map +1 -1
- package/build/helpers/matchers/matchLabelText.d.ts +1 -1
- package/build/helpers/matchers/matchLabelText.js +5 -8
- package/build/helpers/matchers/matchLabelText.js.map +1 -1
- package/build/helpers/matchers/matchTextContent.js +2 -2
- package/build/helpers/matchers/matchTextContent.js.map +1 -1
- package/build/helpers/object.d.ts +1 -0
- package/build/helpers/object.js +16 -0
- package/build/helpers/object.js.map +1 -0
- package/build/helpers/{getTextContent.js → text-content.js} +1 -1
- package/build/helpers/text-content.js.map +1 -0
- package/build/helpers/text-input.d.ts +3 -0
- package/build/helpers/text-input.js +21 -0
- package/build/helpers/text-input.js.map +1 -0
- package/build/helpers/wrap-async.d.ts +7 -0
- package/build/helpers/wrap-async.js +45 -0
- package/build/helpers/wrap-async.js.map +1 -0
- package/build/matchers/extend-expect.d.js +2 -0
- package/build/matchers/extend-expect.d.js.map +1 -0
- package/build/matchers/extend-expect.d.ts +2 -0
- package/build/matchers/extend-expect.js +38 -0
- package/build/matchers/extend-expect.js.map +1 -0
- package/build/matchers/index.d.ts +15 -0
- package/build/matchers/index.js +117 -0
- package/build/matchers/index.js.map +1 -0
- package/build/matchers/to-be-busy.d.ts +6 -0
- package/build/matchers/to-be-busy.js +20 -0
- package/build/matchers/to-be-busy.js.map +1 -0
- package/build/matchers/to-be-checked.d.ts +6 -0
- package/build/matchers/to-be-checked.js +31 -0
- package/build/matchers/to-be-checked.js.map +1 -0
- package/build/matchers/to-be-collapsed.d.ts +6 -0
- package/build/matchers/to-be-collapsed.js +20 -0
- package/build/matchers/to-be-collapsed.js.map +1 -0
- package/build/matchers/to-be-disabled.d.ts +10 -0
- package/build/matchers/to-be-disabled.js +52 -0
- package/build/matchers/to-be-disabled.js.map +1 -0
- package/build/matchers/to-be-empty-element.d.ts +6 -0
- package/build/matchers/to-be-empty-element.js +20 -0
- package/build/matchers/to-be-empty-element.js.map +1 -0
- package/build/matchers/to-be-expanded.d.ts +6 -0
- package/build/matchers/to-be-expanded.js +20 -0
- package/build/matchers/to-be-expanded.js.map +1 -0
- package/build/matchers/to-be-on-the-screen.d.ts +6 -0
- package/build/matchers/to-be-on-the-screen.js +29 -0
- package/build/matchers/to-be-on-the-screen.js.map +1 -0
- package/build/matchers/to-be-partially-checked.d.ts +6 -0
- package/build/matchers/to-be-partially-checked.js +28 -0
- package/build/matchers/to-be-partially-checked.js.map +1 -0
- package/build/matchers/to-be-selected.d.ts +6 -0
- package/build/matchers/to-be-selected.js +20 -0
- package/build/matchers/to-be-selected.js.map +1 -0
- package/build/matchers/to-be-visible.d.ts +6 -0
- package/build/matchers/to-be-visible.js +56 -0
- package/build/matchers/to-be-visible.js.map +1 -0
- package/build/matchers/to-contain-element.d.ts +6 -0
- package/build/matchers/to-contain-element.js +26 -0
- package/build/matchers/to-contain-element.js.map +1 -0
- package/build/matchers/to-have-display-value.d.ts +7 -0
- package/build/matchers/to-have-display-value.js +26 -0
- package/build/matchers/to-have-display-value.js.map +1 -0
- package/build/matchers/to-have-prop.d.ts +6 -0
- package/build/matchers/to-have-prop.js +35 -0
- package/build/matchers/to-have-prop.js.map +1 -0
- package/build/matchers/to-have-style.d.ts +8 -0
- package/build/matchers/to-have-style.js +52 -0
- package/build/matchers/to-have-style.js.map +1 -0
- package/build/matchers/to-have-text-content.d.ts +7 -0
- package/build/matchers/to-have-text-content.js +21 -0
- package/build/matchers/to-have-text-content.js.map +1 -0
- package/build/matchers/utils.d.ts +18 -0
- package/build/matchers/utils.js +90 -0
- package/build/matchers/utils.js.map +1 -0
- package/build/matches.d.ts +1 -1
- package/build/matches.js.map +1 -1
- package/build/queries/displayValue.js +4 -3
- package/build/queries/displayValue.js.map +1 -1
- package/build/queries/labelText.js +2 -2
- package/build/queries/labelText.js.map +1 -1
- package/build/queries/role.js +1 -1
- package/build/queries/role.js.map +1 -1
- package/build/react-versions.js +2 -2
- package/build/react-versions.js.map +1 -1
- package/build/render.d.ts +12 -48
- package/build/render.js +5 -4
- package/build/render.js.map +1 -1
- package/build/screen.js +1 -2
- package/build/screen.js.map +1 -1
- package/build/shallow.js +2 -2
- package/build/shallow.js.map +1 -1
- package/build/test-utils/events.d.ts +1 -2
- package/build/test-utils/events.js.map +1 -1
- package/build/user-event/clear.js +2 -1
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/event-builder/common.js +1 -2
- package/build/user-event/event-builder/common.js.map +1 -1
- package/build/user-event/event-builder/index.d.ts +30 -0
- package/build/user-event/event-builder/index.js +3 -2
- package/build/user-event/event-builder/index.js.map +1 -1
- package/build/user-event/event-builder/scroll-view.d.ts +42 -0
- package/build/user-event/event-builder/scroll-view.js +52 -0
- package/build/user-event/event-builder/scroll-view.js.map +1 -0
- package/build/user-event/event-builder/text-input.js +1 -2
- package/build/user-event/event-builder/text-input.js.map +1 -1
- package/build/user-event/index.d.ts +2 -0
- package/build/user-event/index.js +3 -3
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/press/constants.js +2 -4
- package/build/user-event/press/constants.js.map +1 -1
- package/build/user-event/press/press.js +11 -14
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/scroll/index.d.ts +1 -0
- package/build/user-event/scroll/index.js +19 -0
- package/build/user-event/scroll/index.js.map +1 -0
- package/build/user-event/scroll/scrollTo.d.ts +16 -0
- package/build/user-event/scroll/scrollTo.js +82 -0
- package/build/user-event/scroll/scrollTo.js.map +1 -0
- package/build/user-event/scroll/state.d.ts +4 -0
- package/build/user-event/scroll/state.js +18 -0
- package/build/user-event/scroll/state.js.map +1 -0
- package/build/user-event/scroll/utils.d.ts +20 -0
- package/build/user-event/scroll/utils.js +68 -0
- package/build/user-event/scroll/utils.js.map +1 -0
- package/build/user-event/setup/setup.d.ts +8 -0
- package/build/user-event/setup/setup.js +34 -6
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.js +2 -1
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/index.d.ts +0 -1
- package/build/user-event/utils/index.js +0 -11
- package/build/user-event/utils/index.js.map +1 -1
- package/build/waitFor.js +2 -26
- package/build/waitFor.js.map +1 -1
- package/build/within.js +1 -2
- package/build/within.js.map +1 -1
- package/package.json +23 -37
- package/build/helpers/getTextContent.js.map +0 -1
- package/build/user-event/utils/host-components.d.ts +0 -2
- package/build/user-event/utils/host-components.js +0 -11
- package/build/user-event/utils/host-components.js.map +0 -1
- /package/build/helpers/{getTextContent.d.ts → text-content.d.ts} +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toHaveStyle = toHaveStyle;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _jestMatcherUtils = require("jest-matcher-utils");
|
|
9
|
+
var _utils = require("./utils");
|
|
10
|
+
function toHaveStyle(element, style) {
|
|
11
|
+
(0, _utils.checkHostElement)(element, toHaveStyle, this);
|
|
12
|
+
const expected = _reactNative.StyleSheet.flatten(style) ?? {};
|
|
13
|
+
const received = _reactNative.StyleSheet.flatten(element.props.style) ?? {};
|
|
14
|
+
const pass = Object.keys(expected).every(key => this.equals(expected[key], received[key]));
|
|
15
|
+
return {
|
|
16
|
+
pass,
|
|
17
|
+
message: () => {
|
|
18
|
+
const to = this.isNot ? 'not to' : 'to';
|
|
19
|
+
const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveStyle`, 'element', '');
|
|
20
|
+
if (pass) {
|
|
21
|
+
return (0, _utils.formatMessage)(matcher, `Expected element ${to} have style`, formatStyles(expected), 'Received', formatStyles(pickReceivedStyles(expected, received)));
|
|
22
|
+
} else {
|
|
23
|
+
return [matcher, '', expectedDiff(expected, received)].join('\n');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generate diff between `expected` and `received` styles.
|
|
31
|
+
*/
|
|
32
|
+
function expectedDiff(expected, received) {
|
|
33
|
+
const receivedNarrow = pickReceivedStyles(expected, received);
|
|
34
|
+
return (0, _jestMatcherUtils.diff)(formatStyles(expected), formatStyles(receivedNarrow));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Pick from `received` style only the keys present in `expected` style.
|
|
39
|
+
*/
|
|
40
|
+
function pickReceivedStyles(expected, received) {
|
|
41
|
+
const result = {};
|
|
42
|
+
Object.keys(received).forEach(key => {
|
|
43
|
+
if (expected[key] !== undefined) {
|
|
44
|
+
result[key] = received[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
function formatStyles(style) {
|
|
50
|
+
return Object.keys(style).sort().map(prop => Array.isArray(style[prop]) ? `${prop}: ${JSON.stringify(style[prop], null, 2)};` : `${prop}: ${style[prop]};`).join('\n');
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=to-have-style.js.map
|
|
@@ -0,0 +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.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n ImageStyle,\n StyleProp,\n StyleSheet,\n TextStyle,\n ViewStyle,\n} 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) =>\n this.equals(expected[key], received[key])\n );\n\n return {\n pass,\n message: () => {\n const to = this.isNot ? 'not to' : 'to';\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveStyle`,\n 'element',\n ''\n );\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;AAOA,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,IAC3C,IAAI,CAACC,MAAM,CAACV,QAAQ,CAACS,GAAG,CAAC,EAAEN,QAAQ,CAACM,GAAG,CAAC,CAC1C,CAAC;EAED,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,EACxB,GAAE,IAAI,CAACF,KAAK,GAAG,MAAM,GAAG,EAAG,cAAa,EACzC,SAAS,EACT,EACF,CAAC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AS,CAAClC,KAAK,CAAC8B,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAE,GAAE,GAClD,GAAEA,IAAK,KAAI9B,KAAK,CAAC8B,IAAI,CAAE,GAC9B,CAAC,CACAR,IAAI,CAAC,IAAI,CAAC;AACf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import type { ReactTestInstance } from 'react-test-renderer';
|
|
3
|
+
import { TextMatch, TextMatchOptions } from '../matches';
|
|
4
|
+
export declare function toHaveTextContent(this: jest.MatcherContext, element: ReactTestInstance, expectedText: TextMatch, options?: TextMatchOptions): {
|
|
5
|
+
pass: boolean;
|
|
6
|
+
message: () => string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toHaveTextContent = toHaveTextContent;
|
|
7
|
+
var _jestMatcherUtils = require("jest-matcher-utils");
|
|
8
|
+
var _textContent = require("../helpers/text-content");
|
|
9
|
+
var _matches = require("../matches");
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
function toHaveTextContent(element, expectedText, options) {
|
|
12
|
+
(0, _utils.checkHostElement)(element, toHaveTextContent, this);
|
|
13
|
+
const text = (0, _textContent.getTextContent)(element);
|
|
14
|
+
return {
|
|
15
|
+
pass: (0, _matches.matches)(expectedText, text, options?.normalizer, options?.exact),
|
|
16
|
+
message: () => {
|
|
17
|
+
return [(0, _utils.formatMessage)((0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveTextContent`, 'element', ''), `Expected element ${this.isNot ? 'not to' : 'to'} have text content`, expectedText, 'Received', text)].join('\n');
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=to-have-text-content.js.map
|
|
@@ -0,0 +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.tsx"],"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(\n `${this.isNot ? '.not' : ''}.toHaveTextContent`,\n 'element',\n ''\n ),\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,EACR,GAAE,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAG,oBAAmB,EAC/C,SAAS,EACT,EACF,CAAC,EACA,oBAAmB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAK,oBAAmB,EACpEZ,YAAY,EACZ,UAAU,EACVG,IACF,CAAC,CACF,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { ReactTestInstance } from 'react-test-renderer';
|
|
3
|
+
/**
|
|
4
|
+
* Throws HostElementTypeError if passed element is not a host element.
|
|
5
|
+
*
|
|
6
|
+
* @param element ReactTestInstance to check.
|
|
7
|
+
* @param matcherFn Matcher function calling the check used for formatting error.
|
|
8
|
+
* @param context Jest matcher context used for formatting error.
|
|
9
|
+
*/
|
|
10
|
+
export declare function checkHostElement(element: ReactTestInstance | null | undefined, matcherFn: jest.CustomMatcher, context: jest.MatcherContext): asserts element is ReactTestInstance;
|
|
11
|
+
/***
|
|
12
|
+
* Format given element as a pretty-printed string.
|
|
13
|
+
*
|
|
14
|
+
* @param element Element to format.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatElement(element: ReactTestInstance | null): string;
|
|
17
|
+
export declare function formatElementArray(elements: ReactTestInstance[]): string;
|
|
18
|
+
export declare function formatMessage(matcher: string, expectedLabel: string, expectedValue: string | RegExp, receivedLabel: string, receivedValue: string | null | undefined): string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkHostElement = checkHostElement;
|
|
7
|
+
exports.formatElement = formatElement;
|
|
8
|
+
exports.formatElementArray = formatElementArray;
|
|
9
|
+
exports.formatMessage = formatMessage;
|
|
10
|
+
var _jestMatcherUtils = require("jest-matcher-utils");
|
|
11
|
+
var _prettyFormat = _interopRequireWildcard(require("pretty-format"));
|
|
12
|
+
var _redent = _interopRequireDefault(require("redent"));
|
|
13
|
+
var _componentTree = require("../helpers/component-tree");
|
|
14
|
+
var _formatDefault = require("../helpers/format-default");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
class HostElementTypeError extends Error {
|
|
19
|
+
constructor(received, matcherFn, context) {
|
|
20
|
+
super();
|
|
21
|
+
|
|
22
|
+
/* istanbul ignore next */
|
|
23
|
+
if (Error.captureStackTrace) {
|
|
24
|
+
Error.captureStackTrace(this, matcherFn);
|
|
25
|
+
}
|
|
26
|
+
let withType = '';
|
|
27
|
+
try {
|
|
28
|
+
withType = (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived);
|
|
29
|
+
/* istanbul ignore next */
|
|
30
|
+
} catch (e) {
|
|
31
|
+
// Deliberately empty.
|
|
32
|
+
}
|
|
33
|
+
this.message = [(0, _jestMatcherUtils.matcherHint)(`${context.isNot ? '.not' : ''}.${matcherFn.name}`, 'received', ''), '', `${(0, _jestMatcherUtils.RECEIVED_COLOR)('received')} value must be a host element.`, withType].join('\n');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Throws HostElementTypeError if passed element is not a host element.
|
|
39
|
+
*
|
|
40
|
+
* @param element ReactTestInstance to check.
|
|
41
|
+
* @param matcherFn Matcher function calling the check used for formatting error.
|
|
42
|
+
* @param context Jest matcher context used for formatting error.
|
|
43
|
+
*/
|
|
44
|
+
function checkHostElement(element, matcherFn, context) {
|
|
45
|
+
if (!(0, _componentTree.isHostElement)(element)) {
|
|
46
|
+
throw new HostElementTypeError(element, matcherFn, context);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/***
|
|
51
|
+
* Format given element as a pretty-printed string.
|
|
52
|
+
*
|
|
53
|
+
* @param element Element to format.
|
|
54
|
+
*/
|
|
55
|
+
function formatElement(element) {
|
|
56
|
+
if (element == null) {
|
|
57
|
+
return ' null';
|
|
58
|
+
}
|
|
59
|
+
const {
|
|
60
|
+
children,
|
|
61
|
+
...props
|
|
62
|
+
} = element.props;
|
|
63
|
+
const childrenToDisplay = typeof children === 'string' ? [children] : undefined;
|
|
64
|
+
return (0, _redent.default)((0, _prettyFormat.default)({
|
|
65
|
+
// This prop is needed persuade the prettyFormat that the element is
|
|
66
|
+
// a ReactTestRendererJSON instance, so it is formatted as JSX.
|
|
67
|
+
$$typeof: Symbol.for('react.test.json'),
|
|
68
|
+
type: element.type,
|
|
69
|
+
props: (0, _formatDefault.defaultMapProps)(props),
|
|
70
|
+
children: childrenToDisplay
|
|
71
|
+
}, {
|
|
72
|
+
plugins: [_prettyFormat.plugins.ReactTestComponent, _prettyFormat.plugins.ReactElement],
|
|
73
|
+
printFunctionName: false,
|
|
74
|
+
printBasicPrototype: false,
|
|
75
|
+
highlight: true
|
|
76
|
+
}), 2);
|
|
77
|
+
}
|
|
78
|
+
function formatElementArray(elements) {
|
|
79
|
+
if (elements.length === 0) {
|
|
80
|
+
return ' (no elements)';
|
|
81
|
+
}
|
|
82
|
+
return (0, _redent.default)(elements.map(formatElement).join('\n'), 2);
|
|
83
|
+
}
|
|
84
|
+
function formatMessage(matcher, expectedLabel, expectedValue, receivedLabel, receivedValue) {
|
|
85
|
+
return [`${matcher}\n`, `${expectedLabel}:\n${(0, _jestMatcherUtils.EXPECTED_COLOR)((0, _redent.default)(formatValue(expectedValue), 2))}`, `${receivedLabel}:\n${(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _redent.default)(formatValue(receivedValue), 2))}`].join('\n');
|
|
86
|
+
}
|
|
87
|
+
function formatValue(value) {
|
|
88
|
+
return typeof value === 'string' ? value : (0, _jestMatcherUtils.stringify)(value);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_jestMatcherUtils","require","_prettyFormat","_interopRequireWildcard","_redent","_interopRequireDefault","_componentTree","_formatDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","HostElementTypeError","Error","constructor","received","matcherFn","context","captureStackTrace","withType","printWithType","printReceived","message","matcherHint","isNot","name","RECEIVED_COLOR","join","checkHostElement","element","isHostElement","formatElement","children","props","childrenToDisplay","undefined","redent","prettyFormat","$$typeof","Symbol","for","type","defaultMapProps","plugins","ReactTestComponent","ReactElement","printFunctionName","printBasicPrototype","highlight","formatElementArray","elements","length","map","formatMessage","matcher","expectedLabel","expectedValue","receivedLabel","receivedValue","EXPECTED_COLOR","formatValue","value","stringify"],"sources":["../../src/matchers/utils.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport {\n EXPECTED_COLOR,\n RECEIVED_COLOR,\n matcherHint,\n printWithType,\n printReceived,\n stringify,\n} from 'jest-matcher-utils';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport redent from 'redent';\nimport { isHostElement } from '../helpers/component-tree';\nimport { defaultMapProps } from '../helpers/format-default';\n\nclass HostElementTypeError extends Error {\n constructor(\n received: unknown,\n matcherFn: jest.CustomMatcher,\n context: jest.MatcherContext\n ) {\n super();\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, matcherFn);\n }\n\n let withType = '';\n try {\n withType = printWithType('Received', received, printReceived);\n /* istanbul ignore next */\n } catch (e) {\n // Deliberately empty.\n }\n\n this.message = [\n matcherHint(\n `${context.isNot ? '.not' : ''}.${matcherFn.name}`,\n 'received',\n ''\n ),\n '',\n `${RECEIVED_COLOR('received')} value must be a host element.`,\n withType,\n ].join('\\n');\n }\n}\n\n/**\n * Throws HostElementTypeError if passed element is not a host element.\n *\n * @param element ReactTestInstance to check.\n * @param matcherFn Matcher function calling the check used for formatting error.\n * @param context Jest matcher context used for formatting error.\n */\nexport function checkHostElement(\n element: ReactTestInstance | null | undefined,\n matcherFn: jest.CustomMatcher,\n context: jest.MatcherContext\n): asserts element is ReactTestInstance {\n if (!isHostElement(element)) {\n throw new HostElementTypeError(element, matcherFn, context);\n }\n}\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(element: ReactTestInstance | null) {\n if (element == null) {\n return ' null';\n }\n\n const { children, ...props } = element.props;\n const childrenToDisplay =\n typeof children === 'string' ? [children] : undefined;\n\n return redent(\n prettyFormat(\n {\n // This prop is needed persuade the prettyFormat that the element is\n // a ReactTestRendererJSON instance, so it is formatted as JSX.\n $$typeof: Symbol.for('react.test.json'),\n type: element.type,\n props: defaultMapProps(props),\n children: childrenToDisplay,\n },\n {\n plugins: [plugins.ReactTestComponent, plugins.ReactElement],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: true,\n }\n ),\n 2\n );\n}\n\nexport function formatElementArray(elements: ReactTestInstance[]) {\n if (elements.length === 0) {\n return ' (no elements)';\n }\n\n return redent(elements.map(formatElement).join('\\n'), 2);\n}\n\nexport function formatMessage(\n matcher: string,\n expectedLabel: string,\n expectedValue: string | RegExp,\n receivedLabel: string,\n receivedValue: string | null | undefined\n) {\n return [\n `${matcher}\\n`,\n `${expectedLabel}:\\n${EXPECTED_COLOR(\n redent(formatValue(expectedValue), 2)\n )}`,\n `${receivedLabel}:\\n${RECEIVED_COLOR(\n redent(formatValue(receivedValue), 2)\n )}`,\n ].join('\\n');\n}\n\nfunction formatValue(value: unknown) {\n return typeof value === 'string' ? value : stringify(value);\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAQA,IAAAC,aAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA4D,SAAAI,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAZ,CAAA,oBAAAY,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAf,C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AAO,CACJ,GAAEJ,OAAQ,IAAG,EACb,GAAEC,aAAc,MAAK,IAAAI,gCAAc,EAClC,IAAAvB,eAAM,EAACwB,WAAW,CAACJ,aAAa,CAAC,EAAE,CAAC,CACtC,CAAE,EAAC,EACF,GAAEC,aAAc,MAAK,IAAA/B,gCAAc,EAClC,IAAAU,eAAM,EAACwB,WAAW,CAACF,aAAa,CAAC,EAAE,CAAC,CACtC,CAAE,EAAC,CACJ,CAAC/B,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASiC,WAAWA,CAACC,KAAc,EAAE;EACnC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,IAAAC,2BAAS,EAACD,KAAK,CAAC;AAC7D"}
|
package/build/matches.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type TextMatchOptions = {
|
|
|
4
4
|
exact?: boolean;
|
|
5
5
|
normalizer?: NormalizerFn;
|
|
6
6
|
};
|
|
7
|
-
export declare function matches(matcher: TextMatch, text: string, normalizer?: NormalizerFn, exact?: boolean): boolean;
|
|
7
|
+
export declare function matches(matcher: TextMatch, text: string | undefined, normalizer?: NormalizerFn, exact?: boolean): boolean;
|
|
8
8
|
type NormalizerConfig = {
|
|
9
9
|
trim?: boolean;
|
|
10
10
|
collapseWhitespace?: boolean;
|
package/build/matches.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matches.js","names":["matches","matcher","text","normalizer","getDefaultNormalizer","exact","normalizedText","normalizedMatcher","toLowerCase","includes","lastIndex","test","trim","collapseWhitespace","replace"],"sources":["../src/matches.ts"],"sourcesContent":["export type NormalizerFn = (textToNormalize: string) => string;\n\nexport type TextMatch = string | RegExp;\nexport type TextMatchOptions = {\n exact?: boolean;\n normalizer?: NormalizerFn;\n};\n\nexport function matches(\n matcher: TextMatch,\n text: string,\n normalizer: NormalizerFn = getDefaultNormalizer(),\n exact: boolean = true\n): boolean {\n if (typeof text !== 'string') {\n return false;\n }\n\n const normalizedText = normalizer(text);\n if (typeof matcher === 'string') {\n const normalizedMatcher = normalizer(matcher);\n return exact\n ? normalizedText === normalizedMatcher\n : normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());\n } else {\n // Reset state for global regexes: https://stackoverflow.com/a/1520839/484499\n matcher.lastIndex = 0;\n return matcher.test(normalizedText);\n }\n}\n\ntype NormalizerConfig = {\n trim?: boolean;\n collapseWhitespace?: boolean;\n};\n\nexport function getDefaultNormalizer({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerConfig = {}): NormalizerFn {\n return (text: string) => {\n let normalizedText = text;\n normalizedText = trim ? normalizedText.trim() : normalizedText;\n normalizedText = collapseWhitespace\n ? normalizedText.replace(/\\s+/g, ' ')\n : normalizedText;\n return normalizedText;\n };\n}\n"],"mappings":";;;;;;;AAQO,SAASA,OAAOA,CACrBC,OAAkB,EAClBC,
|
|
1
|
+
{"version":3,"file":"matches.js","names":["matches","matcher","text","normalizer","getDefaultNormalizer","exact","normalizedText","normalizedMatcher","toLowerCase","includes","lastIndex","test","trim","collapseWhitespace","replace"],"sources":["../src/matches.ts"],"sourcesContent":["export type NormalizerFn = (textToNormalize: string) => string;\n\nexport type TextMatch = string | RegExp;\nexport type TextMatchOptions = {\n exact?: boolean;\n normalizer?: NormalizerFn;\n};\n\nexport function matches(\n matcher: TextMatch,\n text: string | undefined,\n normalizer: NormalizerFn = getDefaultNormalizer(),\n exact: boolean = true\n): boolean {\n if (typeof text !== 'string') {\n return false;\n }\n\n const normalizedText = normalizer(text);\n if (typeof matcher === 'string') {\n const normalizedMatcher = normalizer(matcher);\n return exact\n ? normalizedText === normalizedMatcher\n : normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());\n } else {\n // Reset state for global regexes: https://stackoverflow.com/a/1520839/484499\n matcher.lastIndex = 0;\n return matcher.test(normalizedText);\n }\n}\n\ntype NormalizerConfig = {\n trim?: boolean;\n collapseWhitespace?: boolean;\n};\n\nexport function getDefaultNormalizer({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerConfig = {}): NormalizerFn {\n return (text: string) => {\n let normalizedText = text;\n normalizedText = trim ? normalizedText.trim() : normalizedText;\n normalizedText = collapseWhitespace\n ? normalizedText.replace(/\\s+/g, ' ')\n : normalizedText;\n return normalizedText;\n };\n}\n"],"mappings":";;;;;;;AAQO,SAASA,OAAOA,CACrBC,OAAkB,EAClBC,IAAwB,EACxBC,UAAwB,GAAGC,oBAAoB,CAAC,CAAC,EACjDC,KAAc,GAAG,IAAI,EACZ;EACT,IAAI,OAAOH,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,KAAK;EACd;EAEA,MAAMI,cAAc,GAAGH,UAAU,CAACD,IAAI,CAAC;EACvC,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAMM,iBAAiB,GAAGJ,UAAU,CAACF,OAAO,CAAC;IAC7C,OAAOI,KAAK,GACRC,cAAc,KAAKC,iBAAiB,GACpCD,cAAc,CAACE,WAAW,CAAC,CAAC,CAACC,QAAQ,CAACF,iBAAiB,CAACC,WAAW,CAAC,CAAC,CAAC;EAC5E,CAAC,MAAM;IACL;IACAP,OAAO,CAACS,SAAS,GAAG,CAAC;IACrB,OAAOT,OAAO,CAACU,IAAI,CAACL,cAAc,CAAC;EACrC;AACF;AAOO,SAASF,oBAAoBA,CAAC;EACnCQ,IAAI,GAAG,IAAI;EACXC,kBAAkB,GAAG;AACL,CAAC,GAAG,CAAC,CAAC,EAAgB;EACtC,OAAQX,IAAY,IAAK;IACvB,IAAII,cAAc,GAAGJ,IAAI;IACzBI,cAAc,GAAGM,IAAI,GAAGN,cAAc,CAACM,IAAI,CAAC,CAAC,GAAGN,cAAc;IAC9DA,cAAc,GAAGO,kBAAkB,GAC/BP,cAAc,CAACQ,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,GACnCR,cAAc;IAClB,OAAOA,cAAc;EACvB,CAAC;AACH"}
|
|
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.bindByDisplayValueQueries = void 0;
|
|
7
7
|
var _findAll = require("../helpers/findAll");
|
|
8
8
|
var _hostComponentNames = require("../helpers/host-component-names");
|
|
9
|
+
var _textInput = require("../helpers/text-input");
|
|
9
10
|
var _matches = require("../matches");
|
|
10
11
|
var _makeQueries = require("./makeQueries");
|
|
11
|
-
const matchDisplayValue = (node,
|
|
12
|
+
const matchDisplayValue = (node, expectedValue, options = {}) => {
|
|
12
13
|
const {
|
|
13
14
|
exact,
|
|
14
15
|
normalizer
|
|
15
16
|
} = options;
|
|
16
|
-
const nodeValue =
|
|
17
|
-
return (0, _matches.matches)(
|
|
17
|
+
const nodeValue = (0, _textInput.getTextInputValue)(node);
|
|
18
|
+
return (0, _matches.matches)(expectedValue, nodeValue, normalizer, exact);
|
|
18
19
|
};
|
|
19
20
|
const queryAllByDisplayValue = instance => function queryAllByDisplayValueFn(displayValue, queryOptions) {
|
|
20
21
|
return (0, _findAll.findAll)(instance, node => (0, _hostComponentNames.isHostTextInput)(node) && matchDisplayValue(node, displayValue, queryOptions), queryOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayValue.js","names":["_findAll","require","_hostComponentNames","_matches","_makeQueries","matchDisplayValue","node","
|
|
1
|
+
{"version":3,"file":"displayValue.js","names":["_findAll","require","_hostComponentNames","_textInput","_matches","_makeQueries","matchDisplayValue","node","expectedValue","options","exact","normalizer","nodeValue","getTextInputValue","matches","queryAllByDisplayValue","instance","queryAllByDisplayValueFn","displayValue","queryOptions","findAll","isHostTextInput","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByDisplayValueQueries","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","findByDisplayValue","findAllByDisplayValue","exports"],"sources":["../../src/queries/displayValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { getTextInputValue } from '../helpers/text-input';\nimport { matches, TextMatch, TextMatchOptions } 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 { CommonQueryOptions } from './options';\n\ntype ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchDisplayValue = (\n node: ReactTestInstance,\n expectedValue: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n const nodeValue = getTextInputValue(node);\n return matches(expectedValue, nodeValue, normalizer, exact);\n};\n\nconst queryAllByDisplayValue = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByDisplayValueOptions> =>\n function queryAllByDisplayValueFn(displayValue, queryOptions) {\n return findAll(\n instance,\n (node) =>\n isHostTextInput(node) &&\n matchDisplayValue(node, displayValue, queryOptions),\n 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, ByDisplayValueOptions>;\n getAllByDisplayValue: GetAllByQuery<TextMatch, ByDisplayValueOptions>;\n queryByDisplayValue: QueryByQuery<TextMatch, ByDisplayValueOptions>;\n queryAllByDisplayValue: QueryAllByQuery<TextMatch, ByDisplayValueOptions>;\n findByDisplayValue: FindByQuery<TextMatch, ByDisplayValueOptions>;\n findAllByDisplayValue: FindAllByQuery<TextMatch, ByDisplayValueOptions>;\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,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAaA,MAAMK,iBAAiB,GAAGA,CACxBC,IAAuB,EACvBC,aAAwB,EACxBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,MAAMG,SAAS,GAAG,IAAAC,4BAAiB,EAACN,IAAI,CAAC;EACzC,OAAO,IAAAO,gBAAO,EAACN,aAAa,EAAEI,SAAS,EAAED,UAAU,EAAED,KAAK,CAAC;AAC7D,CAAC;AAED,MAAMK,sBAAsB,GAC1BC,QAA2B,IAE3B,SAASC,wBAAwBA,CAACC,YAAY,EAAEC,YAAY,EAAE;EAC5D,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPT,IAAI,IACH,IAAAc,mCAAe,EAACd,IAAI,CAAC,IACrBD,iBAAiB,CAACC,IAAI,EAAEW,YAAY,EAAEC,YAAY,CAAC,EACrDA,YACF,CAAC;AACH,CAAC;AAEH,MAAMG,gBAAgB,GAAIJ,YAAuB,IAC9C,+CAA8CK,MAAM,CAACL,YAAY,CAAE,GAAE;AACxE,MAAMM,eAAe,GAAIN,YAAuB,IAC7C,gDAA+CK,MAAM,CAACL,YAAY,CAAE,EAAC;AAExE,MAAM;EAAEO,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EhB,sBAAsB,EACtBS,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,yBAAyB,GACpChB,QAA2B,KACA;EAC3BiB,iBAAiB,EAAER,KAAK,CAACT,QAAQ,CAAC;EAClCkB,oBAAoB,EAAER,QAAQ,CAACV,QAAQ,CAAC;EACxCmB,mBAAmB,EAAER,OAAO,CAACX,QAAQ,CAAC;EACtCD,sBAAsB,EAAEa,UAAU,CAACZ,QAAQ,CAAC;EAC5CoB,kBAAkB,EAAEP,MAAM,CAACb,QAAQ,CAAC;EACpCqB,qBAAqB,EAAEP,SAAS,CAACd,QAAQ;AAC3C,CAAC,CAAC;AAACsB,OAAA,CAAAN,yBAAA,GAAAA,yBAAA"}
|
|
@@ -12,8 +12,8 @@ function queryAllByLabelText(instance) {
|
|
|
12
12
|
return (0, _findAll.findAll)(instance, node => (0, _matchLabelText.matchLabelText)(instance, node, text, queryOptions), queryOptions);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
const getMultipleError = labelText => `Found multiple elements with
|
|
16
|
-
const getMissingError = labelText => `Unable to find an element with
|
|
15
|
+
const getMultipleError = labelText => `Found multiple elements with accessibility label: ${String(labelText)} `;
|
|
16
|
+
const getMissingError = labelText => `Unable to find an element with accessibility label: ${String(labelText)}`;
|
|
17
17
|
const {
|
|
18
18
|
getBy,
|
|
19
19
|
getAllBy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelText.js","names":["_findAll","require","_matchLabelText","_makeQueries","queryAllByLabelText","instance","text","queryOptions","findAll","node","matchLabelText","getMultipleError","labelText","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByLabelTextQueries","getByLabelText","getAllByLabelText","queryByLabelText","findByLabelText","findAllByLabelText","exports"],"sources":["../../src/queries/labelText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { matchLabelText } from '../helpers/matchers/matchLabelText';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;\n\nfunction queryAllByLabelText(instance: ReactTestInstance) {\n return (text: TextMatch, queryOptions?: ByLabelTextOptions) => {\n return findAll(\n instance,\n (node) => matchLabelText(instance, node, text, queryOptions),\n queryOptions\n );\n };\n}\n\nconst getMultipleError = (labelText: TextMatch) =>\n `Found multiple elements with
|
|
1
|
+
{"version":3,"file":"labelText.js","names":["_findAll","require","_matchLabelText","_makeQueries","queryAllByLabelText","instance","text","queryOptions","findAll","node","matchLabelText","getMultipleError","labelText","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByLabelTextQueries","getByLabelText","getAllByLabelText","queryByLabelText","findByLabelText","findAllByLabelText","exports"],"sources":["../../src/queries/labelText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { matchLabelText } from '../helpers/matchers/matchLabelText';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;\n\nfunction queryAllByLabelText(instance: ReactTestInstance) {\n return (text: TextMatch, queryOptions?: ByLabelTextOptions) => {\n return findAll(\n instance,\n (node) => matchLabelText(instance, node, text, queryOptions),\n queryOptions\n );\n };\n}\n\nconst getMultipleError = (labelText: TextMatch) =>\n `Found multiple elements with accessibility label: ${String(labelText)} `;\nconst getMissingError = (labelText: TextMatch) =>\n `Unable to find an element with accessibility label: ${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, ByLabelTextOptions>;\n getAllByLabelText: GetAllByQuery<TextMatch, ByLabelTextOptions>;\n queryByLabelText: QueryByQuery<TextMatch, ByLabelTextOptions>;\n queryAllByLabelText: QueryAllByQuery<TextMatch, ByLabelTextOptions>;\n findByLabelText: FindByQuery<TextMatch, ByLabelTextOptions>;\n findAllByLabelText: FindAllByQuery<TextMatch, ByLabelTextOptions>;\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,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAaA,SAASG,mBAAmBA,CAACC,QAA2B,EAAE;EACxD,OAAO,CAACC,IAAe,EAAEC,YAAiC,KAAK;IAC7D,OAAO,IAAAC,gBAAO,EACZH,QAAQ,EACPI,IAAI,IAAK,IAAAC,8BAAc,EAACL,QAAQ,EAAEI,IAAI,EAAEH,IAAI,EAAEC,YAAY,CAAC,EAC5DA,YACF,CAAC;EACH,CAAC;AACH;AAEA,MAAMI,gBAAgB,GAAIC,SAAoB,IAC3C,qDAAoDC,MAAM,CAACD,SAAS,CAAE,GAAE;AAC3E,MAAME,eAAe,GAAIF,SAAoB,IAC1C,uDAAsDC,MAAM,CAACD,SAAS,CAAE,EAAC;AAE5E,MAAM;EAAEG,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EjB,mBAAmB,EACnBU,eAAe,EACfH,gBACF,CAAC;AAWM,MAAMW,sBAAsB,GACjCjB,QAA2B,KACH;EACxBkB,cAAc,EAAER,KAAK,CAACV,QAAQ,CAAC;EAC/BmB,iBAAiB,EAAER,QAAQ,CAACX,QAAQ,CAAC;EACrCoB,gBAAgB,EAAER,OAAO,CAACZ,QAAQ,CAAC;EACnCD,mBAAmB,EAAEc,UAAU,CAACb,QAAQ,CAAC;EACzCqB,eAAe,EAAEP,MAAM,CAACd,QAAQ,CAAC;EACjCsB,kBAAkB,EAAEP,SAAS,CAACf,QAAQ;AACxC,CAAC,CAAC;AAACuB,OAAA,CAAAN,sBAAA,GAAAA,sBAAA"}
|
package/build/queries/role.js
CHANGED
|
@@ -28,7 +28,7 @@ const matchAccessibilityValueIfNeeded = (node, value) => {
|
|
|
28
28
|
const queryAllByRole = instance => function queryAllByRoleFn(role, options) {
|
|
29
29
|
return (0, _findAll.findAll)(instance, node =>
|
|
30
30
|
// run the cheapest checks first, and early exit to avoid unneeded computations
|
|
31
|
-
(0, _accessiblity.isAccessibilityElement)(node) && (0, _matchStringProp.matchStringProp)(node
|
|
31
|
+
(0, _accessiblity.isAccessibilityElement)(node) && (0, _matchStringProp.matchStringProp)((0, _accessiblity.getAccessibilityRole)(node), role) && matchAccessibleStateIfNeeded(node, options) && matchAccessibilityValueIfNeeded(node, options?.value) && matchAccessibleNameIfNeeded(node, options?.name), options);
|
|
32
32
|
};
|
|
33
33
|
const formatQueryParams = (role, options = {}) => {
|
|
34
34
|
const params = [`role: "${String(role)}"`];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.js","names":["_accessiblity","require","_findAll","_accessibilityState","_accessibilityValue","_matchStringProp","_within","_makeQueries","matchAccessibleNameIfNeeded","node","name","queryAllByText","queryAllByLabelText","getQueriesForElement","length","matchAccessibleStateIfNeeded","options","matchAccessibilityState","matchAccessibilityValueIfNeeded","value","matchAccessibilityValue","queryAllByRole","instance","queryAllByRoleFn","role","findAll","isAccessibilityElement","matchStringProp","
|
|
1
|
+
{"version":3,"file":"role.js","names":["_accessiblity","require","_findAll","_accessibilityState","_accessibilityValue","_matchStringProp","_within","_makeQueries","matchAccessibleNameIfNeeded","node","name","queryAllByText","queryAllByLabelText","getQueriesForElement","length","matchAccessibleStateIfNeeded","options","matchAccessibilityState","matchAccessibilityValueIfNeeded","value","matchAccessibilityValue","queryAllByRole","instance","queryAllByRoleFn","role","findAll","isAccessibilityElement","matchStringProp","getAccessibilityRole","formatQueryParams","params","String","push","accessibilityStateKeys","forEach","stateKey","undefined","accessiblityValueKeys","valueKey","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByRoleQueries","getByRole","getAllByRole","queryByRole","findByRole","findAllByRole","exports"],"sources":["../../src/queries/role.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n accessibilityStateKeys,\n accessiblityValueKeys,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessiblity';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/accessibilityValue';\nimport { matchStringProp } from '../helpers/matchers/matchStringProp';\nimport type { TextMatch } from '../matches';\nimport { getQueriesForElement } from '../within';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByRoleOptions = CommonQueryOptions &\n AccessibilityStateMatcher & {\n name?: TextMatch;\n value?: AccessibilityValueMatcher;\n };\n\nconst matchAccessibleNameIfNeeded = (\n node: ReactTestInstance,\n name?: TextMatch\n) => {\n if (name == null) return true;\n\n const { queryAllByText, queryAllByLabelText } = getQueriesForElement(node);\n return (\n queryAllByText(name).length > 0 || queryAllByLabelText(name).length > 0\n );\n};\n\nconst matchAccessibleStateIfNeeded = (\n node: ReactTestInstance,\n options?: ByRoleOptions\n) => {\n return options != null ? matchAccessibilityState(node, options) : true;\n};\n\nconst matchAccessibilityValueIfNeeded = (\n node: ReactTestInstance,\n value?: AccessibilityValueMatcher\n) => {\n return value != null ? matchAccessibilityValue(node, value) : true;\n};\n\nconst queryAllByRole = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByRoleOptions> =>\n function queryAllByRoleFn(role, options) {\n return findAll(\n instance,\n (node) =>\n // run the cheapest checks first, and early exit to avoid unneeded computations\n isAccessibilityElement(node) &&\n matchStringProp(getAccessibilityRole(node), role) &&\n matchAccessibleStateIfNeeded(node, options) &&\n matchAccessibilityValueIfNeeded(node, options?.value) &&\n matchAccessibleNameIfNeeded(node, options?.name),\n options\n );\n };\n\nconst formatQueryParams = (role: TextMatch, options: ByRoleOptions = {}) => {\n const params = [`role: \"${String(role)}\"`];\n\n if (options.name) {\n params.push(`name: \"${String(options.name)}\"`);\n }\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (options[stateKey] !== undefined) {\n params.push(`${stateKey} state: ${options[stateKey]}`);\n }\n });\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (options?.value?.[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${options?.value?.[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (role: TextMatch, options?: ByRoleOptions) =>\n `Found multiple elements with ${formatQueryParams(role, options)}`;\n\nconst getMissingError = (role: TextMatch, options?: ByRoleOptions) =>\n `Unable to find an element with ${formatQueryParams(role, options)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByRole,\n getMissingError,\n getMultipleError\n);\n\nexport type ByRoleQueries = {\n getByRole: GetByQuery<TextMatch, ByRoleOptions>;\n getAllByRole: GetAllByQuery<TextMatch, ByRoleOptions>;\n queryByRole: QueryByQuery<TextMatch, ByRoleOptions>;\n queryAllByRole: QueryAllByQuery<TextMatch, ByRoleOptions>;\n findByRole: FindByQuery<TextMatch, ByRoleOptions>;\n findAllByRole: FindAllByQuery<TextMatch, ByRoleOptions>;\n};\n\nexport const bindByRoleQueries = (\n instance: ReactTestInstance\n): ByRoleQueries => ({\n getByRole: getBy(instance),\n getAllByRole: getAllBy(instance),\n queryByRole: queryBy(instance),\n queryAllByRole: queryAllBy(instance),\n findByRole: findBy(instance),\n findAllByRole: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAIA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAiBA,MAAMO,2BAA2B,GAAGA,CAClCC,IAAuB,EACvBC,IAAgB,KACb;EACH,IAAIA,IAAI,IAAI,IAAI,EAAE,OAAO,IAAI;EAE7B,MAAM;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAAG,IAAAC,4BAAoB,EAACJ,IAAI,CAAC;EAC1E,OACEE,cAAc,CAACD,IAAI,CAAC,CAACI,MAAM,GAAG,CAAC,IAAIF,mBAAmB,CAACF,IAAI,CAAC,CAACI,MAAM,GAAG,CAAC;AAE3E,CAAC;AAED,MAAMC,4BAA4B,GAAGA,CACnCN,IAAuB,EACvBO,OAAuB,KACpB;EACH,OAAOA,OAAO,IAAI,IAAI,GAAG,IAAAC,2CAAuB,EAACR,IAAI,EAAEO,OAAO,CAAC,GAAG,IAAI;AACxE,CAAC;AAED,MAAME,+BAA+B,GAAGA,CACtCT,IAAuB,EACvBU,KAAiC,KAC9B;EACH,OAAOA,KAAK,IAAI,IAAI,GAAG,IAAAC,2CAAuB,EAACX,IAAI,EAAEU,KAAK,CAAC,GAAG,IAAI;AACpE,CAAC;AAED,MAAME,cAAc,GAClBC,QAA2B,IAE3B,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;AAC1B,CAAC;AAED,MAAMC,gBAAgB,GAAGA,CAAChB,IAAe,EAAER,OAAuB,KAC/D,gCAA+Ba,iBAAiB,CAACL,IAAI,EAAER,OAAO,CAAE,EAAC;AAEpE,MAAMyB,eAAe,GAAGA,CAACjB,IAAe,EAAER,OAAuB,KAC9D,kCAAiCa,iBAAiB,CAACL,IAAI,EAAER,OAAO,CAAE,EAAC;AAEtE,MAAM;EAAE0B,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7E3B,cAAc,EACdoB,eAAe,EACfD,gBACF,CAAC;AAWM,MAAMS,iBAAiB,GAC5B3B,QAA2B,KACR;EACnB4B,SAAS,EAAER,KAAK,CAACpB,QAAQ,CAAC;EAC1B6B,YAAY,EAAER,QAAQ,CAACrB,QAAQ,CAAC;EAChC8B,WAAW,EAAER,OAAO,CAACtB,QAAQ,CAAC;EAC9BD,cAAc,EAAEwB,UAAU,CAACvB,QAAQ,CAAC;EACpC+B,UAAU,EAAEP,MAAM,CAACxB,QAAQ,CAAC;EAC5BgC,aAAa,EAAEP,SAAS,CAACzB,QAAQ;AACnC,CAAC,CAAC;AAACiC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA"}
|
package/build/react-versions.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.checkReactVersionAtLeast = checkReactVersionAtLeast;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
function _getRequireWildcardCache(
|
|
9
|
-
function _interopRequireWildcard(
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
function checkReactVersionAtLeast(major, minor) {
|
|
11
11
|
if (React.version === undefined) return false;
|
|
12
12
|
const [actualMajor, actualMinor] = React.version.split('.').map(Number);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-versions.js","names":["React","_interopRequireWildcard","require","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"file":"react-versions.js","names":["React","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","checkReactVersionAtLeast","major","minor","version","undefined","actualMajor","actualMinor","split","map","Number"],"sources":["../src/react-versions.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function checkReactVersionAtLeast(\n major: number,\n minor: number\n): boolean {\n if (React.version === undefined) return false;\n const [actualMajor, actualMinor] = React.version.split('.').map(Number);\n\n return actualMajor > major || (actualMajor === major && actualMinor >= minor);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,u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61
61
|
findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
62
62
|
getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
63
63
|
name?: import("./matches").TextMatch | undefined;
|
|
64
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
65
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
66
|
-
* to assert on the output.
|
|
67
|
-
*/
|
|
64
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
68
65
|
}>;
|
|
69
66
|
getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
70
67
|
name?: import("./matches").TextMatch | undefined;
|
|
71
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
72
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
73
|
-
* to assert on the output.
|
|
74
|
-
*/
|
|
68
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
75
69
|
}>;
|
|
76
70
|
queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
77
71
|
name?: import("./matches").TextMatch | undefined;
|
|
78
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
79
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
80
|
-
* to assert on the output.
|
|
81
|
-
*/
|
|
72
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
82
73
|
}>;
|
|
83
74
|
queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
84
75
|
name?: import("./matches").TextMatch | undefined;
|
|
85
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
86
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
87
|
-
* to assert on the output.
|
|
88
|
-
*/
|
|
76
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
89
77
|
}>;
|
|
90
78
|
findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
91
79
|
name?: import("./matches").TextMatch | undefined;
|
|
92
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
93
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
94
|
-
* to assert on the output.
|
|
95
|
-
*/
|
|
80
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
96
81
|
}>;
|
|
97
82
|
findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
98
83
|
name?: import("./matches").TextMatch | undefined;
|
|
99
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
100
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
101
|
-
* to assert on the output.
|
|
102
|
-
*/
|
|
84
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
103
85
|
}>;
|
|
104
86
|
getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
105
87
|
getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
@@ -203,45 +185,27 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, { wr
|
|
|
203
185
|
findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
204
186
|
getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
205
187
|
name?: import("./matches").TextMatch | undefined;
|
|
206
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
207
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
208
|
-
* to assert on the output.
|
|
209
|
-
*/
|
|
188
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
210
189
|
}>;
|
|
211
190
|
getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
212
191
|
name?: import("./matches").TextMatch | undefined;
|
|
213
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
214
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
215
|
-
* to assert on the output.
|
|
216
|
-
*/
|
|
192
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
217
193
|
}>;
|
|
218
194
|
queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
219
195
|
name?: import("./matches").TextMatch | undefined;
|
|
220
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
221
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
222
|
-
* to assert on the output.
|
|
223
|
-
*/
|
|
196
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
224
197
|
}>;
|
|
225
198
|
queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
226
199
|
name?: import("./matches").TextMatch | undefined;
|
|
227
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
228
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
229
|
-
* to assert on the output.
|
|
230
|
-
*/
|
|
200
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
231
201
|
}>;
|
|
232
202
|
findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
233
203
|
name?: import("./matches").TextMatch | undefined;
|
|
234
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
235
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
236
|
-
* to assert on the output.
|
|
237
|
-
*/
|
|
204
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
238
205
|
}>;
|
|
239
206
|
findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
240
207
|
name?: import("./matches").TextMatch | undefined;
|
|
241
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
242
|
-
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
243
|
-
* to assert on the output.
|
|
244
|
-
*/
|
|
208
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
245
209
|
}>;
|
|
246
210
|
getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
247
211
|
getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
package/build/render.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = render;
|
|
7
7
|
exports.renderInternal = renderInternal;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var React = _react;
|
|
9
10
|
var _act = _interopRequireDefault(require("./act"));
|
|
10
11
|
var _cleanup = require("./cleanup");
|
|
11
12
|
var _config = require("./config");
|
|
@@ -18,8 +19,8 @@ var _renderAct = require("./render-act");
|
|
|
18
19
|
var _screen = require("./screen");
|
|
19
20
|
var _within = require("./within");
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
function _getRequireWildcardCache(
|
|
22
|
-
function _interopRequireWildcard(
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
24
|
/**
|
|
24
25
|
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
25
26
|
* to assert on the output.
|
|
@@ -57,7 +58,7 @@ function renderWithStringValidation(component, {
|
|
|
57
58
|
(0, _stringValidation.validateStringsRenderedWithinText)(_screen.screen.toJSON());
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
|
-
const wrap = element => /*#__PURE__*/React.createElement(
|
|
61
|
+
const wrap = element => /*#__PURE__*/React.createElement(_react.Profiler, {
|
|
61
62
|
id: "renderProfiler",
|
|
62
63
|
onRender: handleRender
|
|
63
64
|
}, Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element);
|