@testing-library/react-native 13.0.1 → 13.1.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.
- package/build/event-handler.d.ts +7 -0
- package/build/event-handler.js +30 -0
- package/build/event-handler.js.map +1 -0
- package/build/fire-event.js +4 -14
- package/build/fire-event.js.map +1 -1
- package/build/helpers/accessibility.js.map +1 -1
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/debug.js.map +1 -1
- package/build/helpers/find-all.js.map +1 -1
- package/build/helpers/format-element.js.map +1 -1
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/map-props.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
- package/build/helpers/matchers/match-label-text.js.map +1 -1
- package/build/helpers/matchers/match-text-content.js.map +1 -1
- package/build/helpers/pointer-events.js.map +1 -1
- package/build/helpers/text-input.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/matchers/to-be-busy.js.map +1 -1
- package/build/matchers/to-be-checked.js.map +1 -1
- package/build/matchers/to-be-disabled.js.map +1 -1
- package/build/matchers/to-be-empty-element.js.map +1 -1
- package/build/matchers/to-be-expanded.js.map +1 -1
- package/build/matchers/to-be-on-the-screen.js.map +1 -1
- package/build/matchers/to-be-partially-checked.js.map +1 -1
- package/build/matchers/to-be-selected.js.map +1 -1
- package/build/matchers/to-be-visible.js.map +1 -1
- package/build/matchers/to-contain-element.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.js.map +1 -1
- package/build/matchers/to-have-accessible-name.js.map +1 -1
- package/build/matchers/to-have-display-value.js.map +1 -1
- package/build/matchers/to-have-prop.js.map +1 -1
- package/build/matchers/to-have-style.js.map +1 -1
- package/build/matchers/to-have-text-content.js.map +1 -1
- package/build/matchers/types.js.map +1 -1
- package/build/matchers/utils.js.map +1 -1
- package/build/native-state.js.map +1 -1
- package/build/queries/display-value.js.map +1 -1
- package/build/queries/hint-text.js.map +1 -1
- package/build/queries/label-text.js.map +1 -1
- package/build/queries/make-queries.js.map +1 -1
- package/build/queries/placeholder-text.js.map +1 -1
- package/build/queries/role.js.map +1 -1
- package/build/queries/test-id.js.map +1 -1
- package/build/queries/text.js.map +1 -1
- package/build/queries/unsafe-props.js.map +1 -1
- package/build/queries/unsafe-type.js.map +1 -1
- package/build/render-act.js.map +1 -1
- package/build/render-hook.js.map +1 -1
- package/build/render.js.map +1 -1
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/paste.js.map +1 -1
- package/build/user-event/press/press.js +41 -41
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/scroll/scroll-to.js.map +1 -1
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/dispatch-event.js +2 -12
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/within.js.map +1 -1
- package/package.json +8 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","names":["_errors","require","_hostComponentNames","_pointerEvents","_textInput","_nativeState","_eventBuilder","_utils","_parseKeys","type","element","text","options","isHostTextInput","ErrorWithStack","isEditableTextInput","isPointerEventEnabled","keys","parseKeys","skipPress","dispatchEvent","EventBuilder","Common","touch","focus","wait","config","currentText","getTextInputValue","key","previousText","proposedText","applyKey","isAccepted","isTextChangeAccepted","emitTypingEvents","finalText","submitEditing","TextInput","skipBlur","endEditing","blur","isMultiline","props","multiline","keyPress","nativeState","valueForElement","set","change","selectionRange","start","length","end","selectionChange","contentSize","getTextContentSize","contentSizeChange","slice","maxLength","undefined"],"sources":["../../../src/user-event/type/type.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { ErrorWithStack } from '../../helpers/errors';\nimport { isHostTextInput } from '../../helpers/host-component-names';\nimport { isPointerEventEnabled } from '../../helpers/pointer-events';\nimport { getTextInputValue, isEditableTextInput } from '../../helpers/text-input';\nimport { nativeState } from '../../native-state';\nimport { EventBuilder } from '../event-builder';\nimport type { UserEventConfig, UserEventInstance } from '../setup';\nimport { dispatchEvent, getTextContentSize, wait } from '../utils';\nimport { parseKeys } from './parse-keys';\n\nexport interface TypeOptions {\n skipPress?: boolean;\n submitEditing?: boolean;\n skipBlur?: boolean;\n}\n\nexport async function type(\n this: UserEventInstance,\n element: ReactTestInstance,\n text: string,\n options?: TypeOptions,\n): Promise<void> {\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `type() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n type,\n );\n }\n\n // Skip events if the element is disabled\n if (!isEditableTextInput(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n const keys = parseKeys(text);\n\n if (!options?.skipPress) {\n dispatchEvent(element, 'pressIn', EventBuilder.Common.touch());\n }\n\n dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n if (!options?.skipPress) {\n await wait(this.config);\n dispatchEvent(element, 'pressOut', EventBuilder.Common.touch());\n }\n\n let currentText = getTextInputValue(element);\n for (const key of keys) {\n const previousText = getTextInputValue(element);\n const proposedText = applyKey(previousText, key);\n const isAccepted = isTextChangeAccepted(element, proposedText);\n currentText = isAccepted ? proposedText : previousText;\n\n await emitTypingEvents(element, {\n config: this.config,\n key,\n text: currentText,\n isAccepted,\n });\n }\n\n const finalText = getTextInputValue(element);\n await wait(this.config);\n\n if (options?.submitEditing) {\n dispatchEvent(element, 'submitEditing', EventBuilder.TextInput.submitEditing(finalText));\n }\n\n if (!options?.skipBlur) {\n dispatchEvent(element, 'endEditing', EventBuilder.TextInput.endEditing(finalText));\n dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n }\n}\n\ntype EmitTypingEventsContext = {\n config: UserEventConfig;\n key: string;\n text: string;\n isAccepted?: boolean;\n};\n\nexport async function emitTypingEvents(\n element: ReactTestInstance,\n { config, key, text, isAccepted }: EmitTypingEventsContext,\n) {\n const isMultiline = element.props.multiline === true;\n\n await wait(config);\n dispatchEvent(element, 'keyPress', EventBuilder.TextInput.keyPress(key));\n\n // Platform difference (based on experiments):\n // - iOS and RN Web: TextInput emits only `keyPress` event when max length has been reached\n // - Android: TextInputs does not emit any events\n if (isAccepted === false) {\n return;\n }\n\n nativeState.valueForElement.set(element, text);\n dispatchEvent(element, 'change', EventBuilder.TextInput.change(text));\n dispatchEvent(element, 'changeText', text);\n\n const selectionRange = {\n start: text.length,\n end: text.length,\n };\n dispatchEvent(element, 'selectionChange', EventBuilder.TextInput.selectionChange(selectionRange));\n\n // According to the docs only multiline TextInput emits contentSizeChange event\n // @see: https://reactnative.dev/docs/textinput#oncontentsizechange\n if (isMultiline) {\n const contentSize = getTextContentSize(text);\n dispatchEvent(\n element,\n 'contentSizeChange',\n EventBuilder.TextInput.contentSizeChange(contentSize),\n );\n }\n}\n\nfunction applyKey(text: string, key: string) {\n if (key === 'Enter') {\n return `${text}\\n`;\n }\n\n if (key === 'Backspace') {\n return text.slice(0, -1);\n }\n\n return text + key;\n}\n\nfunction isTextChangeAccepted(element: ReactTestInstance, text: string) {\n const maxLength = element.props.maxLength;\n return maxLength === undefined || text.length <= maxLength;\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"type.js","names":["_errors","require","_hostComponentNames","_pointerEvents","_textInput","_nativeState","_eventBuilder","_utils","_parseKeys","type","element","text","options","isHostTextInput","ErrorWithStack","isEditableTextInput","isPointerEventEnabled","keys","parseKeys","skipPress","dispatchEvent","EventBuilder","Common","touch","focus","wait","config","currentText","getTextInputValue","key","previousText","proposedText","applyKey","isAccepted","isTextChangeAccepted","emitTypingEvents","finalText","submitEditing","TextInput","skipBlur","endEditing","blur","isMultiline","props","multiline","keyPress","nativeState","valueForElement","set","change","selectionRange","start","length","end","selectionChange","contentSize","getTextContentSize","contentSizeChange","slice","maxLength","undefined"],"sources":["../../../src/user-event/type/type.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nimport { ErrorWithStack } from '../../helpers/errors';\nimport { isHostTextInput } from '../../helpers/host-component-names';\nimport { isPointerEventEnabled } from '../../helpers/pointer-events';\nimport { getTextInputValue, isEditableTextInput } from '../../helpers/text-input';\nimport { nativeState } from '../../native-state';\nimport { EventBuilder } from '../event-builder';\nimport type { UserEventConfig, UserEventInstance } from '../setup';\nimport { dispatchEvent, getTextContentSize, wait } from '../utils';\nimport { parseKeys } from './parse-keys';\n\nexport interface TypeOptions {\n skipPress?: boolean;\n submitEditing?: boolean;\n skipBlur?: boolean;\n}\n\nexport async function type(\n this: UserEventInstance,\n element: ReactTestInstance,\n text: string,\n options?: TypeOptions,\n): Promise<void> {\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `type() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n type,\n );\n }\n\n // Skip events if the element is disabled\n if (!isEditableTextInput(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n const keys = parseKeys(text);\n\n if (!options?.skipPress) {\n dispatchEvent(element, 'pressIn', EventBuilder.Common.touch());\n }\n\n dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n if (!options?.skipPress) {\n await wait(this.config);\n dispatchEvent(element, 'pressOut', EventBuilder.Common.touch());\n }\n\n let currentText = getTextInputValue(element);\n for (const key of keys) {\n const previousText = getTextInputValue(element);\n const proposedText = applyKey(previousText, key);\n const isAccepted = isTextChangeAccepted(element, proposedText);\n currentText = isAccepted ? proposedText : previousText;\n\n await emitTypingEvents(element, {\n config: this.config,\n key,\n text: currentText,\n isAccepted,\n });\n }\n\n const finalText = getTextInputValue(element);\n await wait(this.config);\n\n if (options?.submitEditing) {\n dispatchEvent(element, 'submitEditing', EventBuilder.TextInput.submitEditing(finalText));\n }\n\n if (!options?.skipBlur) {\n dispatchEvent(element, 'endEditing', EventBuilder.TextInput.endEditing(finalText));\n dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n }\n}\n\ntype EmitTypingEventsContext = {\n config: UserEventConfig;\n key: string;\n text: string;\n isAccepted?: boolean;\n};\n\nexport async function emitTypingEvents(\n element: ReactTestInstance,\n { config, key, text, isAccepted }: EmitTypingEventsContext,\n) {\n const isMultiline = element.props.multiline === true;\n\n await wait(config);\n dispatchEvent(element, 'keyPress', EventBuilder.TextInput.keyPress(key));\n\n // Platform difference (based on experiments):\n // - iOS and RN Web: TextInput emits only `keyPress` event when max length has been reached\n // - Android: TextInputs does not emit any events\n if (isAccepted === false) {\n return;\n }\n\n nativeState.valueForElement.set(element, text);\n dispatchEvent(element, 'change', EventBuilder.TextInput.change(text));\n dispatchEvent(element, 'changeText', text);\n\n const selectionRange = {\n start: text.length,\n end: text.length,\n };\n dispatchEvent(element, 'selectionChange', EventBuilder.TextInput.selectionChange(selectionRange));\n\n // According to the docs only multiline TextInput emits contentSizeChange event\n // @see: https://reactnative.dev/docs/textinput#oncontentsizechange\n if (isMultiline) {\n const contentSize = getTextContentSize(text);\n dispatchEvent(\n element,\n 'contentSizeChange',\n EventBuilder.TextInput.contentSizeChange(contentSize),\n );\n }\n}\n\nfunction applyKey(text: string, key: string) {\n if (key === 'Enter') {\n return `${text}\\n`;\n }\n\n if (key === 'Backspace') {\n return text.slice(0, -1);\n }\n\n return text + key;\n}\n\nfunction isTextChangeAccepted(element: ReactTestInstance, text: string) {\n const maxLength = element.props.maxLength;\n return maxLength === undefined || text.length <= maxLength;\n}\n"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAQO,eAAeQ,IAAIA,CAExBC,OAA0B,EAC1BC,IAAY,EACZC,OAAqB,EAC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EAAE,YAAY,EAAEC,IAAI,CAAC;EAE1C,MAAMuC,cAAc,GAAG;IACrBC,KAAK,EAAExC,IAAI,CAACyC,MAAM;IAClBC,GAAG,EAAE1C,IAAI,CAACyC;EACZ,CAAC;EACD,IAAAhC,oBAAa,EAACV,OAAO,EAAE,iBAAiB,EAAEW,0BAAY,CAACiB,SAAS,CAACgB,eAAe,CAACJ,cAAc,CAAC,CAAC;;EAEjG;EACA;EACA,IAAIR,WAAW,EAAE;IACf,MAAMa,WAAW,GAAG,IAAAC,yBAAkB,EAAC7C,IAAI,CAAC;IAC5C,IAAAS,oBAAa,EACXV,OAAO,EACP,mBAAmB,EACnBW,0BAAY,CAACiB,SAAS,CAACmB,iBAAiB,CAACF,WAAW,CACtD,CAAC;EACH;AACF;AAEA,SAASvB,QAAQA,CAACrB,IAAY,EAAEkB,GAAW,EAAE;EAC3C,IAAIA,GAAG,KAAK,OAAO,EAAE;IACnB,OAAO,GAAGlB,IAAI,IAAI;EACpB;EAEA,IAAIkB,GAAG,KAAK,WAAW,EAAE;IACvB,OAAOlB,IAAI,CAAC+C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAC1B;EAEA,OAAO/C,IAAI,GAAGkB,GAAG;AACnB;AAEA,SAASK,oBAAoBA,CAACxB,OAA0B,EAAEC,IAAY,EAAE;EACtE,MAAMgD,SAAS,GAAGjD,OAAO,CAACiC,KAAK,CAACgB,SAAS;EACzC,OAAOA,SAAS,KAAKC,SAAS,IAAIjD,IAAI,CAACyC,MAAM,IAAIO,SAAS;AAC5D","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dispatchEvent = dispatchEvent;
|
|
7
7
|
var _act = _interopRequireDefault(require("../../act"));
|
|
8
|
+
var _eventHandler = require("../../event-handler");
|
|
8
9
|
var _componentTree = require("../../helpers/component-tree");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
/**
|
|
@@ -18,7 +19,7 @@ function dispatchEvent(element, eventName, ...event) {
|
|
|
18
19
|
if (!(0, _componentTree.isElementMounted)(element)) {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
const handler = getEventHandler(element, eventName);
|
|
22
|
+
const handler = (0, _eventHandler.getEventHandler)(element, eventName);
|
|
22
23
|
if (!handler) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
@@ -28,15 +29,4 @@ function dispatchEvent(element, eventName, ...event) {
|
|
|
28
29
|
handler(...event);
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
function getEventHandler(element, eventName) {
|
|
32
|
-
const handleName = getEventHandlerName(eventName);
|
|
33
|
-
const handle = element.props[handleName];
|
|
34
|
-
if (typeof handle !== 'function') {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
return handle;
|
|
38
|
-
}
|
|
39
|
-
function getEventHandlerName(eventName) {
|
|
40
|
-
return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
41
|
-
}
|
|
42
32
|
//# sourceMappingURL=dispatch-event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-event.js","names":["_act","_interopRequireDefault","require","_componentTree","e","__esModule","default","dispatchEvent","element","eventName","event","isElementMounted","handler","getEventHandler","act"
|
|
1
|
+
{"version":3,"file":"dispatch-event.js","names":["_act","_interopRequireDefault","require","_eventHandler","_componentTree","e","__esModule","default","dispatchEvent","element","eventName","event","isElementMounted","handler","getEventHandler","act"],"sources":["../../../src/user-event/utils/dispatch-event.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nimport act from '../../act';\nimport { getEventHandler } from '../../event-handler';\nimport { isElementMounted } from '../../helpers/component-tree';\n\n/**\n * Basic dispatch event function used by User Event module.\n *\n * @param element element trigger event on\n * @param eventName name of the event\n * @param event event payload(s)\n */\nexport function dispatchEvent(element: ReactTestInstance, eventName: string, ...event: unknown[]) {\n if (!isElementMounted(element)) {\n return;\n }\n\n const handler = getEventHandler(element, eventName);\n if (!handler) {\n return;\n }\n\n // This will be called synchronously.\n void act(() => {\n handler(...event);\n });\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAgE,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,aAAaA,CAACC,OAA0B,EAAEC,SAAiB,EAAE,GAAGC,KAAgB,EAAE;EAChG,IAAI,CAAC,IAAAC,+BAAgB,EAACH,OAAO,CAAC,EAAE;IAC9B;EACF;EAEA,MAAMI,OAAO,GAAG,IAAAC,6BAAe,EAACL,OAAO,EAAEC,SAAS,CAAC;EACnD,IAAI,CAACG,OAAO,EAAE;IACZ;EACF;;EAEA;EACA,KAAK,IAAAE,YAAG,EAAC,MAAM;IACbF,OAAO,CAAC,GAAGF,KAAK,CAAC;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/build/within.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"within.js","names":["_displayValue","require","_hintText","_labelText","_placeholderText","_role","_testId","_text","_unsafeProps","_unsafeType","within","instance","bindByTextQueries","bindByTestIdQueries","bindByDisplayValueQueries","bindByPlaceholderTextQueries","bindByLabelTextQueries","bindByHintTextQueries","bindByRoleQueries","bindUnsafeByTypeQueries","bindUnsafeByPropsQueries","getQueriesForElement","exports"],"sources":["../src/within.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { bindByDisplayValueQueries } from './queries/display-value';\nimport { bindByHintTextQueries } from './queries/hint-text';\nimport { bindByLabelTextQueries } from './queries/label-text';\nimport { bindByPlaceholderTextQueries } from './queries/placeholder-text';\nimport { bindByRoleQueries } from './queries/role';\nimport { bindByTestIdQueries } from './queries/test-id';\nimport { bindByTextQueries } from './queries/text';\nimport { bindUnsafeByPropsQueries } from './queries/unsafe-props';\nimport { bindUnsafeByTypeQueries } from './queries/unsafe-type';\n\nexport function within(instance: ReactTestInstance) {\n return {\n ...bindByTextQueries(instance),\n ...bindByTestIdQueries(instance),\n ...bindByDisplayValueQueries(instance),\n ...bindByPlaceholderTextQueries(instance),\n ...bindByLabelTextQueries(instance),\n ...bindByHintTextQueries(instance),\n ...bindByRoleQueries(instance),\n ...bindUnsafeByTypeQueries(instance),\n ...bindUnsafeByPropsQueries(instance),\n };\n}\n\nexport const getQueriesForElement = within;\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"within.js","names":["_displayValue","require","_hintText","_labelText","_placeholderText","_role","_testId","_text","_unsafeProps","_unsafeType","within","instance","bindByTextQueries","bindByTestIdQueries","bindByDisplayValueQueries","bindByPlaceholderTextQueries","bindByLabelTextQueries","bindByHintTextQueries","bindByRoleQueries","bindUnsafeByTypeQueries","bindUnsafeByPropsQueries","getQueriesForElement","exports"],"sources":["../src/within.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nimport { bindByDisplayValueQueries } from './queries/display-value';\nimport { bindByHintTextQueries } from './queries/hint-text';\nimport { bindByLabelTextQueries } from './queries/label-text';\nimport { bindByPlaceholderTextQueries } from './queries/placeholder-text';\nimport { bindByRoleQueries } from './queries/role';\nimport { bindByTestIdQueries } from './queries/test-id';\nimport { bindByTextQueries } from './queries/text';\nimport { bindUnsafeByPropsQueries } from './queries/unsafe-props';\nimport { bindUnsafeByTypeQueries } from './queries/unsafe-type';\n\nexport function within(instance: ReactTestInstance) {\n return {\n ...bindByTextQueries(instance),\n ...bindByTestIdQueries(instance),\n ...bindByDisplayValueQueries(instance),\n ...bindByPlaceholderTextQueries(instance),\n ...bindByLabelTextQueries(instance),\n ...bindByHintTextQueries(instance),\n ...bindByRoleQueries(instance),\n ...bindUnsafeByTypeQueries(instance),\n ...bindUnsafeByPropsQueries(instance),\n };\n}\n\nexport const getQueriesForElement = within;\n"],"mappings":";;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAEO,SAASS,MAAMA,CAACC,QAA2B,EAAE;EAClD,OAAO;IACL,GAAG,IAAAC,uBAAiB,EAACD,QAAQ,CAAC;IAC9B,GAAG,IAAAE,2BAAmB,EAACF,QAAQ,CAAC;IAChC,GAAG,IAAAG,uCAAyB,EAACH,QAAQ,CAAC;IACtC,GAAG,IAAAI,6CAA4B,EAACJ,QAAQ,CAAC;IACzC,GAAG,IAAAK,iCAAsB,EAACL,QAAQ,CAAC;IACnC,GAAG,IAAAM,+BAAqB,EAACN,QAAQ,CAAC;IAClC,GAAG,IAAAO,uBAAiB,EAACP,QAAQ,CAAC;IAC9B,GAAG,IAAAQ,mCAAuB,EAACR,QAAQ,CAAC;IACpC,GAAG,IAAAS,qCAAwB,EAACT,QAAQ;EACtC,CAAC;AACH;AAEO,MAAMU,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGX,MAAM","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"chalk": "^4.1.2",
|
|
51
51
|
"jest-matcher-utils": "^29.7.0",
|
|
52
52
|
"pretty-format": "^29.7.0",
|
|
53
|
+
"react-native-gesture-handler": "^2.23.1",
|
|
53
54
|
"redent": "^3.0.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
@@ -72,12 +73,12 @@
|
|
|
72
73
|
"@babel/preset-react": "^7.25.9",
|
|
73
74
|
"@babel/preset-typescript": "^7.26.0",
|
|
74
75
|
"@callstack/eslint-config": "^15.0.0",
|
|
75
|
-
"@react-native/babel-preset": "0.
|
|
76
|
+
"@react-native/babel-preset": "0.78.0",
|
|
76
77
|
"@release-it/conventional-changelog": "^10.0.0",
|
|
77
78
|
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
|
|
78
79
|
"@types/jest": "^29.5.14",
|
|
79
|
-
"@types/react": "^
|
|
80
|
-
"@types/react-test-renderer": "^
|
|
80
|
+
"@types/react": "^19.0.0",
|
|
81
|
+
"@types/react-test-renderer": "^19.0.0",
|
|
81
82
|
"babel-jest": "^29.7.0",
|
|
82
83
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
83
84
|
"del-cli": "^6.0.0",
|
|
@@ -86,9 +87,9 @@
|
|
|
86
87
|
"flow-bin": "~0.170.0",
|
|
87
88
|
"jest": "^29.7.0",
|
|
88
89
|
"prettier": "^2.8.8",
|
|
89
|
-
"react": "
|
|
90
|
-
"react-native": "0.
|
|
91
|
-
"react-test-renderer": "
|
|
90
|
+
"react": "^19.0.0",
|
|
91
|
+
"react-native": "0.78.0",
|
|
92
|
+
"react-test-renderer": "^19.0.0",
|
|
92
93
|
"release-it": "^18.0.0",
|
|
93
94
|
"typescript": "^5.6.3",
|
|
94
95
|
"typescript-eslint": "^8.19.1"
|