@testing-library/react-native 12.5.3 → 12.6.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/config.d.ts +2 -2
- package/build/fire-event.js +1 -1
- package/build/fire-event.js.map +1 -1
- package/build/helpers/debug-deep.js +1 -1
- package/build/helpers/debug-deep.js.map +1 -1
- package/build/helpers/debug-shallow.js +1 -1
- package/build/helpers/debug-shallow.js.map +1 -1
- package/build/helpers/deprecation.js.map +1 -1
- package/build/helpers/errors.js +1 -1
- package/build/helpers/errors.js.map +1 -1
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/string-validation.js.map +1 -1
- package/build/helpers/text-input.js.map +1 -1
- package/build/matchers/to-be-busy.d.ts +0 -1
- package/build/matchers/to-be-busy.js.map +1 -1
- package/build/matchers/to-be-checked.d.ts +0 -1
- package/build/matchers/to-be-checked.js.map +1 -1
- package/build/matchers/to-be-collapsed.d.ts +0 -1
- package/build/matchers/to-be-collapsed.js.map +1 -1
- package/build/matchers/to-be-disabled.d.ts +0 -1
- package/build/matchers/to-be-disabled.js.map +1 -1
- package/build/matchers/to-be-empty-element.d.ts +0 -1
- package/build/matchers/to-be-empty-element.js.map +1 -1
- package/build/matchers/to-be-expanded.d.ts +0 -1
- package/build/matchers/to-be-expanded.js.map +1 -1
- package/build/matchers/to-be-on-the-screen.d.ts +0 -1
- package/build/matchers/to-be-on-the-screen.js.map +1 -1
- package/build/matchers/to-be-partially-checked.d.ts +0 -1
- package/build/matchers/to-be-partially-checked.js.map +1 -1
- package/build/matchers/to-be-selected.d.ts +0 -1
- package/build/matchers/to-be-selected.js.map +1 -1
- package/build/matchers/to-be-visible.d.ts +0 -1
- package/build/matchers/to-be-visible.js.map +1 -1
- package/build/matchers/to-contain-element.d.ts +0 -1
- package/build/matchers/to-contain-element.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.d.ts +0 -1
- package/build/matchers/to-have-accessibility-value.js.map +1 -1
- package/build/matchers/to-have-accessible-name.d.ts +0 -1
- package/build/matchers/to-have-accessible-name.js.map +1 -1
- package/build/matchers/to-have-display-value.d.ts +0 -1
- package/build/matchers/to-have-display-value.js.map +1 -1
- package/build/matchers/to-have-prop.d.ts +0 -1
- package/build/matchers/to-have-prop.js +1 -1
- package/build/matchers/to-have-prop.js.map +1 -1
- package/build/matchers/to-have-style.d.ts +0 -1
- package/build/matchers/to-have-style.js.map +1 -1
- package/build/matchers/to-have-text-content.d.ts +0 -1
- package/build/matchers/to-have-text-content.js.map +1 -1
- package/build/matchers/utils.d.ts +0 -1
- package/build/matchers/utils.js +1 -1
- package/build/matchers/utils.js.map +1 -1
- package/build/pure.js +1 -1
- package/build/pure.js.map +1 -1
- package/build/queries/accessibility-state.js.map +1 -1
- package/build/queries/accessibility-value.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 +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 +1 -1
- package/build/queries/unsafe-props.js.map +1 -1
- package/build/render-act.js +1 -1
- package/build/render-act.js.map +1 -1
- package/build/render-hook.js +1 -1
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +16 -16
- package/build/render.js +1 -1
- package/build/render.js.map +1 -1
- package/build/shallow.js +1 -1
- package/build/shallow.js.map +1 -1
- package/build/user-event/clear.js +5 -6
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/event-builder/index.d.ts +1 -26
- package/build/user-event/event-builder/text-input.d.ts +0 -30
- package/build/user-event/event-builder/text-input.js +0 -19
- package/build/user-event/event-builder/text-input.js.map +1 -1
- package/build/user-event/index.d.ts +1 -0
- package/build/user-event/index.js +1 -0
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/paste.d.ts +3 -0
- package/build/user-event/paste.js +54 -0
- package/build/user-event/paste.js.map +1 -0
- package/build/user-event/press/press.js +1 -1
- 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.d.ts +12 -0
- package/build/user-event/setup/setup.js +2 -0
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/parse-keys.js.map +1 -1
- package/build/user-event/type/type.d.ts +1 -2
- package/build/user-event/type/type.js +0 -8
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/dispatch-event.js +1 -1
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/user-event/utils/warn-about-real-timers.js.map +1 -1
- package/build/wait-for-element-to-be-removed.js +1 -1
- package/build/wait-for-element-to-be-removed.js.map +1 -1
- package/build/wait-for.js.map +1 -1
- package/build/within.d.ts +5 -6
- package/package.json +17 -22
package/build/config.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare function getConfig(): {
|
|
|
37
37
|
/** Default value for `includeHiddenElements` query option. */
|
|
38
38
|
defaultIncludeHiddenElements: boolean;
|
|
39
39
|
/** Default options for `debug` helper. */
|
|
40
|
-
defaultDebugOptions?: Partial<DebugOptions
|
|
40
|
+
defaultDebugOptions?: Partial<DebugOptions>;
|
|
41
41
|
/** Names for key React Native host components. */
|
|
42
|
-
hostComponentNames?: HostComponentNames
|
|
42
|
+
hostComponentNames?: HostComponentNames;
|
|
43
43
|
};
|
package/build/fire-event.js
CHANGED
|
@@ -11,7 +11,7 @@ var _componentTree = require("./helpers/component-tree");
|
|
|
11
11
|
var _hostComponentNames = require("./helpers/host-component-names");
|
|
12
12
|
var _pointerEvents = require("./helpers/pointer-events");
|
|
13
13
|
var _textInput = require("./helpers/text-input");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function isTouchResponder(element) {
|
|
16
16
|
if (!(0, _componentTree.isHostElement)(element)) {
|
|
17
17
|
return false;
|
package/build/fire-event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fire-event.js","names":["_act","_interopRequireDefault","require","_componentTree","_hostComponentNames","_pointerEvents","_textInput","
|
|
1
|
+
{"version":3,"file":"fire-event.js","names":["_act","_interopRequireDefault","require","_componentTree","_hostComponentNames","_pointerEvents","_textInput","e","__esModule","default","isTouchResponder","element","isHostElement","Boolean","props","onStartShouldSetResponder","isHostTextInput","eventsAffectedByPointerEventsProp","Set","textInputEventsIgnoringEditableProp","isEventEnabled","eventName","nearestTouchResponder","isTextInputEditable","has","isPointerEventEnabled","touchStart","touchMove","onMoveShouldSetResponder","undefined","findEventHandler","touchResponder","handler","getEventHandler","parent","eventHandlerName","getEventHandlerName","charAt","toUpperCase","slice","fireEvent","data","returnValue","act","press","changeText","scroll","_default","exports"],"sources":["../src/fire-event.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport {\n ViewProps,\n TextProps,\n TextInputProps,\n PressableProps,\n ScrollViewProps,\n} from 'react-native';\nimport act from './act';\nimport { isHostElement } from './helpers/component-tree';\nimport { isHostTextInput } from './helpers/host-component-names';\nimport { isPointerEventEnabled } from './helpers/pointer-events';\nimport { isTextInputEditable } from './helpers/text-input';\nimport { StringWithAutocomplete } from './types';\n\ntype EventHandler = (...args: unknown[]) => unknown;\n\nexport function isTouchResponder(element: ReactTestInstance) {\n if (!isHostElement(element)) {\n return false;\n }\n\n return Boolean(element.props.onStartShouldSetResponder) || isHostTextInput(element);\n}\n\n/**\n * List of events affected by `pointerEvents` prop.\n *\n * Note: `fireEvent` is accepting both `press` and `onPress` for event names,\n * so we need cover both forms.\n */\nconst eventsAffectedByPointerEventsProp = new Set(['press', 'onPress']);\n\n/**\n * List of `TextInput` events not affected by `editable` prop.\n *\n * Note: `fireEvent` is accepting both `press` and `onPress` for event names,\n * so we need cover both forms.\n */\nconst textInputEventsIgnoringEditableProp = new Set([\n 'contentSizeChange',\n 'onContentSizeChange',\n 'layout',\n 'onLayout',\n 'scroll',\n 'onScroll',\n]);\n\nexport function isEventEnabled(\n element: ReactTestInstance,\n eventName: string,\n nearestTouchResponder?: ReactTestInstance,\n) {\n if (isHostTextInput(nearestTouchResponder)) {\n return (\n isTextInputEditable(nearestTouchResponder) ||\n textInputEventsIgnoringEditableProp.has(eventName)\n );\n }\n\n if (eventsAffectedByPointerEventsProp.has(eventName) && !isPointerEventEnabled(element)) {\n return false;\n }\n\n const touchStart = nearestTouchResponder?.props.onStartShouldSetResponder?.();\n const touchMove = nearestTouchResponder?.props.onMoveShouldSetResponder?.();\n if (touchStart || touchMove) {\n return true;\n }\n\n return touchStart === undefined && touchMove === undefined;\n}\n\nfunction findEventHandler(\n element: ReactTestInstance,\n eventName: string,\n nearestTouchResponder?: ReactTestInstance,\n): EventHandler | null {\n const touchResponder = isTouchResponder(element) ? element : nearestTouchResponder;\n\n const handler = getEventHandler(element, eventName);\n if (handler && isEventEnabled(element, eventName, touchResponder)) return handler;\n\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n if (element.parent === null || element.parent.parent === null) {\n return null;\n }\n\n return findEventHandler(element.parent, eventName, touchResponder);\n}\n\nfunction getEventHandler(element: ReactTestInstance, eventName: string) {\n const eventHandlerName = getEventHandlerName(eventName);\n if (typeof element.props[eventHandlerName] === 'function') {\n return element.props[eventHandlerName];\n }\n\n if (typeof element.props[eventName] === 'function') {\n return element.props[eventName];\n }\n\n return undefined;\n}\n\nfunction getEventHandlerName(eventName: string) {\n return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;\n}\n\n// String union type of keys of T that start with on, stripped of 'on'\ntype EventNameExtractor<T> = keyof {\n [K in keyof T as K extends `on${infer Rest}` ? Uncapitalize<Rest> : never]: T[K];\n};\n\ntype EventName = StringWithAutocomplete<\n | EventNameExtractor<ViewProps>\n | EventNameExtractor<TextProps>\n | EventNameExtractor<TextInputProps>\n | EventNameExtractor<PressableProps>\n | EventNameExtractor<ScrollViewProps>\n>;\n\nfunction fireEvent(element: ReactTestInstance, eventName: EventName, ...data: unknown[]) {\n const handler = findEventHandler(element, eventName);\n if (!handler) {\n return;\n }\n\n let returnValue;\n void act(() => {\n returnValue = handler(...data);\n });\n\n return returnValue;\n}\n\nfireEvent.press = (element: ReactTestInstance, ...data: unknown[]) =>\n fireEvent(element, 'press', ...data);\n\nfireEvent.changeText = (element: ReactTestInstance, ...data: unknown[]) =>\n fireEvent(element, 'changeText', ...data);\n\nfireEvent.scroll = (element: ReactTestInstance, ...data: unknown[]) =>\n fireEvent(element, 'scroll', ...data);\n\nexport default fireEvent;\n"],"mappings":";;;;;;;;AAQA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAA2D,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKpD,SAASG,gBAAgBA,CAACC,OAA0B,EAAE;EAC3D,IAAI,CAAC,IAAAC,4BAAa,EAACD,OAAO,CAAC,EAAE;IAC3B,OAAO,KAAK;EACd;EAEA,OAAOE,OAAO,CAACF,OAAO,CAACG,KAAK,CAACC,yBAAyB,CAAC,IAAI,IAAAC,mCAAe,EAACL,OAAO,CAAC;AACrF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,iCAAiC,GAAG,IAAIC,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mCAAmC,GAAG,IAAID,GAAG,CAAC,CAClD,mBAAmB,EACnB,qBAAqB,EACrB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,CACX,CAAC;AAEK,SAASE,c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,GAAG8B,IAAI,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAvC,OAAA,GAEzB+B,SAAS","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = debugDeep;
|
|
7
7
|
var _format = _interopRequireDefault(require("./format"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/**
|
|
10
10
|
* Log pretty-printed deep test component instance
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-deep.js","names":["_format","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"debug-deep.js","names":["_format","_interopRequireDefault","require","e","__esModule","default","debugDeep","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug-deep.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport default function debugDeep(\n instance: ReactTestRendererJSON | ReactTestRendererJSON[],\n options?: DebugOptions | string,\n) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions = typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD;AACA;AACA;AACe,SAASG,SAASA,CAC/BC,QAAyD,EACzDC,OAA+B,EAC/B;EACA,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GAAG,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE/F,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAC,GAAGL,OAAO,MAAM,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = debugShallow;
|
|
7
7
|
var _shallow = require("../shallow");
|
|
8
8
|
var _format = _interopRequireDefault(require("./format"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
/**
|
|
11
11
|
* Log pretty-printed shallow test component instance
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-shallow.js","names":["_shallow","require","_format","_interopRequireDefault","
|
|
1
|
+
{"version":3,"file":"debug-shallow.js","names":["_shallow","require","_format","_interopRequireDefault","e","__esModule","default","debugShallow","instance","message","output","shallowInternal","console","log","format"],"sources":["../../src/helpers/debug-shallow.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport { shallowInternal } from '../shallow';\nimport format from './format';\n\n/**\n * Log pretty-printed shallow test component instance\n */\nexport default function debugShallow(\n instance: ReactTestInstance | React.ReactElement<any>,\n message?: string,\n) {\n const { output } = shallowInternal(instance);\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(output));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(output));\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8B,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA;AACA;AACe,SAASG,YAAYA,CAClCC,QAAqD,EACrDC,OAAgB,EAChB;EACA,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,wBAAe,EAACH,QAAQ,CAAC;EAE5C,IAAIC,OAAO,EAAE;IACX;IACAG,OAAO,CAACC,GAAG,CAAC,GAAGJ,OAAO,MAAM,EAAE,IAAAK,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC/C,CAAC,MAAM;IACL;IACAE,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC7B;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.js","names":["_queryName","require","deprecateQueries","queriesObject","recommendation","result","Object","keys","forEach","queryName","queryFn","deprecateQuery","formattedRecommendation","replace","getQueryPrefix","wrapper","args","errorMessage","console","warn","warned","printDeprecationWarning","functionName"],"sources":["../../src/helpers/deprecation.ts"],"sourcesContent":["import { getQueryPrefix } from './query-name';\n\nexport function deprecateQueries<Queries extends Record<string, any>>(\n queriesObject: Queries,\n recommendation: string,\n): Queries {\n const result = {} as Queries;\n Object.keys(queriesObject).forEach((queryName) => {\n const queryFn = queriesObject[queryName];\n // @ts-expect-error: generic typing is hard\n result[queryName] = deprecateQuery(queryFn, queryName, recommendation);\n });\n\n return result;\n}\n\nfunction deprecateQuery<QueryFn extends (...args: any) => any>(\n queryFn: QueryFn,\n queryName: string,\n recommendation: string,\n): QueryFn {\n const formattedRecommendation = recommendation.replace(\n /{queryPrefix}/g,\n getQueryPrefix(queryName),\n );\n\n // @ts-expect-error: generic typing is hard\n const wrapper: QueryFn = (...args: any) => {\n const errorMessage = `${queryName}(...) is deprecated and will be removed in the future.\\n\\n${formattedRecommendation}`;\n // eslint-disable-next-line no-console\n console.warn(errorMessage);\n return queryFn(...args);\n };\n\n return wrapper;\n}\n\nconst warned: { [functionName: string]: boolean } = {};\n\n/* istanbul ignore next: occasionally used */\nexport function printDeprecationWarning(functionName: string) {\n if (warned[functionName]) {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn(`\n Deprecation Warning:\n Use of ${functionName} is not recommended and will be deleted in future versions of @testing-library/react-native.\n `);\n\n warned[functionName] = true;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,SAASC,gBAAgBA,CAC9BC,aAAsB,EACtBC,cAAsB,EACb;EACT,MAAMC,MAAM,GAAG,CAAC,CAAY;EAC5BC,MAAM,CAACC,IAAI,CAACJ,aAAa,CAAC,CAACK,OAAO,CAAEC,SAAS,IAAK;IAChD,MAAMC,OAAO,GAAGP,aAAa,CAACM,SAAS,CAAC;IACxC;IACAJ,MAAM,CAACI,SAAS,CAAC,GAAGE,cAAc,CAACD,OAAO,EAAED,SAAS,EAAEL,cAAc,CAAC;EACxE,CAAC,CAAC;EAEF,OAAOC,MAAM;AACf;AAEA,SAASM,cAAcA,CACrBD,OAAgB,EAChBD,SAAiB,EACjBL,cAAsB,EACb;EACT,MAAMQ,uBAAuB,GAAGR,cAAc,CAACS,OAAO,CACpD,gBAAgB,EAChB,IAAAC,yBAAc,EAACL,SAAS,CAC1B,CAAC;;EAED;EACA,MAAMM,OAAgB,GAAGA,CAAC,GAAGC,IAAS,KAAK;IACzC,MAAMC,YAAY,
|
|
1
|
+
{"version":3,"file":"deprecation.js","names":["_queryName","require","deprecateQueries","queriesObject","recommendation","result","Object","keys","forEach","queryName","queryFn","deprecateQuery","formattedRecommendation","replace","getQueryPrefix","wrapper","args","errorMessage","console","warn","warned","printDeprecationWarning","functionName"],"sources":["../../src/helpers/deprecation.ts"],"sourcesContent":["import { getQueryPrefix } from './query-name';\n\nexport function deprecateQueries<Queries extends Record<string, any>>(\n queriesObject: Queries,\n recommendation: string,\n): Queries {\n const result = {} as Queries;\n Object.keys(queriesObject).forEach((queryName) => {\n const queryFn = queriesObject[queryName];\n // @ts-expect-error: generic typing is hard\n result[queryName] = deprecateQuery(queryFn, queryName, recommendation);\n });\n\n return result;\n}\n\nfunction deprecateQuery<QueryFn extends (...args: any) => any>(\n queryFn: QueryFn,\n queryName: string,\n recommendation: string,\n): QueryFn {\n const formattedRecommendation = recommendation.replace(\n /{queryPrefix}/g,\n getQueryPrefix(queryName),\n );\n\n // @ts-expect-error: generic typing is hard\n const wrapper: QueryFn = (...args: any) => {\n const errorMessage = `${queryName}(...) is deprecated and will be removed in the future.\\n\\n${formattedRecommendation}`;\n // eslint-disable-next-line no-console\n console.warn(errorMessage);\n return queryFn(...args);\n };\n\n return wrapper;\n}\n\nconst warned: { [functionName: string]: boolean } = {};\n\n/* istanbul ignore next: occasionally used */\nexport function printDeprecationWarning(functionName: string) {\n if (warned[functionName]) {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn(`\n Deprecation Warning:\n Use of ${functionName} is not recommended and will be deleted in future versions of @testing-library/react-native.\n `);\n\n warned[functionName] = true;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,SAASC,gBAAgBA,CAC9BC,aAAsB,EACtBC,cAAsB,EACb;EACT,MAAMC,MAAM,GAAG,CAAC,CAAY;EAC5BC,MAAM,CAACC,IAAI,CAACJ,aAAa,CAAC,CAACK,OAAO,CAAEC,SAAS,IAAK;IAChD,MAAMC,OAAO,GAAGP,aAAa,CAACM,SAAS,CAAC;IACxC;IACAJ,MAAM,CAACI,SAAS,CAAC,GAAGE,cAAc,CAACD,OAAO,EAAED,SAAS,EAAEL,cAAc,CAAC;EACxE,CAAC,CAAC;EAEF,OAAOC,MAAM;AACf;AAEA,SAASM,cAAcA,CACrBD,OAAgB,EAChBD,SAAiB,EACjBL,cAAsB,EACb;EACT,MAAMQ,uBAAuB,GAAGR,cAAc,CAACS,OAAO,CACpD,gBAAgB,EAChB,IAAAC,yBAAc,EAACL,SAAS,CAC1B,CAAC;;EAED;EACA,MAAMM,OAAgB,GAAGA,CAAC,GAAGC,IAAS,KAAK;IACzC,MAAMC,YAAY,GAAG,GAAGR,SAAS,6DAA6DG,uBAAuB,EAAE;IACvH;IACAM,OAAO,CAACC,IAAI,CAACF,YAAY,CAAC;IAC1B,OAAOP,OAAO,CAAC,GAAGM,IAAI,CAAC;EACzB,CAAC;EAED,OAAOD,OAAO;AAChB;AAEA,MAAMK,MAA2C,GAAG,CAAC,CAAC;;AAEtD;AACO,SAASC,uBAAuBA,CAACC,YAAoB,EAAE;EAC5D,IAAIF,MAAM,CAACE,YAAY,CAAC,EAAE;IACxB;EACF;;EAEA;EACAJ,OAAO,CAACC,IAAI,CAAC;AACf;AACA,WAAWG,YAAY;AACvB,GAAG,CAAC;EAEFF,MAAM,CAACE,YAAY,CAAC,GAAG,IAAI;AAC7B","ignoreList":[]}
|
package/build/helpers/errors.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.ErrorWithStack = void 0;
|
|
|
7
7
|
exports.copyStackTrace = copyStackTrace;
|
|
8
8
|
exports.prepareErrorMessage = exports.createQueryByError = void 0;
|
|
9
9
|
var _prettyFormat = _interopRequireDefault(require("pretty-format"));
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
class ErrorWithStack extends Error {
|
|
12
12
|
constructor(message, callsite) {
|
|
13
13
|
super(message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":["_prettyFormat","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"errors.js","names":["_prettyFormat","_interopRequireDefault","require","e","__esModule","default","ErrorWithStack","Error","constructor","message","callsite","captureStackTrace","exports","prepareErrorMessage","error","name","value","errorMessage","replace","toString","prettyFormat","min","createQueryByError","includes","copyStackTrace","target","stackTraceSource","stack"],"sources":["../../src/helpers/errors.ts"],"sourcesContent":["import prettyFormat from 'pretty-format';\n\nexport class ErrorWithStack extends Error {\n constructor(message: string | undefined, callsite: Function) {\n super(message);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, callsite);\n }\n }\n}\n\nexport const prepareErrorMessage = (\n // TS states that error caught in a catch close are of type `unknown`\n // most real cases will be `Error`, but better safe than sorry\n error: unknown,\n name?: string,\n value?: unknown,\n): string => {\n let errorMessage: string;\n if (error instanceof Error) {\n // Strip info about custom predicate\n errorMessage = error.message.replace(/ matching custom predicate[^]*/gm, '');\n } else if (error && typeof error === 'object') {\n errorMessage = error.toString();\n } else {\n errorMessage = 'Caught unknown error';\n }\n\n if (name && value) {\n errorMessage += ` with ${name} ${prettyFormat(value, { min: true })}`;\n }\n return errorMessage;\n};\n\nexport const createQueryByError = (error: unknown, callsite: Function): null => {\n if (error instanceof Error) {\n if (error.message.includes('No instances found')) {\n return null;\n }\n throw new ErrorWithStack(error.message, callsite);\n }\n\n throw new ErrorWithStack(\n // generic refining of `unknown` is very hard, you cannot do `'toString' in error` or anything like that\n // Converting as any with extra safe optional chaining will do the job just as well\n `Query: caught unknown error type: ${typeof error}, value: ${(error as any)?.toString?.()}`,\n callsite,\n );\n};\n\nexport function copyStackTrace(target: unknown, stackTraceSource: Error) {\n if (target instanceof Error && stackTraceSource.stack) {\n target.stack = stackTraceSource.stack.replace(stackTraceSource.message, target.message);\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElC,MAAMG,cAAc,SAASC,KAAK,CAAC;EACxCC,WAAWA,CAACC,OAA2B,E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C;AACH,CAAC;AAACE,OAAA,CAAAU,kBAAA,GAAAA,kBAAA;AAEK,SAASE,cAAcA,CAACC,MAAe,EAAEC,gBAAuB,EAAE;EACvE,IAAID,MAAM,YAAYlB,KAAK,IAAImB,gBAAgB,CAACC,KAAK,EAAE;IACrDF,MAAM,CAACE,KAAK,GAAGD,gBAAgB,CAACC,KAAK,CAACT,OAAO,CAACQ,gBAAgB,CAACjB,OAAO,EAAEgB,MAAM,CAAChB,OAAO,CAAC;EACzF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-component-names.js","names":["React","_interopRequireWildcard","require","_reactNative","_config","_renderAct","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","userConfigErrorMessage","getHostComponentNames","hostComponentNames","getConfig","detectHostComponentNames","configureInternal","configureHostComponentNamesIfNeeded","configHostComponentNames","renderer","renderWithAct","createElement","View","Text","testID","TextInput","Switch","ScrollView","Modal","text","getByTestId","root","type","textInput","switch","scrollView","modal","error","errorMessage","message","Error","instance","nodes","findAll","node","props","length","isHostText","element","isHostTextInput","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { Modal, ScrollView, Switch, Text, TextInput, View } from 'react-native';\nimport { configureInternal, getConfig, HostComponentNames } from '../config';\nimport { renderWithAct } from '../render-act';\nimport { HostTestInstance } from './component-tree';\n\nconst userConfigErrorMessage = `There seems to be an issue with your configuration that prevents React Native Testing Library from working correctly.\nPlease check if you are using compatible versions of React Native and React Native Testing Library.`;\n\nexport function getHostComponentNames(): HostComponentNames {\n let hostComponentNames = getConfig().hostComponentNames;\n if (!hostComponentNames) {\n hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n }\n\n return hostComponentNames;\n}\n\nexport function configureHostComponentNamesIfNeeded() {\n const configHostComponentNames = getConfig().hostComponentNames;\n if (configHostComponentNames) {\n return;\n }\n\n const hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n}\n\nfunction detectHostComponentNames(): HostComponentNames {\n try {\n const renderer = renderWithAct(\n <View>\n <Text testID=\"text\">Hello</Text>\n <TextInput testID=\"textInput\" />\n <Switch testID=\"switch\" />\n <ScrollView testID=\"scrollView\" />\n <Modal testID=\"modal\" />\n </View>,\n );\n\n return {\n text: getByTestId(renderer.root, 'text').type as string,\n textInput: getByTestId(renderer.root, 'textInput').type as string,\n switch: getByTestId(renderer.root, 'switch').type as string,\n scrollView: getByTestId(renderer.root, 'scrollView').type as string,\n modal: getByTestId(renderer.root, 'modal').type as string,\n };\n } catch (error) {\n const errorMessage =\n error && typeof error === 'object' && 'message' in error ? error.message : null;\n\n throw new Error(\n `Trying to detect host component names triggered the following error:\\n\\n${errorMessage}\\n\\n${userConfigErrorMessage}`,\n );\n }\n}\n\nfunction getByTestId(instance: ReactTestInstance, testID: string) {\n const nodes = instance.findAll(\n (node) => typeof node.type === 'string' && node.props.testID === testID,\n );\n\n if (nodes.length === 0) {\n throw new Error(`Unable to find an element with testID: ${testID}`);\n }\n\n return nodes[0];\n}\n\n/**\n * Checks if the given element is a host Text.\n * @param element The element to check.\n */\nexport function isHostText(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().text;\n}\n\n/**\n * Checks if the given element is a host TextInput.\n * @param element The element to check.\n */\nexport function isHostTextInput(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().textInput;\n}\n\n/**\n * Checks if the given element is a host ScrollView.\n * @param element The element to check.\n */\nexport function isHostScrollView(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().scrollView;\n}\n\n/**\n * Checks if the given element is a host Modal.\n * @param element The element to check.\n */\nexport function isHostModal(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().modal;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GAAAA,CAAA;AAG9C,MAAMW,sBAAsB,
|
|
1
|
+
{"version":3,"file":"host-component-names.js","names":["React","_interopRequireWildcard","require","_reactNative","_config","_renderAct","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","userConfigErrorMessage","getHostComponentNames","hostComponentNames","getConfig","detectHostComponentNames","configureInternal","configureHostComponentNamesIfNeeded","configHostComponentNames","renderer","renderWithAct","createElement","View","Text","testID","TextInput","Switch","ScrollView","Modal","text","getByTestId","root","type","textInput","switch","scrollView","modal","error","errorMessage","message","Error","instance","nodes","findAll","node","props","length","isHostText","element","isHostTextInput","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { Modal, ScrollView, Switch, Text, TextInput, View } from 'react-native';\nimport { configureInternal, getConfig, HostComponentNames } from '../config';\nimport { renderWithAct } from '../render-act';\nimport { HostTestInstance } from './component-tree';\n\nconst userConfigErrorMessage = `There seems to be an issue with your configuration that prevents React Native Testing Library from working correctly.\nPlease check if you are using compatible versions of React Native and React Native Testing Library.`;\n\nexport function getHostComponentNames(): HostComponentNames {\n let hostComponentNames = getConfig().hostComponentNames;\n if (!hostComponentNames) {\n hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n }\n\n return hostComponentNames;\n}\n\nexport function configureHostComponentNamesIfNeeded() {\n const configHostComponentNames = getConfig().hostComponentNames;\n if (configHostComponentNames) {\n return;\n }\n\n const hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n}\n\nfunction detectHostComponentNames(): HostComponentNames {\n try {\n const renderer = renderWithAct(\n <View>\n <Text testID=\"text\">Hello</Text>\n <TextInput testID=\"textInput\" />\n <Switch testID=\"switch\" />\n <ScrollView testID=\"scrollView\" />\n <Modal testID=\"modal\" />\n </View>,\n );\n\n return {\n text: getByTestId(renderer.root, 'text').type as string,\n textInput: getByTestId(renderer.root, 'textInput').type as string,\n switch: getByTestId(renderer.root, 'switch').type as string,\n scrollView: getByTestId(renderer.root, 'scrollView').type as string,\n modal: getByTestId(renderer.root, 'modal').type as string,\n };\n } catch (error) {\n const errorMessage =\n error && typeof error === 'object' && 'message' in error ? error.message : null;\n\n throw new Error(\n `Trying to detect host component names triggered the following error:\\n\\n${errorMessage}\\n\\n${userConfigErrorMessage}`,\n );\n }\n}\n\nfunction getByTestId(instance: ReactTestInstance, testID: string) {\n const nodes = instance.findAll(\n (node) => typeof node.type === 'string' && node.props.testID === testID,\n );\n\n if (nodes.length === 0) {\n throw new Error(`Unable to find an element with testID: ${testID}`);\n }\n\n return nodes[0];\n}\n\n/**\n * Checks if the given element is a host Text.\n * @param element The element to check.\n */\nexport function isHostText(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().text;\n}\n\n/**\n * Checks if the given element is a host TextInput.\n * @param element The element to check.\n */\nexport function isHostTextInput(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().textInput;\n}\n\n/**\n * Checks if the given element is a host ScrollView.\n * @param element The element to check.\n */\nexport function isHostScrollView(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().scrollView;\n}\n\n/**\n * Checks if the given element is a host Modal.\n * @param element The element to check.\n */\nexport function isHostModal(element?: ReactTestInstance | null): element is HostTestInstance {\n return element?.type === getHostComponentNames().modal;\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA8C,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA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F,OAAOA,OAAO,EAAEhB,IAAI,KAAKpB,qBAAqB,CAAC,CAAC,CAACwB,KAAK;AACxD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-validation.js","names":["validateStringsRenderedWithinText","rendererJSON","Array","isArray","forEach","validateStringsRenderedWithinTextForNode","exports","node","type","children","child","Error"],"sources":["../../src/helpers/string-validation.ts"],"sourcesContent":["import { ReactTestRendererNode } from 'react-test-renderer';\n\nexport const validateStringsRenderedWithinText = (\n rendererJSON: ReactTestRendererNode | Array<ReactTestRendererNode> | null,\n) => {\n if (!rendererJSON) return;\n\n if (Array.isArray(rendererJSON)) {\n rendererJSON.forEach(validateStringsRenderedWithinTextForNode);\n return;\n }\n\n return validateStringsRenderedWithinTextForNode(rendererJSON);\n};\n\nconst validateStringsRenderedWithinTextForNode = (node: ReactTestRendererNode) => {\n if (typeof node === 'string') {\n return;\n }\n\n if (node.type !== 'Text') {\n node.children?.forEach((child) => {\n if (typeof child === 'string') {\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render \"${child}\" string within a <${node.type}> component.`,\n );\n }\n });\n }\n\n if (node.children) {\n node.children.forEach(validateStringsRenderedWithinTextForNode);\n }\n};\n"],"mappings":";;;;;;AAEO,MAAMA,iCAAiC,GAC5CC,YAAyE,IACtE;EACH,IAAI,CAACA,YAAY,EAAE;EAEnB,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACG,OAAO,CAACC,wCAAwC,CAAC;IAC9D;EACF;EAEA,OAAOA,wCAAwC,CAACJ,YAAY,CAAC;AAC/D,CAAC;AAACK,OAAA,CAAAN,iCAAA,GAAAA,iCAAA;AAEF,MAAMK,wCAAwC,GAAIE,IAA2B,IAAK;EAChF,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B;EACF;EAEA,IAAIA,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;IACxBD,IAAI,CAACE,QAAQ,EAAEL,OAAO,CAAEM,KAAK,IAAK;MAChC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAIC,KAAK,
|
|
1
|
+
{"version":3,"file":"string-validation.js","names":["validateStringsRenderedWithinText","rendererJSON","Array","isArray","forEach","validateStringsRenderedWithinTextForNode","exports","node","type","children","child","Error"],"sources":["../../src/helpers/string-validation.ts"],"sourcesContent":["import { ReactTestRendererNode } from 'react-test-renderer';\n\nexport const validateStringsRenderedWithinText = (\n rendererJSON: ReactTestRendererNode | Array<ReactTestRendererNode> | null,\n) => {\n if (!rendererJSON) return;\n\n if (Array.isArray(rendererJSON)) {\n rendererJSON.forEach(validateStringsRenderedWithinTextForNode);\n return;\n }\n\n return validateStringsRenderedWithinTextForNode(rendererJSON);\n};\n\nconst validateStringsRenderedWithinTextForNode = (node: ReactTestRendererNode) => {\n if (typeof node === 'string') {\n return;\n }\n\n if (node.type !== 'Text') {\n node.children?.forEach((child) => {\n if (typeof child === 'string') {\n throw new Error(\n `Invariant Violation: Text strings must be rendered within a <Text> component. Detected attempt to render \"${child}\" string within a <${node.type}> component.`,\n );\n }\n });\n }\n\n if (node.children) {\n node.children.forEach(validateStringsRenderedWithinTextForNode);\n }\n};\n"],"mappings":";;;;;;AAEO,MAAMA,iCAAiC,GAC5CC,YAAyE,IACtE;EACH,IAAI,CAACA,YAAY,EAAE;EAEnB,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACG,OAAO,CAACC,wCAAwC,CAAC;IAC9D;EACF;EAEA,OAAOA,wCAAwC,CAACJ,YAAY,CAAC;AAC/D,CAAC;AAACK,OAAA,CAAAN,iCAAA,GAAAA,iCAAA;AAEF,MAAMK,wCAAwC,GAAIE,IAA2B,IAAK;EAChF,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B;EACF;EAEA,IAAIA,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;IACxBD,IAAI,CAACE,QAAQ,EAAEL,OAAO,CAAEM,KAAK,IAAK;MAChC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAIC,KAAK,CACb,6GAA6GD,KAAK,sBAAsBH,IAAI,CAACC,IAAI,cACnJ,CAAC;MACH;IACF,CAAC,CAAC;EACJ;EAEA,IAAID,IAAI,CAACE,QAAQ,EAAE;IACjBF,IAAI,CAACE,QAAQ,CAACL,OAAO,CAACC,wCAAwC,CAAC;EACjE;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.js","names":["_hostComponentNames","require","isTextInputEditable","element","isHostTextInput","Error","type","props","editable","getTextInputValue","value","defaultValue"],"sources":["../../src/helpers/text-input.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { isHostTextInput } from './host-component-names';\n\nexport function isTextInputEditable(element: ReactTestInstance) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return element.props.editable !== false;\n}\n\nexport function getTextInputValue(element: ReactTestInstance) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return element.props.value ?? element.props.defaultValue;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,mBAAA,GAAAC,OAAA;AAEO,SAASC,mBAAmBA,CAACC,OAA0B,EAAE;EAC9D,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIE,KAAK,
|
|
1
|
+
{"version":3,"file":"text-input.js","names":["_hostComponentNames","require","isTextInputEditable","element","isHostTextInput","Error","type","props","editable","getTextInputValue","value","defaultValue"],"sources":["../../src/helpers/text-input.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { isHostTextInput } from './host-component-names';\n\nexport function isTextInputEditable(element: ReactTestInstance) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return element.props.editable !== false;\n}\n\nexport function getTextInputValue(element: ReactTestInstance) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return element.props.value ?? element.props.defaultValue;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,mBAAA,GAAAC,OAAA;AAEO,SAASC,mBAAmBA,CAACC,OAA0B,EAAE;EAC9D,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIE,KAAK,CAAC,kDAAkDF,OAAO,CAACG,IAAI,IAAI,CAAC;EACrF;EAEA,OAAOH,OAAO,CAACI,KAAK,CAACC,QAAQ,KAAK,KAAK;AACzC;AAEO,SAASC,iBAAiBA,CAACN,OAA0B,EAAE;EAC5D,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIE,KAAK,CAAC,kDAAkDF,OAAO,CAACG,IAAI,IAAI,CAAC;EACrF;EAEA,OAAOH,OAAO,CAACI,KAAK,CAACG,KAAK,IAAIP,OAAO,CAACI,KAAK,CAACI,YAAY;AAC1D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeBusy","element","checkHostElement","pass","isElementBusy","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-busy.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementBusy } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: isElementBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,QAAQA,CAA4BC,OAA0B,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,4BAAa,EAACH,OAAO,CAAC;IAC5BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeBusy","element","checkHostElement","pass","isElementBusy","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-busy.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementBusy } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: isElementBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,QAAQA,CAA4BC,OAA0B,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,4BAAa,EAACH,OAAO,CAAC;IAC5BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_utils","toBeChecked","element","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","getAccessibilityCheckedState","message","is","isNot","matcherHint","formatElement","join","isAccessibilityElement","role","getAccessibilityRole"],"sources":["../../src/matchers/to-be-checked.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport {\n getAccessibilityCheckedState,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeChecked, this);\n\n if (!hasValidAccessibilityRole(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on accessibility elements with \"checkbox\" or \"radio\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: getAccessibilityCheckedState(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction hasValidAccessibilityRole(element: ReactTestInstance) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getAccessibilityRole(element);\n return role === 'checkbox' || role === 'radio';\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAACG,yBAAyB,CAACF,OAAO,CAAC,EAAE;IACvC,MAAM,IAAIG,sBAAc,
|
|
1
|
+
{"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_utils","toBeChecked","element","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","getAccessibilityCheckedState","message","is","isNot","matcherHint","formatElement","join","isAccessibilityElement","role","getAccessibilityRole"],"sources":["../../src/matchers/to-be-checked.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport {\n getAccessibilityCheckedState,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeChecked, this);\n\n if (!hasValidAccessibilityRole(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on accessibility elements with \"checkbox\" or \"radio\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: getAccessibilityCheckedState(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction hasValidAccessibilityRole(element: ReactTestInstance) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getAccessibilityRole(element);\n return role === 'checkbox' || role === 'radio';\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAACG,yBAAyB,CAACF,OAAO,CAAC,EAAE;IACvC,MAAM,IAAIG,sBAAc,CACtB,qFAAqF,EACrFJ,WACF,CAAC;EACH;EAEA,OAAO;IACLK,IAAI,EAAE,IAAAC,2CAA4B,EAACL,OAAO,CAAC,KAAK,IAAI;IACpDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,yBAAyBA,CAACF,OAA0B,EAAE;EAC7D,IAAI,CAAC,IAAAY,qCAAsB,EAACZ,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMa,IAAI,GAAG,IAAAC,mCAAoB,EAACd,OAAO,CAAC;EAC1C,OAAOa,IAAI,KAAK,UAAU,IAAIA,IAAI,KAAK,OAAO;AAChD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-collapsed.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeCollapsed","element","checkHostElement","pass","isElementCollapsed","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-collapsed.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementCollapsed } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeCollapsed(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeCollapsed, this);\n\n return {\n pass: isElementCollapsed(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}collapsed:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,aAAaA,CAA4BC,OAA0B,EAAE;EACnF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,aAAa,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLG,IAAI,EAAE,IAAAC,iCAAkB,EAACH,OAAO,CAAC;IACjCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-collapsed.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeCollapsed","element","checkHostElement","pass","isElementCollapsed","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-collapsed.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementCollapsed } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeCollapsed(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeCollapsed, this);\n\n return {\n pass: isElementCollapsed(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}collapsed:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,aAAaA,CAA4BC,OAA0B,EAAE;EACnF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,aAAa,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLG,IAAI,EAAE,IAAAC,iCAAkB,EAACH,OAAO,CAAC;IACjCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,CAAC;MACvF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,YAAY,EAC3D,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_hostComponentNames","_textInput","_componentTree","_utils","toBeDisabled","element","checkHostElement","isDisabled","isElementDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","formatElement","join","toBeEnabled","isEnabled","isHostTextInput","isTextInputEditable","accessibilityState","ariaDisabled","props","disabled","parent","getHostParent"],"sources":["../../src/matchers/to-be-disabled.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { isTextInputEditable } from '../helpers/text-input';\nimport { getHostParent } from '../helpers/component-tree';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeDisabled, this);\n\n const isDisabled = isElementDisabled(element) || isAncestorDisabled(element);\n\n return {\n pass: isDisabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''),\n '',\n `Received element ${is} disabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeEnabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEnabled, this);\n\n const isEnabled = !isElementDisabled(element) && !isAncestorDisabled(element);\n\n return {\n pass: isEnabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''),\n '',\n `Received element ${is} enabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isElementDisabled(element: ReactTestInstance) {\n if (isHostTextInput(element) && !isTextInputEditable(element)) {\n return true;\n }\n\n const { accessibilityState, 'aria-disabled': ariaDisabled } = element.props;\n return ariaDisabled ?? accessibilityState?.disabled ?? false;\n}\n\nfunction isAncestorDisabled(element: ReactTestInstance): boolean {\n const parent = getHostParent(element);\n if (parent == null) {\n return false;\n }\n\n return isElementDisabled(parent) || isAncestorDisabled(parent);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,MAAMG,UAAU,GAAGC,iBAAiB,CAACH,OAAO,CAAC,IAAII,kBAAkB,CAACJ,OAAO,CAAC;EAE5E,OAAO;IACLK,IAAI,EAAEH,UAAU;IAChBI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_hostComponentNames","_textInput","_componentTree","_utils","toBeDisabled","element","checkHostElement","isDisabled","isElementDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","formatElement","join","toBeEnabled","isEnabled","isHostTextInput","isTextInputEditable","accessibilityState","ariaDisabled","props","disabled","parent","getHostParent"],"sources":["../../src/matchers/to-be-disabled.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { isTextInputEditable } from '../helpers/text-input';\nimport { getHostParent } from '../helpers/component-tree';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeDisabled, this);\n\n const isDisabled = isElementDisabled(element) || isAncestorDisabled(element);\n\n return {\n pass: isDisabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''),\n '',\n `Received element ${is} disabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeEnabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEnabled, this);\n\n const isEnabled = !isElementDisabled(element) && !isAncestorDisabled(element);\n\n return {\n pass: isEnabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''),\n '',\n `Received element ${is} enabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isElementDisabled(element: ReactTestInstance) {\n if (isHostTextInput(element) && !isTextInputEditable(element)) {\n return true;\n }\n\n const { accessibilityState, 'aria-disabled': ariaDisabled } = element.props;\n return ariaDisabled ?? accessibilityState?.disabled ?? false;\n}\n\nfunction isAncestorDisabled(element: ReactTestInstance): boolean {\n const parent = getHostParent(element);\n if (parent == null) {\n return false;\n }\n\n return isElementDisabled(parent) || isAncestorDisabled(parent);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,MAAMG,UAAU,GAAGC,iBAAiB,CAACH,OAAO,CAAC,IAAII,kBAAkB,CAACJ,OAAO,CAAC;EAE5E,OAAO;IACLK,IAAI,EAAEH,UAAU;IAChBI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC,EACtE,EAAE,EACF,oBAAoBD,EAAE,YAAY,EAClC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,WAAWA,CAA4BZ,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAEY,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMC,SAAS,GAAG,CAACV,iBAAiB,CAACH,OAAO,CAAC,IAAI,CAACI,kBAAkB,CAACJ,OAAO,CAAC;EAE7E,OAAO;IACLK,IAAI,EAAEQ,SAAS;IACfP,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASR,iBAAiBA,CAACH,OAA0B,EAAE;EACrD,IAAI,IAAAc,mCAAe,EAACd,OAAO,CAAC,IAAI,CAAC,IAAAe,8BAAmB,EAACf,OAAO,CAAC,EAAE;IAC7D,OAAO,IAAI;EACb;EAEA,MAAM;IAAEgB,kBAAkB;IAAE,eAAe,EAAEC;EAAa,CAAC,GAAGjB,OAAO,CAACkB,KAAK;EAC3E,OAAOD,YAAY,IAAID,kBAAkB,EAAEG,QAAQ,IAAI,KAAK;AAC9D;AAEA,SAASf,kBAAkBA,CAACJ,OAA0B,EAAW;EAC/D,MAAMoB,MAAM,GAAG,IAAAC,4BAAa,EAACrB,OAAO,CAAC;EACrC,IAAIoB,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,KAAK;EACd;EAEA,OAAOjB,iBAAiB,CAACiB,MAAM,CAAC,IAAIhB,kBAAkB,CAACgB,MAAM,CAAC;AAChE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_componentTree","_utils","toBeEmptyElement","element","checkHostElement","hostChildren","getHostChildren","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElementArray","join"],"sources":["../../src/matchers/to-be-empty-element.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getHostChildren } from '../helpers/component-tree';\nimport { checkHostElement, formatElementArray } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEmptyElement, this);\n\n const hostChildren = getHostChildren(element);\n\n return {\n pass: hostChildren.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(formatElementArray(hostChildren))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,gBAAgBA,CAA4BC,OAA0B,EAAE;EACtF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEjD,MAAMG,YAAY,GAAG,IAAAC,8BAAe,EAACH,OAAO,CAAC;EAE7C,OAAO;IACLI,IAAI,EAAEF,YAAY,CAACG,MAAM,KAAK,CAAC;IAC/BC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_componentTree","_utils","toBeEmptyElement","element","checkHostElement","hostChildren","getHostChildren","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElementArray","join"],"sources":["../../src/matchers/to-be-empty-element.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getHostChildren } from '../helpers/component-tree';\nimport { checkHostElement, formatElementArray } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEmptyElement, this);\n\n const hostChildren = getHostChildren(element);\n\n return {\n pass: hostChildren.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(formatElementArray(hostChildren))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,gBAAgBA,CAA4BC,OAA0B,EAAE;EACtF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEjD,MAAMG,YAAY,GAAG,IAAAC,8BAAe,EAACH,OAAO,CAAC;EAE7C,OAAO;IACLI,IAAI,EAAEF,YAAY,CAACG,MAAM,KAAK,CAAC;IAC/BC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC1E,EAAE,EACF,WAAW,EACX,GAAG,IAAAC,gCAAc,EAAC,IAAAC,yBAAkB,EAACR,YAAY,CAAC,CAAC,EAAE,CACtD,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeExpanded","element","checkHostElement","pass","isElementExpanded","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-expanded.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementExpanded } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeExpanded, this);\n\n return {\n pass: isElementExpanded(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}expanded:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,gCAAiB,EAACH,OAAO,CAAC;IAChCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeExpanded","element","checkHostElement","pass","isElementExpanded","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-expanded.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementExpanded } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeExpanded, this);\n\n return {\n pass: isElementExpanded(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}expanded:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,gCAAiB,EAACH,OAAO,CAAC;IAChCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC;MACtF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,WAAW,EAC1D,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_componentTree","_screen","_utils","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","UNSAFE_root","getUnsafeRootElement","errorFound","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getUnsafeRootElement } from '../helpers/component-tree';\nimport { screen } from '../screen';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeOnTheScreen, this);\n }\n\n const pass = element === null ? false : screen.UNSAFE_root === getUnsafeRootElement(element);\n\n const errorFound = () => {\n return `expected element tree not to contain element, but found\\n${formatElement(element)}`;\n };\n\n const errorNotFound = () => {\n return `element could not be found in the element tree`;\n };\n\n return {\n pass,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'element', ''),\n '',\n RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,eAAeA,CAA4BC,OAA0B,EAAE;EACrF,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,eAAe,EAAE,IAAI,CAAC;EAClD;EAEA,MAAMI,IAAI,GAAGH,OAAO,KAAK,IAAI,GAAG,KAAK,GAAGI,cAAM,CAACC,WAAW,KAAK,IAAAC,mCAAoB,EAACN,OAAO,CAAC;EAE5F,MAAMO,UAAU,GAAGA,CAAA,KAAM;IACvB,
|
|
1
|
+
{"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_componentTree","_screen","_utils","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","UNSAFE_root","getUnsafeRootElement","errorFound","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getUnsafeRootElement } from '../helpers/component-tree';\nimport { screen } from '../screen';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeOnTheScreen, this);\n }\n\n const pass = element === null ? false : screen.UNSAFE_root === getUnsafeRootElement(element);\n\n const errorFound = () => {\n return `expected element tree not to contain element, but found\\n${formatElement(element)}`;\n };\n\n const errorNotFound = () => {\n return `element could not be found in the element tree`;\n };\n\n return {\n pass,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'element', ''),\n '',\n RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,eAAeA,CAA4BC,OAA0B,EAAE;EACrF,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,eAAe,EAAE,IAAI,CAAC;EAClD;EAEA,MAAMI,IAAI,GAAGH,OAAO,KAAK,IAAI,GAAG,KAAK,GAAGI,cAAM,CAACC,WAAW,KAAK,IAAAC,mCAAoB,EAACN,OAAO,CAAC;EAE5F,MAAMO,UAAU,GAAGA,CAAA,KAAM;IACvB,OAAO,4DAA4D,IAAAC,oBAAa,EAACR,OAAO,CAAC,EAAE;EAC7F,CAAC;EAED,MAAMS,aAAa,GAAGA,CAAA,KAAM;IAC1B,OAAO,gDAAgD;EACzD,CAAC;EAED,OAAO;IACLN,IAAI;IACJO,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACV,KAAK,GAAG,MAAM,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,CAAC,EACzE,EAAE,EACF,IAAAW,gCAAc,EAAC,IAAI,CAACX,KAAK,GAAGM,UAAU,CAAC,CAAC,GAAGE,aAAa,CAAC,CAAC,CAAC,CAC5D,CAACI,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-partially-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_utils","toBePartiallyChecked","element","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","getAccessibilityCheckedState","message","is","isNot","matcherHint","formatElement","join","role","getAccessibilityRole","isAccessibilityElement"],"sources":["../../src/matchers/to-be-partially-checked.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport {\n getAccessibilityCheckedState,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBePartiallyChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBePartiallyChecked, this);\n\n if (!hasValidAccessibilityRole(element)) {\n throw new ErrorWithStack(\n 'toBePartiallyChecked() works only on accessibility elements with \"checkbox\" role.',\n toBePartiallyChecked,\n );\n }\n\n return {\n pass: getAccessibilityCheckedState(element) === 'mixed',\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''),\n '',\n `Received element ${is} partially checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction hasValidAccessibilityRole(element: ReactTestInstance) {\n const role = getAccessibilityRole(element);\n return isAccessibilityElement(element) && role === 'checkbox';\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAA4BC,OAA0B,EAAE;EAC1F,IAAAC,uBAAgB,EAACD,OAAO,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAErD,IAAI,CAACG,yBAAyB,CAACF,OAAO,CAAC,EAAE;IACvC,MAAM,IAAIG,sBAAc,CACtB,mFAAmF,EACnFJ,oBACF,CAAC;EACH;EAEA,OAAO;IACLK,IAAI,EAAE,IAAAC,2CAA4B,EAACL,OAAO,CAAC,KAAK,OAAO;IACvDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-partially-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_utils","toBePartiallyChecked","element","checkHostElement","hasValidAccessibilityRole","ErrorWithStack","pass","getAccessibilityCheckedState","message","is","isNot","matcherHint","formatElement","join","role","getAccessibilityRole","isAccessibilityElement"],"sources":["../../src/matchers/to-be-partially-checked.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport {\n getAccessibilityCheckedState,\n getAccessibilityRole,\n isAccessibilityElement,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBePartiallyChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBePartiallyChecked, this);\n\n if (!hasValidAccessibilityRole(element)) {\n throw new ErrorWithStack(\n 'toBePartiallyChecked() works only on accessibility elements with \"checkbox\" role.',\n toBePartiallyChecked,\n );\n }\n\n return {\n pass: getAccessibilityCheckedState(element) === 'mixed',\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''),\n '',\n `Received element ${is} partially checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction hasValidAccessibilityRole(element: ReactTestInstance) {\n const role = getAccessibilityRole(element);\n return isAccessibilityElement(element) && role === 'checkbox';\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAA4BC,OAA0B,EAAE;EAC1F,IAAAC,uBAAgB,EAACD,OAAO,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAErD,IAAI,CAACG,yBAAyB,CAACF,OAAO,CAAC,EAAE;IACvC,MAAM,IAAIG,sBAAc,CACtB,mFAAmF,EACnFJ,oBACF,CAAC;EACH;EAEA,OAAO;IACLK,IAAI,EAAE,IAAAC,2CAA4B,EAACL,OAAO,CAAC,KAAK,OAAO;IACvDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,uBAAuB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC9E,EAAE,EACF,oBAAoBD,EAAE,qBAAqB,EAC3C,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,yBAAyBA,CAACF,OAA0B,EAAE;EAC7D,MAAMY,IAAI,GAAG,IAAAC,mCAAoB,EAACb,OAAO,CAAC;EAC1C,OAAO,IAAAc,qCAAsB,EAACd,OAAO,CAAC,IAAIY,IAAI,KAAK,UAAU;AAC/D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-selected.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeSelected","element","checkHostElement","pass","isElementSelected","message","is","isNot","matcherHint","formatElement","join"],"sources":["../../src/matchers/to-be-selected.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementSelected } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeSelected(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeSelected, this);\n\n return {\n pass: isElementSelected(element),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeSelected`, 'element', ''),\n '',\n `Received element ${is} selected`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,gCAAiB,EAACH,OAAO,CAAC;IAChCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-selected.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeSelected","element","checkHostElement","pass","isElementSelected","message","is","isNot","matcherHint","formatElement","join"],"sources":["../../src/matchers/to-be-selected.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isElementSelected } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeSelected(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeSelected, this);\n\n return {\n pass: isElementSelected(element),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeSelected`, 'element', ''),\n '',\n `Received element ${is} selected`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,gCAAiB,EAACH,OAAO,CAAC;IAChCI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC,EACtE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-visible.js","names":["_jestMatcherUtils","require","_reactNative","_accessibility","_componentTree","_hostComponentNames","_utils","toBeVisible","element","isNot","checkHostElement","pass","isElementVisible","message","is","matcherHint","formatElement","join","accessibilityCache","cache","WeakMap","isHiddenFromAccessibility","isHiddenForStyles","isHostModal","props","visible","hostParent","getHostParent","flatStyle","StyleSheet","flatten","style","display","opacity"],"sources":["../../src/matchers/to-be-visible.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { StyleSheet } from 'react-native';\nimport { isHiddenFromAccessibility } from '../helpers/accessibility';\nimport { getHostParent } from '../helpers/component-tree';\nimport { isHostModal } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeVisible(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeVisible, this);\n }\n\n return {\n pass: isElementVisible(element),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''),\n '',\n `Received element ${is} visible:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isElementVisible(\n element: ReactTestInstance,\n accessibilityCache?: WeakMap<ReactTestInstance, boolean>,\n): boolean {\n // Use cache to speed up repeated searches by `isHiddenFromAccessibility`.\n const cache = accessibilityCache ?? new WeakMap<ReactTestInstance, boolean>();\n if (isHiddenFromAccessibility(element, { cache })) {\n return false;\n }\n\n if (isHiddenForStyles(element)) {\n return false;\n }\n\n // Note: this seems to be a bug in React Native.\n // PR with fix: https://github.com/facebook/react-native/pull/39157\n if (isHostModal(element) && element.props.visible === false) {\n return false;\n }\n\n const hostParent = getHostParent(element);\n if (hostParent === null) {\n return true;\n }\n\n return isElementVisible(hostParent, cache);\n}\n\nfunction isHiddenForStyles(element: ReactTestInstance) {\n const flatStyle = StyleSheet.flatten(element.props.style);\n return flatStyle?.display === 'none' || flatStyle?.opacity === 0;\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAC9C;EAEA,OAAO;IACLI,IAAI,EAAEC,gBAAgB,CAACJ,OAAO,CAAC;IAC/BK,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACL,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAM,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-be-visible.js","names":["_jestMatcherUtils","require","_reactNative","_accessibility","_componentTree","_hostComponentNames","_utils","toBeVisible","element","isNot","checkHostElement","pass","isElementVisible","message","is","matcherHint","formatElement","join","accessibilityCache","cache","WeakMap","isHiddenFromAccessibility","isHiddenForStyles","isHostModal","props","visible","hostParent","getHostParent","flatStyle","StyleSheet","flatten","style","display","opacity"],"sources":["../../src/matchers/to-be-visible.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { StyleSheet } from 'react-native';\nimport { isHiddenFromAccessibility } from '../helpers/accessibility';\nimport { getHostParent } from '../helpers/component-tree';\nimport { isHostModal } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeVisible(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeVisible, this);\n }\n\n return {\n pass: isElementVisible(element),\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeVisible`, 'element', ''),\n '',\n `Received element ${is} visible:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isElementVisible(\n element: ReactTestInstance,\n accessibilityCache?: WeakMap<ReactTestInstance, boolean>,\n): boolean {\n // Use cache to speed up repeated searches by `isHiddenFromAccessibility`.\n const cache = accessibilityCache ?? new WeakMap<ReactTestInstance, boolean>();\n if (isHiddenFromAccessibility(element, { cache })) {\n return false;\n }\n\n if (isHiddenForStyles(element)) {\n return false;\n }\n\n // Note: this seems to be a bug in React Native.\n // PR with fix: https://github.com/facebook/react-native/pull/39157\n if (isHostModal(element) && element.props.visible === false) {\n return false;\n }\n\n const hostParent = getHostParent(element);\n if (hostParent === null) {\n return true;\n }\n\n return isElementVisible(hostParent, cache);\n}\n\nfunction isHiddenForStyles(element: ReactTestInstance) {\n const flatStyle = StyleSheet.flatten(element.props.style);\n return flatStyle?.display === 'none' || flatStyle?.opacity === 0;\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,WAAWA,CAA4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ACrD,MAAMoB,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACtB,OAAO,CAACgB,KAAK,CAACO,KAAK,CAAC;EACzD,OAAOH,SAAS,EAAEI,OAAO,KAAK,MAAM,IAAIJ,SAAS,EAAEK,OAAO,KAAK,CAAC;AAClE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-contain-element.js","names":["_jestMatcherUtils","require","_utils","toContainElement","container","element","checkHostElement","matches","findAll","node","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElement","join"],"sources":["../../src/matchers/to-contain-element.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toContainElement(\n this: jest.MatcherContext,\n container: ReactTestInstance,\n element: ReactTestInstance | null,\n) {\n checkHostElement(container, toContainElement, this);\n\n if (element !== null) {\n checkHostElement(element, toContainElement, this);\n }\n\n let matches: ReactTestInstance[] = [];\n if (element) {\n matches = container.findAll((node) => node === element);\n }\n\n return {\n pass: matches.length > 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'element'),\n '',\n RECEIVED_COLOR(`${formatElement(container)} ${\n this.isNot ? '\\n\\ncontains:\\n\\n' : '\\n\\ndoes not contain:\\n\\n'\n } ${formatElement(element)}\n `),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,gBAAgBA,CAE9BC,SAA4B,EAC5BC,OAAiC,EACjC;EACA,IAAAC,uBAAgB,EAACF,SAAS,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEnD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,IAAAC,uBAAgB,EAACD,OAAO,EAAEF,gBAAgB,EAAE,IAAI,CAAC;EACnD;EAEA,IAAII,OAA4B,GAAG,EAAE;EACrC,IAAIF,OAAO,EAAE;IACXE,OAAO,GAAGH,SAAS,CAACI,OAAO,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,OAAO,CAAC;EACzD;EAEA,OAAO;IACLK,IAAI,EAAEH,OAAO,CAACI,MAAM,GAAG,CAAC;IACxBC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-contain-element.js","names":["_jestMatcherUtils","require","_utils","toContainElement","container","element","checkHostElement","matches","findAll","node","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElement","join"],"sources":["../../src/matchers/to-contain-element.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toContainElement(\n this: jest.MatcherContext,\n container: ReactTestInstance,\n element: ReactTestInstance | null,\n) {\n checkHostElement(container, toContainElement, this);\n\n if (element !== null) {\n checkHostElement(element, toContainElement, this);\n }\n\n let matches: ReactTestInstance[] = [];\n if (element) {\n matches = container.findAll((node) => node === element);\n }\n\n return {\n pass: matches.length > 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toContainElement`, 'container', 'element'),\n '',\n RECEIVED_COLOR(`${formatElement(container)} ${\n this.isNot ? '\\n\\ncontains:\\n\\n' : '\\n\\ndoes not contain:\\n\\n'\n } ${formatElement(element)}\n `),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,gBAAgBA,CAE9BC,SAA4B,EAC5BC,OAAiC,EACjC;EACA,IAAAC,uBAAgB,EAACF,SAAS,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEnD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,IAAAC,uBAAgB,EAACD,OAAO,EAAEF,gBAAgB,EAAE,IAAI,CAAC;EACnD;EAEA,IAAII,OAA4B,GAAG,EAAE;EACrC,IAAIF,OAAO,EAAE;IACXE,OAAO,GAAGH,SAAS,CAACI,OAAO,CAAEC,IAAI,IAAKA,IAAI,KAAKJ,OAAO,CAAC;EACzD;EAEA,OAAO;IACLK,IAAI,EAAEH,OAAO,CAACI,MAAM,GAAG,CAAC;IACxBC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,WAAW,EAAE,SAAS,CAAC,EACnF,EAAE,EACF,IAAAC,gCAAc,EAAC,GAAG,IAAAC,oBAAa,EAACZ,SAAS,CAAC,IACxC,IAAI,CAACU,KAAK,GAAG,mBAAmB,GAAG,2BAA2B,IAC5D,IAAAE,oBAAa,EAACX,OAAO,CAAC;AAClC,SAAS,CAAC,CACH,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
1
|
import type { ReactTestInstance } from 'react-test-renderer';
|
|
3
2
|
import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
|
|
4
3
|
export declare function toHaveAccessibilityValue(this: jest.MatcherContext, element: ReactTestInstance, expectedValue: AccessibilityValueMatcher): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessibility-value.js","names":["_jestMatcherUtils","require","_accessibility","_matchAccessibilityValue","_object","_utils","toHaveAccessibilityValue","element","expectedValue","checkHostElement","receivedValue","getAccessibilityValue","pass","matchAccessibilityValue","message","matcher","matcherHint","isNot","stringify","formatMessage","removeUndefinedKeys"],"sources":["../../src/matchers/to-have-accessibility-value.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, stringify } from 'jest-matcher-utils';\nimport { getAccessibilityValue } from '../helpers/accessibility';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/match-accessibility-value';\nimport { removeUndefinedKeys } from '../helpers/object';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibilityValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: AccessibilityValueMatcher,\n) {\n checkHostElement(element, toHaveAccessibilityValue, this);\n\n const receivedValue = getAccessibilityValue(element);\n\n return {\n pass: matchAccessibilityValue(element, expectedValue),\n message: () => {\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`,\n 'element',\n stringify(expectedValue),\n );\n return formatMessage(\n matcher,\n `Expected the element ${this.isNot ? 'not to' : 'to'} have accessibility value`,\n stringify(expectedValue),\n 'Received element with accessibility value',\n stringify(removeUndefinedKeys(receivedValue)),\n );\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,OAA0B,EAC1BC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAEzD,MAAMI,aAAa,GAAG,IAAAC,oCAAqB,EAACJ,OAAO,CAAC;EAEpD,OAAO;IACLK,IAAI,EAAE,IAAAC,gDAAuB,EAACN,OAAO,EAAEC,aAAa,CAAC;IACrDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-have-accessibility-value.js","names":["_jestMatcherUtils","require","_accessibility","_matchAccessibilityValue","_object","_utils","toHaveAccessibilityValue","element","expectedValue","checkHostElement","receivedValue","getAccessibilityValue","pass","matchAccessibilityValue","message","matcher","matcherHint","isNot","stringify","formatMessage","removeUndefinedKeys"],"sources":["../../src/matchers/to-have-accessibility-value.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, stringify } from 'jest-matcher-utils';\nimport { getAccessibilityValue } from '../helpers/accessibility';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/match-accessibility-value';\nimport { removeUndefinedKeys } from '../helpers/object';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibilityValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: AccessibilityValueMatcher,\n) {\n checkHostElement(element, toHaveAccessibilityValue, this);\n\n const receivedValue = getAccessibilityValue(element);\n\n return {\n pass: matchAccessibilityValue(element, expectedValue),\n message: () => {\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`,\n 'element',\n stringify(expectedValue),\n );\n return formatMessage(\n matcher,\n `Expected the element ${this.isNot ? 'not to' : 'to'} have accessibility value`,\n stringify(expectedValue),\n 'Received element with accessibility value',\n stringify(removeUndefinedKeys(receivedValue)),\n );\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,OAA0B,EAC1BC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAEzD,MAAMI,aAAa,GAAG,IAAAC,oCAAqB,EAACJ,OAAO,CAAC;EAEpD,OAAO;IACLK,IAAI,EAAE,IAAAC,gDAAuB,EAACN,OAAO,EAAEC,aAAa,CAAC;IACrDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACzB,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,2BAA2B,EACtD,SAAS,EACT,IAAAC,2BAAS,EAACV,aAAa,CACzB,CAAC;MACD,OAAO,IAAAW,oBAAa,EAClBJ,OAAO,EACP,wBAAwB,IAAI,CAACE,KAAK,GAAG,QAAQ,GAAG,IAAI,2BAA2B,EAC/E,IAAAC,2BAAS,EAACV,aAAa,CAAC,EACxB,2CAA2C,EAC3C,IAAAU,2BAAS,EAAC,IAAAE,2BAAmB,EAACV,aAAa,CAAC,CAC9C,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
1
|
import type { ReactTestInstance } from 'react-test-renderer';
|
|
3
2
|
import { TextMatch, TextMatchOptions } from '../matches';
|
|
4
3
|
export declare function toHaveAccessibleName(this: jest.MatcherContext, element: ReactTestInstance, expectedName?: TextMatch, options?: TextMatchOptions): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-name.js","names":["_jestMatcherUtils","require","_accessibility","_matches","_utils","toHaveAccessibleName","element","expectedName","options","checkHostElement","receivedName","getAccessibleName","missingExpectedValue","arguments","length","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-accessible-name.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { getAccessibleName } from '../helpers/accessibility';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibleName(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedName?: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveAccessibleName, this);\n\n const receivedName = getAccessibleName(element);\n const missingExpectedValue = arguments.length === 1;\n\n let pass = false;\n if (missingExpectedValue) {\n pass = receivedName !== '';\n } else {\n pass =\n expectedName != null\n ? matches(expectedName, receivedName, options?.normalizer, options?.exact)\n : false;\n }\n\n return {\n pass,\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveAccessibleName`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have accessible name`,\n expectedName,\n 'Received',\n receivedName,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAElCC,OAA0B,EAC1BC,YAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAErD,MAAMK,YAAY,GAAG,IAAAC,gCAAiB,EAACL,OAAO,CAAC;EAC/C,MAAMM,oBAAoB,GAAGC,SAAS,CAACC,MAAM,KAAK,CAAC;EAEnD,IAAIC,IAAI,GAAG,KAAK;EAChB,IAAIH,oBAAoB,EAAE;IACxBG,IAAI,GAAGL,YAAY,KAAK,EAAE;EAC5B,CAAC,MAAM;IACLK,IAAI,GACFR,YAAY,IAAI,IAAI,GAChB,IAAAS,gBAAO,EAACT,YAAY,EAAEG,YAAY,EAAEF,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC,GACxE,KAAK;EACb;EAEA,OAAO;IACLH,IAAI;IACJI,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,
|
|
1
|
+
{"version":3,"file":"to-have-accessible-name.js","names":["_jestMatcherUtils","require","_accessibility","_matches","_utils","toHaveAccessibleName","element","expectedName","options","checkHostElement","receivedName","getAccessibleName","missingExpectedValue","arguments","length","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-accessible-name.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { getAccessibleName } from '../helpers/accessibility';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibleName(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedName?: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveAccessibleName, this);\n\n const receivedName = getAccessibleName(element);\n const missingExpectedValue = arguments.length === 1;\n\n let pass = false;\n if (missingExpectedValue) {\n pass = receivedName !== '';\n } else {\n pass =\n expectedName != null\n ? matches(expectedName, receivedName, options?.normalizer, options?.exact)\n : false;\n }\n\n return {\n pass,\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveAccessibleName`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have accessible name`,\n expectedName,\n 'Received',\n receivedName,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,oBAAoBA,CAElCC,OAA0B,EAC1BC,YAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,oBAAoB,EAAE,IAAI,CAAC;EAErD,MAAMK,YAAY,GAAG,IAAAC,gCAAiB,EAACL,OAAO,CAAC;EAC/C,MAAMM,oBAAoB,GAAGC,SAAS,CAACC,MAAM,KAAK,CAAC;EAEnD,IAAIC,IAAI,GAAG,KAAK;EAChB,IAAIH,oBAAoB,EAAE;IACxBG,IAAI,GAAGL,YAAY,KAAK,EAAE;EAC5B,CAAC,MAAM;IACLK,IAAI,GACFR,YAAY,IAAI,IAAI,GAChB,IAAAS,gBAAO,EAACT,YAAY,EAAEG,YAAY,EAAEF,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC,GACxE,KAAK;EACb;EAEA,OAAO;IACLH,IAAI;IACJI,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,uBAAuB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC9E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,uBAAuB,EACvEf,YAAY,EACZ,UAAU,EACVG,YACF,CAAC,CACF,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
1
|
import type { ReactTestInstance } from 'react-test-renderer';
|
|
3
2
|
import { TextMatch, TextMatchOptions } from '../matches';
|
|
4
3
|
export declare function toHaveDisplayValue(this: jest.MatcherContext, element: ReactTestInstance, expectedValue: TextMatch, options?: TextMatchOptions): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-display-value.js","names":["_jestMatcherUtils","require","_hostComponentNames","_errors","_textInput","_matches","_utils","toHaveDisplayValue","element","expectedValue","options","checkHostElement","isHostTextInput","ErrorWithStack","type","receivedValue","getTextInputValue","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-display-value.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { getTextInputValue } from '../helpers/text-input';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveDisplayValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveDisplayValue, this);\n\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `toHaveDisplayValue() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n toHaveDisplayValue,\n );\n }\n\n const receivedValue = getTextInputValue(element);\n\n return {\n pass: matches(expectedValue, receivedValue, options?.normalizer, options?.exact),\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have display value`,\n expectedValue,\n 'Received',\n receivedValue,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,kBAAkBA,CAEhCC,OAA0B,EAC1BC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,kBAAkB,EAAE,IAAI,CAAC;EAEnD,IAAI,CAAC,IAAAK,mCAAe,EAACJ,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,sBAAc,
|
|
1
|
+
{"version":3,"file":"to-have-display-value.js","names":["_jestMatcherUtils","require","_hostComponentNames","_errors","_textInput","_matches","_utils","toHaveDisplayValue","element","expectedValue","options","checkHostElement","isHostTextInput","ErrorWithStack","type","receivedValue","getTextInputValue","pass","matches","normalizer","exact","message","formatMessage","matcherHint","isNot","join"],"sources":["../../src/matchers/to-have-display-value.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { getTextInputValue } from '../helpers/text-input';\nimport { TextMatch, TextMatchOptions, matches } from '../matches';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveDisplayValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: TextMatch,\n options?: TextMatchOptions,\n) {\n checkHostElement(element, toHaveDisplayValue, this);\n\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `toHaveDisplayValue() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n toHaveDisplayValue,\n );\n }\n\n const receivedValue = getTextInputValue(element);\n\n return {\n pass: matches(expectedValue, receivedValue, options?.normalizer, options?.exact),\n message: () => {\n return [\n formatMessage(\n matcherHint(`${this.isNot ? '.not' : ''}.toHaveDisplayValue`, 'element', ''),\n `Expected element ${this.isNot ? 'not to' : 'to'} have display value`,\n expectedValue,\n 'Received',\n receivedValue,\n ),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEO,SAASM,kBAAkBA,CAEhCC,OAA0B,EAC1BC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,IAAAC,uBAAgB,EAACH,OAAO,EAAED,kBAAkB,EAAE,IAAI,CAAC;EAEnD,IAAI,CAAC,IAAAK,mCAAe,EAACJ,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,sBAAc,CACtB,4FAA4FL,OAAO,CAACM,IAAI,IAAI,EAC5GP,kBACF,CAAC;EACH;EAEA,MAAMQ,aAAa,GAAG,IAAAC,4BAAiB,EAACR,OAAO,CAAC;EAEhD,OAAO;IACLS,IAAI,EAAE,IAAAC,gBAAO,EAACT,aAAa,EAAEM,aAAa,EAAEL,OAAO,EAAES,UAAU,EAAET,OAAO,EAAEU,KAAK,CAAC;IAChFC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,oBAAa,EACX,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC5E,oBAAoB,IAAI,CAACA,KAAK,GAAG,QAAQ,GAAG,IAAI,qBAAqB,EACrEf,aAAa,EACb,UAAU,EACVM,aACF,CAAC,CACF,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
|