@ctrl/dom 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +338 -0
- package/README.md +362 -2
- package/dist/aria/_chunks/roles-list-CYZF-l9K.js +1503 -0
- package/dist/aria/_chunks/roles-list-D4WCyRO_.cjs +1754 -0
- package/dist/aria/index.cjs +232 -0
- package/dist/aria/index.js +198 -0
- package/dist/aria/internal.cjs +69 -0
- package/dist/aria/internal.js +30 -0
- package/dist/aria/types/accname.d.ts +40 -0
- package/dist/aria/types/data/aria-query.d.ts +61 -0
- package/dist/aria/types/data/aria-query.generated.d.ts +2 -0
- package/dist/aria/types/forms.d.ts +25 -0
- package/dist/aria/types/hidden.d.ts +38 -0
- package/dist/aria/types/index.d.ts +46 -0
- package/dist/aria/types/internal.d.ts +15 -0
- package/dist/aria/types/role.d.ts +27 -0
- package/dist/aria/types/roles-list.d.ts +18 -0
- package/dist/aria/types/states.d.ts +29 -0
- package/dist/aria/types/style.d.ts +18 -0
- package/dist/aria/types/tree.d.ts +20 -0
- package/dist/bridge/index.cjs +3 -0
- package/dist/bridge/index.js +4 -0
- package/dist/bridge/internal.cjs +3 -0
- package/dist/bridge/internal.js +4 -0
- package/dist/cli/_chunks/report-DdncYfuJ.js +93 -0
- package/dist/cli/ctrl-dom.js +199 -0
- package/dist/cli/jest-reporter.js +55 -0
- package/dist/cli/vitest-reporter.js +81 -0
- package/dist/dom/_chunks/src-DWP2w3IQ.js +47516 -0
- package/dist/dom/index.js +3 -0
- package/dist/dom/internal.js +434 -0
- package/dist/dom/types/collections/DOMStringMap.d.ts +8 -0
- package/dist/dom/types/collections/DOMTokenList.d.ts +33 -0
- package/dist/dom/types/collections/HTMLCollection.d.ts +62 -0
- package/dist/dom/types/collections/NamedNodeMap.d.ts +22 -0
- package/dist/dom/types/collections/NodeList.d.ts +43 -0
- package/dist/dom/types/collections/indexed.d.ts +8 -0
- package/dist/dom/types/collections/iterator.d.ts +8 -0
- package/dist/dom/types/css/CSS.d.ts +21 -0
- package/dist/dom/types/css/CSSStyleDeclaration.d.ts +57 -0
- package/dist/dom/types/css/cascade.d.ts +159 -0
- package/dist/dom/types/css/colors.d.ts +28 -0
- package/dist/dom/types/css/computed.d.ts +22 -0
- package/dist/dom/types/css/cssom.d.ts +363 -0
- package/dist/dom/types/css/data/properties.d.ts +1 -0
- package/dist/dom/types/css/declarations.d.ts +40 -0
- package/dist/dom/types/css/index.d.ts +5 -0
- package/dist/dom/types/css/inline-count.d.ts +2 -0
- package/dist/dom/types/css/internal.d.ts +11 -0
- package/dist/dom/types/css/layout-mode.d.ts +4 -0
- package/dist/dom/types/css/layout.d.ts +63 -0
- package/dist/dom/types/css/media.d.ts +55 -0
- package/dist/dom/types/css/parser.d.ts +93 -0
- package/dist/dom/types/css/properties.d.ts +28 -0
- package/dist/dom/types/css/resize-observer.d.ts +19 -0
- package/dist/dom/types/css/selector-info.d.ts +13 -0
- package/dist/dom/types/css/shorthands.d.ts +33 -0
- package/dist/dom/types/css/stylesheets.d.ts +93 -0
- package/dist/dom/types/css/supports.d.ts +4 -0
- package/dist/dom/types/css/tokenizer.d.ts +91 -0
- package/dist/dom/types/css/values.d.ts +91 -0
- package/dist/dom/types/css/view.d.ts +44 -0
- package/dist/dom/types/events/DataTransfer.d.ts +62 -0
- package/dist/dom/types/events/Event.d.ts +115 -0
- package/dist/dom/types/events/EventTarget.d.ts +22 -0
- package/dist/dom/types/events/UIEvents.d.ts +308 -0
- package/dist/dom/types/events/activation.d.ts +7 -0
- package/dist/dom/types/events/convert.d.ts +16 -0
- package/dist/dom/types/events/createEvent.d.ts +3 -0
- package/dist/dom/types/events/dispatch.d.ts +39 -0
- package/dist/dom/types/events/events.d.ts +200 -0
- package/dist/dom/types/events/fire.d.ts +21 -0
- package/dist/dom/types/events/handlers.d.ts +14 -0
- package/dist/dom/types/events/listeners.d.ts +32 -0
- package/dist/dom/types/events/report.d.ts +10 -0
- package/dist/dom/types/html/HTMLElement.d.ts +126 -0
- package/dist/dom/types/html/MathMLElement.d.ts +6 -0
- package/dist/dom/types/html/SVGElement.d.ts +145 -0
- package/dist/dom/types/html/anchor.d.ts +16 -0
- package/dist/dom/types/html/aria-reflection.d.ts +14 -0
- package/dist/dom/types/html/collection.d.ts +5 -0
- package/dist/dom/types/html/custom-elements.d.ts +129 -0
- package/dist/dom/types/html/elements.d.ts +202 -0
- package/dist/dom/types/html/events.d.ts +22 -0
- package/dist/dom/types/html/focus.d.ts +63 -0
- package/dist/dom/types/html/forms/FileList.d.ts +1 -0
- package/dist/dom/types/html/forms/FormData.d.ts +7 -0
- package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +36 -0
- package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +29 -0
- package/dist/dom/types/html/forms/HTMLFormElement.d.ts +61 -0
- package/dist/dom/types/html/forms/HTMLInputElement.d.ts +204 -0
- package/dist/dom/types/html/forms/HTMLLabelElement.d.ts +15 -0
- package/dist/dom/types/html/forms/HTMLOptionElement.d.ts +61 -0
- package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +74 -0
- package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +96 -0
- package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +82 -0
- package/dist/dom/types/html/forms/autofill.d.ts +10 -0
- package/dist/dom/types/html/forms/collections.d.ts +112 -0
- package/dist/dom/types/html/forms/common.d.ts +36 -0
- package/dist/dom/types/html/forms/face.d.ts +59 -0
- package/dist/dom/types/html/forms/form-associated.d.ts +46 -0
- package/dist/dom/types/html/forms/form-submission.d.ts +55 -0
- package/dist/dom/types/html/forms/index.d.ts +17 -0
- package/dist/dom/types/html/forms/input-type.d.ts +50 -0
- package/dist/dom/types/html/forms/microsyntaxes.d.ts +52 -0
- package/dist/dom/types/html/forms/state.d.ts +54 -0
- package/dist/dom/types/html/forms/ui.d.ts +35 -0
- package/dist/dom/types/html/forms/user-validity.d.ts +19 -0
- package/dist/dom/types/html/forms/validation.d.ts +76 -0
- package/dist/dom/types/html/index.d.ts +13 -0
- package/dist/dom/types/html/innerText.d.ts +9 -0
- package/dist/dom/types/html/interactive.d.ts +43 -0
- package/dist/dom/types/html/invokers.d.ts +39 -0
- package/dist/dom/types/html/media.d.ts +86 -0
- package/dist/dom/types/html/reflect.d.ts +67 -0
- package/dist/dom/types/html/registry.d.ts +9 -0
- package/dist/dom/types/html/resources.d.ts +55 -0
- package/dist/dom/types/html/shared.d.ts +22 -0
- package/dist/dom/types/html/slot.d.ts +15 -0
- package/dist/dom/types/html/template.d.ts +18 -0
- package/dist/dom/types/html/top-layer.d.ts +73 -0
- package/dist/dom/types/index.d.ts +50 -0
- package/dist/dom/types/internal.d.ts +61 -0
- package/dist/dom/types/keys.d.ts +209 -0
- package/dist/dom/types/nodes/Attr.d.ts +25 -0
- package/dist/dom/types/nodes/CharacterData.d.ts +35 -0
- package/dist/dom/types/nodes/Document.d.ts +169 -0
- package/dist/dom/types/nodes/DocumentFragment.d.ts +12 -0
- package/dist/dom/types/nodes/DocumentType.d.ts +17 -0
- package/dist/dom/types/nodes/Element.d.ts +142 -0
- package/dist/dom/types/nodes/Node.d.ts +112 -0
- package/dist/dom/types/nodes/NodeImpl.d.ts +90 -0
- package/dist/dom/types/nodes/ShadowRoot.d.ts +43 -0
- package/dist/dom/types/nodes/attr-nodes.d.ts +8 -0
- package/dist/dom/types/nodes/attributes.d.ts +46 -0
- package/dist/dom/types/nodes/cache.d.ts +38 -0
- package/dist/dom/types/nodes/character-data.d.ts +5 -0
- package/dist/dom/types/nodes/clone.d.ts +5 -0
- package/dist/dom/types/nodes/constants.d.ts +52 -0
- package/dist/dom/types/nodes/create.d.ts +42 -0
- package/dist/dom/types/nodes/derived.d.ts +26 -0
- package/dist/dom/types/nodes/inspect.d.ts +2 -0
- package/dist/dom/types/nodes/mixins.d.ts +41 -0
- package/dist/dom/types/nodes/names.d.ts +15 -0
- package/dist/dom/types/nodes/slots.d.ts +38 -0
- package/dist/dom/types/nodes/tags.d.ts +8 -0
- package/dist/dom/types/nodes/traverse.d.ts +21 -0
- package/dist/dom/types/nodes/tree.d.ts +47 -0
- package/dist/dom/types/observers/MutationObserver.d.ts +33 -0
- package/dist/dom/types/observers/MutationRecord.d.ts +17 -0
- package/dist/dom/types/observers/queue.d.ts +45 -0
- package/dist/dom/types/parser/entities-data.d.ts +3 -0
- package/dist/dom/types/parser/entities.d.ts +11 -0
- package/dist/dom/types/parser/index.d.ts +34 -0
- package/dist/dom/types/parser/tags.d.ts +182 -0
- package/dist/dom/types/parser/tokenizer.d.ts +109 -0
- package/dist/dom/types/parser/treebuilder.d.ts +271 -0
- package/dist/dom/types/parser/xml.d.ts +14 -0
- package/dist/dom/types/selectors/compile.d.ts +154 -0
- package/dist/dom/types/selectors/filter.d.ts +21 -0
- package/dist/dom/types/selectors/html-predicates.d.ts +1 -0
- package/dist/dom/types/selectors/index.d.ts +16 -0
- package/dist/dom/types/selectors/internal.d.ts +87 -0
- package/dist/dom/types/selectors/parser.d.ts +310 -0
- package/dist/dom/types/selectors/serialize.d.ts +20 -0
- package/dist/dom/types/selectors/state.d.ts +43 -0
- package/dist/dom/types/serializer/index.d.ts +29 -0
- package/dist/dom/types/trace.d.ts +51 -0
- package/dist/dom/types/traversal/Range.d.ts +113 -0
- package/dist/dom/types/traversal/Selection.d.ts +45 -0
- package/dist/dom/types/traversal/TreeWalker.d.ts +77 -0
- package/dist/dom/types/traversal/live.d.ts +46 -0
- package/dist/dom/types/webidl-runtime.d.ts +18 -0
- package/dist/dom/types/webidl.d.ts +34 -0
- package/dist/dom/types/window/DOMStringList.d.ts +14 -0
- package/dist/dom/types/window/FileList.d.ts +11 -0
- package/dist/dom/types/window/FileReader.d.ts +27 -0
- package/dist/dom/types/window/History.d.ts +43 -0
- package/dist/dom/types/window/Location.d.ts +46 -0
- package/dist/dom/types/window/Navigator.d.ts +79 -0
- package/dist/dom/types/window/Screen.d.ts +27 -0
- package/dist/dom/types/window/Storage.d.ts +28 -0
- package/dist/dom/types/window/Window.d.ts +329 -0
- package/dist/dom/types/window/abort.d.ts +4 -0
- package/dist/dom/types/window/browsing-context.d.ts +12 -0
- package/dist/dom/types/window/clock.d.ts +153 -0
- package/dist/dom/types/window/compat.d.ts +34 -0
- package/dist/dom/types/window/cookies.d.ts +21 -0
- package/dist/dom/types/window/current.d.ts +7 -0
- package/dist/dom/types/window/document.d.ts +19 -0
- package/dist/dom/types/window/events.d.ts +11 -0
- package/dist/dom/types/window/fallbacks.d.ts +20 -0
- package/dist/dom/types/window/geometry.d.ts +133 -0
- package/dist/dom/types/window/globals.d.ts +7 -0
- package/dist/dom/types/window/hooks.d.ts +22 -0
- package/dist/dom/types/window/host-originals.d.ts +9 -0
- package/dist/dom/types/window/interfaces.d.ts +13 -0
- package/dist/dom/types/window/isolation.d.ts +20 -0
- package/dist/dom/types/window/media.d.ts +33 -0
- package/dist/dom/types/window/not-implemented.d.ts +23 -0
- package/dist/dom/types/window/observers.d.ts +42 -0
- package/dist/dom/types/window/origin.d.ts +3 -0
- package/dist/dom/types/window/timers.d.ts +28 -0
- package/dist/dom/types/window/xhr.d.ts +108 -0
- package/dist/jest-dom/_chunks/matchers-CDnnXUfG.js +2211 -0
- package/dist/jest-dom/_chunks/matchers-D988Ducb.cjs +2516 -0
- package/dist/jest-dom/index.cjs +5 -0
- package/dist/jest-dom/index.js +6 -0
- package/dist/jest-dom/jest-globals.cjs +6 -0
- package/dist/jest-dom/jest-globals.js +7 -0
- package/dist/jest-dom/matchers.cjs +53 -0
- package/dist/jest-dom/matchers.js +3 -0
- package/dist/jest-dom/types/bun.d.ts +13 -0
- package/dist/jest-dom/types/index.d.ts +3 -0
- package/dist/jest-dom/types/jest-globals.d.ts +13 -0
- package/dist/jest-dom/types/jest.d.ts +15 -0
- package/dist/jest-dom/types/matchers-standalone.d.ts +32 -0
- package/dist/jest-dom/types/matchers.d.ts +1079 -0
- package/dist/jest-dom/types/package.json +1 -0
- package/dist/jest-dom/types/vitest.d.ts +16 -0
- package/dist/jest-dom/vitest.cjs +6 -0
- package/dist/jest-dom/vitest.js +7 -0
- package/dist/react/_chunks/pure-DZ97z2oT.cjs +498 -0
- package/dist/react/_chunks/pure-PtE2hivW.js +420 -0
- package/dist/react/dont-cleanup-after-each.cjs +3 -0
- package/dist/react/dont-cleanup-after-each.js +4 -0
- package/dist/react/index.cjs +47 -0
- package/dist/react/index.js +35 -0
- package/dist/react/pure.cjs +17 -0
- package/dist/react/pure.js +5 -0
- package/dist/react/types/act-compat.d.ts +6 -0
- package/dist/react/types/config.d.ts +9 -0
- package/dist/react/types/dont-cleanup-after-each.d.ts +1 -0
- package/dist/react/types/dtl.d.ts +1 -0
- package/dist/react/types/fire-event.d.ts +3 -0
- package/dist/react/types/index.d.ts +1 -0
- package/dist/react/types/pure.d.ts +136 -0
- package/dist/register/index.js +11 -0
- package/dist/register/pure.js +147 -0
- package/dist/register/types/index.d.ts +1 -0
- package/dist/register/types/pure.d.ts +36 -0
- package/dist/testing-library/_chunks/aria-snapshot-diff-D7PzpXew.cjs +1170 -0
- package/dist/testing-library/_chunks/aria-snapshot-diff-Q8Wj33K0.js +985 -0
- package/dist/testing-library/agent.cjs +721 -0
- package/dist/testing-library/agent.js +713 -0
- package/dist/testing-library/index.cjs +2469 -0
- package/dist/testing-library/index.js +2390 -0
- package/dist/testing-library/types/agent.d.ts +56 -0
- package/dist/testing-library/types/aria-role.d.ts +99 -0
- package/dist/testing-library/types/aria-snapshot.d.ts +43 -0
- package/dist/testing-library/types/config.d.ts +27 -0
- package/dist/testing-library/types/events.d.ts +118 -0
- package/dist/testing-library/types/get-node-text.d.ts +1 -0
- package/dist/testing-library/types/get-queries-for-element.d.ts +182 -0
- package/dist/testing-library/types/index.d.ts +24 -0
- package/dist/testing-library/types/matches.d.ts +46 -0
- package/dist/testing-library/types/pretty-dom.d.ts +37 -0
- package/dist/testing-library/types/queries.d.ts +315 -0
- package/dist/testing-library/types/query-helpers.d.ts +112 -0
- package/dist/testing-library/types/role-helpers.d.ts +19 -0
- package/dist/testing-library/types/screen.d.ts +30 -0
- package/dist/testing-library/types/suggestions.d.ts +46 -0
- package/dist/testing-library/types/wait-for-element-to-be-removed.d.ts +6 -0
- package/dist/testing-library/types/wait-for.d.ts +12 -0
- package/dist/user-event/index.cjs +3910 -0
- package/dist/user-event/index.js +3885 -0
- package/dist/user-event/types/clipboard/copy.d.ts +2 -0
- package/dist/user-event/types/clipboard/cut.d.ts +2 -0
- package/dist/user-event/types/clipboard/index.d.ts +3 -0
- package/dist/user-event/types/clipboard/paste.d.ts +3 -0
- package/dist/user-event/types/convenience/click.d.ts +5 -0
- package/dist/user-event/types/convenience/hover.d.ts +4 -0
- package/dist/user-event/types/convenience/index.d.ts +3 -0
- package/dist/user-event/types/convenience/tab.d.ts +4 -0
- package/dist/user-event/types/ctrl-dom.d.ts +50 -0
- package/dist/user-event/types/document/UI.d.ts +35 -0
- package/dist/user-event/types/document/copySelection.d.ts +2 -0
- package/dist/user-event/types/document/getValueOrTextContent.d.ts +2 -0
- package/dist/user-event/types/document/index.d.ts +5 -0
- package/dist/user-event/types/document/interceptor.d.ts +20 -0
- package/dist/user-event/types/document/patchFocus.d.ts +7 -0
- package/dist/user-event/types/document/prepareDocument.d.ts +2 -0
- package/dist/user-event/types/document/trackValue.d.ts +13 -0
- package/dist/user-event/types/dom-types.d.ts +56 -0
- package/dist/user-event/types/event/behavior/click.d.ts +1 -0
- package/dist/user-event/types/event/behavior/cut.d.ts +1 -0
- package/dist/user-event/types/event/behavior/index.d.ts +8 -0
- package/dist/user-event/types/event/behavior/keydown.d.ts +1 -0
- package/dist/user-event/types/event/behavior/keypress.d.ts +1 -0
- package/dist/user-event/types/event/behavior/keyup.d.ts +1 -0
- package/dist/user-event/types/event/behavior/paste.d.ts +1 -0
- package/dist/user-event/types/event/behavior/registry.d.ts +9 -0
- package/dist/user-event/types/event/createEvent.d.ts +8 -0
- package/dist/user-event/types/event/dispatchEvent.d.ts +6 -0
- package/dist/user-event/types/event/eventMap.d.ts +265 -0
- package/dist/user-event/types/event/focus.d.ts +6 -0
- package/dist/user-event/types/event/index.d.ts +7 -0
- package/dist/user-event/types/event/input.d.ts +3 -0
- package/dist/user-event/types/event/radio.d.ts +5 -0
- package/dist/user-event/types/event/selection/getInputRange.d.ts +6 -0
- package/dist/user-event/types/event/selection/getTargetTypeAndSelection.d.ts +11 -0
- package/dist/user-event/types/event/selection/index.d.ts +15 -0
- package/dist/user-event/types/event/selection/modifySelection.d.ts +9 -0
- package/dist/user-event/types/event/selection/modifySelectionPerMouse.d.ts +8 -0
- package/dist/user-event/types/event/selection/moveSelection.d.ts +5 -0
- package/dist/user-event/types/event/selection/resolveCaretPosition.d.ts +9 -0
- package/dist/user-event/types/event/selection/selectAll.d.ts +6 -0
- package/dist/user-event/types/event/selection/setSelection.d.ts +11 -0
- package/dist/user-event/types/event/selection/setSelectionPerMouse.d.ts +9 -0
- package/dist/user-event/types/event/selection/setSelectionRange.d.ts +7 -0
- package/dist/user-event/types/event/selection/updateSelectionOnFocus.d.ts +6 -0
- package/dist/user-event/types/event/types.d.ts +21 -0
- package/dist/user-event/types/event/wrapEvent.d.ts +2 -0
- package/dist/user-event/types/index.d.ts +6 -0
- package/dist/user-event/types/keyboard/index.d.ts +3 -0
- package/dist/user-event/types/keyboard/keyMap.d.ts +5 -0
- package/dist/user-event/types/keyboard/parseKeyDef.d.ts +17 -0
- package/dist/user-event/types/options.d.ts +121 -0
- package/dist/user-event/types/pointer/index.d.ts +29 -0
- package/dist/user-event/types/pointer/keyMap.d.ts +2 -0
- package/dist/user-event/types/pointer/parseKeyDef.d.ts +6 -0
- package/dist/user-event/types/setup/api.d.ts +23 -0
- package/dist/user-event/types/setup/directApi.d.ts +25 -0
- package/dist/user-event/types/setup/dtl.d.ts +20 -0
- package/dist/user-event/types/setup/index.d.ts +22 -0
- package/dist/user-event/types/setup/setup.d.ts +45 -0
- package/dist/user-event/types/setup/wrapAsync.d.ts +4 -0
- package/dist/user-event/types/system/index.d.ts +13 -0
- package/dist/user-event/types/system/keyLocation.d.ts +11 -0
- package/dist/user-event/types/system/keyboard.d.ts +46 -0
- package/dist/user-event/types/system/pointer/buttons.d.ts +25 -0
- package/dist/user-event/types/system/pointer/device.d.ts +8 -0
- package/dist/user-event/types/system/pointer/index.d.ts +21 -0
- package/dist/user-event/types/system/pointer/mouse.d.ts +31 -0
- package/dist/user-event/types/system/pointer/pointer.d.ts +32 -0
- package/dist/user-event/types/system/pointer/shared.d.ts +21 -0
- package/dist/user-event/types/utility/clear.d.ts +3 -0
- package/dist/user-event/types/utility/index.d.ts +4 -0
- package/dist/user-event/types/utility/selectOptions.d.ts +4 -0
- package/dist/user-event/types/utility/type.d.ts +10 -0
- package/dist/user-event/types/utility/upload.d.ts +6 -0
- package/dist/user-event/types/utils/click/isClickableInput.d.ts +17 -0
- package/dist/user-event/types/utils/dataTransfer/Blob.d.ts +4 -0
- package/dist/user-event/types/utils/dataTransfer/Clipboard.d.ts +12 -0
- package/dist/user-event/types/utils/dataTransfer/DataTransfer.d.ts +3 -0
- package/dist/user-event/types/utils/dataTransfer/FileList.d.ts +2 -0
- package/dist/user-event/types/utils/edit/isContentEditable.d.ts +8 -0
- package/dist/user-event/types/utils/edit/isEditable.d.ts +26 -0
- package/dist/user-event/types/utils/edit/maxLength.d.ts +16 -0
- package/dist/user-event/types/utils/edit/setFiles.d.ts +11 -0
- package/dist/user-event/types/utils/edit/timeValue.d.ts +5 -0
- package/dist/user-event/types/utils/focus/cursor.d.ts +5 -0
- package/dist/user-event/types/utils/focus/getActiveElement.d.ts +3 -0
- package/dist/user-event/types/utils/focus/getTabDestination.d.ts +2 -0
- package/dist/user-event/types/utils/focus/isFocusable.d.ts +2 -0
- package/dist/user-event/types/utils/focus/selection.d.ts +9 -0
- package/dist/user-event/types/utils/focus/selector.d.ts +1 -0
- package/dist/user-event/types/utils/index.d.ts +29 -0
- package/dist/user-event/types/utils/keyDef/readNextDescriptor.d.ts +21 -0
- package/dist/user-event/types/utils/misc/cloneEvent.d.ts +2 -0
- package/dist/user-event/types/utils/misc/findClosest.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getDocumentFromNode.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getTreeDiff.d.ts +2 -0
- package/dist/user-event/types/utils/misc/getWindow.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isDescendantOrSelf.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isDisabled.d.ts +2 -0
- package/dist/user-event/types/utils/misc/isElementType.d.ts +6 -0
- package/dist/user-event/types/utils/misc/isVisible.d.ts +2 -0
- package/dist/user-event/types/utils/misc/level.d.ts +9 -0
- package/dist/user-event/types/utils/misc/wait.d.ts +6 -0
- package/dist/user-event/types/utils/pointer/cssPointerEvents.d.ts +4 -0
- package/dist/vitest-environment/failure-snapshot.js +42 -0
- package/dist/vitest-environment/index.js +185 -0
- package/dist/vitest-environment/plugin.js +90 -0
- package/dist/vitest-environment/types/failure-snapshot.d.ts +1 -0
- package/dist/vitest-environment/types/index.d.ts +29 -0
- package/dist/vitest-environment/types/plugin.d.ts +33 -0
- package/jest-preset.cjs +17 -0
- package/package.json +177 -3
|
@@ -0,0 +1,2390 @@
|
|
|
1
|
+
import { A as implOf, C as agentElementSummary, D as checkContainerType, E as advanceFakeTimersByTime, O as getDocument, T as matchesSelector, _ as nodeKey, a as runWithExpensiveErrorDiagnosticsDisabled, c as prettyFormat, h as hiddenReason, i as getConfig, j as jestFakeTimersAreEnabled, k as getWindowFromNode, l as ariaSnapshot, o as logDOM, p as describeElement, r as configure, s as prettyDOM, t as diffAriaSnapshots, v as nodeProps, w as envDebugFormat, x as truncate, y as quote } from "./_chunks/aria-snapshot-diff-Q8Wj33K0.js";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { $impl, ELEMENT_NODE, F_HTML, HTML_NS, T, TEXT_NODE, asciiLowercase, attr, describeCall, describeNode, getComputedStyleOverride, nextInTree, tracePromise, traceSync, tracing, treeRoot } from "@ctrl/dom/internal";
|
|
4
|
+
import { roleSupportsProp } from "@ctrl/dom/aria";
|
|
5
|
+
import { computeAccessibleDescriptionImpl, computeAccessibleNameImpl, implicitRole, isInaccessibleImpl, isInaccessibleWithStyle, isSubtreeInaccessibleImpl, isVisibilityHidden as isVisibilityHidden$1, tlRole, tlRoleMatches } from "@ctrl/dom/aria/internal";
|
|
6
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
|
+
|
|
8
|
+
// \0rolldown/runtime.js
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) {
|
|
13
|
+
__defProp(target, name, {
|
|
14
|
+
get: all[name],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (!no_symbols) {
|
|
19
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/label-helpers.ts
|
|
25
|
+
/** https://html.spec.whatwg.org/#category-label (form-associated custom elements not supported). */
|
|
26
|
+
function isLabelable(impl) {
|
|
27
|
+
if (impl.type !== ELEMENT_NODE || impl.ns !== HTML_NS) return false;
|
|
28
|
+
switch (impl.tag) {
|
|
29
|
+
case T.button:
|
|
30
|
+
case T.meter:
|
|
31
|
+
case T.output:
|
|
32
|
+
case T.progress:
|
|
33
|
+
case T.select:
|
|
34
|
+
case T.textarea: return true;
|
|
35
|
+
case T.input: {
|
|
36
|
+
const type = attr(impl, "type");
|
|
37
|
+
return type === null || asciiLowercase(type) !== "hidden";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
/** `labelledNodeNames` upstream: elements whose text is excluded from a label's content. */
|
|
43
|
+
function isLabelledNodeName(impl) {
|
|
44
|
+
if (impl.prefix !== null) return false;
|
|
45
|
+
switch (asciiLowercase(impl.name)) {
|
|
46
|
+
case "button":
|
|
47
|
+
case "meter":
|
|
48
|
+
case "output":
|
|
49
|
+
case "progress":
|
|
50
|
+
case "select":
|
|
51
|
+
case "textarea":
|
|
52
|
+
case "input": return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
/** https://html.spec.whatwg.org/#labeled-control */
|
|
57
|
+
function labelControl(label, ids) {
|
|
58
|
+
const htmlFor = attr(label, "for");
|
|
59
|
+
if (htmlFor !== null) {
|
|
60
|
+
if (htmlFor === "") return null;
|
|
61
|
+
const el = ids().get(htmlFor) ?? null;
|
|
62
|
+
return el !== null && isLabelable(el) ? el : null;
|
|
63
|
+
}
|
|
64
|
+
for (let n = label.first; n !== null; n = nextInTree(n, label)) if (isLabelable(n)) return n;
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
/** First element (tree order) per id in `root`'s subtree, root excluded unless `inclusive`. */
|
|
68
|
+
function buildIdMap(root, inclusive) {
|
|
69
|
+
const ids = /* @__PURE__ */ new Map();
|
|
70
|
+
if (inclusive && root.type === ELEMENT_NODE && root.id !== "") ids.set(root.id, root);
|
|
71
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) if (n.type === ELEMENT_NODE && n.id !== "" && !ids.has(n.id)) ids.set(n.id, n);
|
|
72
|
+
return ids;
|
|
73
|
+
}
|
|
74
|
+
/** Per-query memo: label associations of the container's tree and container-scoped id lookups. */
|
|
75
|
+
var LabelContext = class {
|
|
76
|
+
container;
|
|
77
|
+
labelsByControl;
|
|
78
|
+
containerIds;
|
|
79
|
+
constructor(container) {
|
|
80
|
+
this.container = container;
|
|
81
|
+
this.labelsByControl = null;
|
|
82
|
+
this.containerIds = null;
|
|
83
|
+
}
|
|
84
|
+
/** `element.labels` (empty for non-labelable elements) — label elements in tree order. */
|
|
85
|
+
labelsOf(el) {
|
|
86
|
+
if (!isLabelable(el)) return EMPTY;
|
|
87
|
+
let map = this.labelsByControl;
|
|
88
|
+
if (map === null) map = this.labelsByControl = buildLabelMap(treeRoot(el));
|
|
89
|
+
return map.get(el) ?? EMPTY;
|
|
90
|
+
}
|
|
91
|
+
/** `container.querySelector('[id="…"]')` */
|
|
92
|
+
byIdInContainer(id) {
|
|
93
|
+
let ids = this.containerIds;
|
|
94
|
+
if (ids === null) ids = this.containerIds = buildIdMap(this.container, false);
|
|
95
|
+
return ids.get(id) ?? null;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const EMPTY = [];
|
|
99
|
+
function buildLabelMap(root) {
|
|
100
|
+
const map = /* @__PURE__ */ new Map();
|
|
101
|
+
let ids = null;
|
|
102
|
+
const getIds = () => ids ??= buildIdMap(root, true);
|
|
103
|
+
for (let n = root; n !== null; n = nextInTree(n, root)) {
|
|
104
|
+
if (n.type !== ELEMENT_NODE || n.tag !== T.label || n.ns !== HTML_NS) continue;
|
|
105
|
+
const control = labelControl(n, getIds);
|
|
106
|
+
if (control === null) continue;
|
|
107
|
+
const list = map.get(control);
|
|
108
|
+
if (list === void 0) map.set(control, [n]);
|
|
109
|
+
else list.push(n);
|
|
110
|
+
}
|
|
111
|
+
return map;
|
|
112
|
+
}
|
|
113
|
+
function getTextContent(node) {
|
|
114
|
+
if (node.type === ELEMENT_NODE && isLabelledNodeName(node)) return "";
|
|
115
|
+
if (node.type === TEXT_NODE) return node.data;
|
|
116
|
+
let text = "";
|
|
117
|
+
for (let c = node.first; c !== null; c = c.next) text += getTextContent(c);
|
|
118
|
+
return text;
|
|
119
|
+
}
|
|
120
|
+
function getLabelContentImpl(element) {
|
|
121
|
+
if (element.tag === T.label && element.ns === HTML_NS) return getTextContent(element);
|
|
122
|
+
const node = element.node;
|
|
123
|
+
return node.value || node.textContent;
|
|
124
|
+
}
|
|
125
|
+
const FORM_CONTROL_TAGS = /* @__PURE__ */ new Set([
|
|
126
|
+
"button",
|
|
127
|
+
"input",
|
|
128
|
+
"meter",
|
|
129
|
+
"output",
|
|
130
|
+
"progress",
|
|
131
|
+
"select",
|
|
132
|
+
"textarea"
|
|
133
|
+
]);
|
|
134
|
+
/** `label.querySelectorAll('button, input, meter, output, progress, select, textarea')` filtered by `selector`, first hit. */
|
|
135
|
+
function labelledFormControl(label, selector) {
|
|
136
|
+
for (let n = label.first; n !== null; n = nextInTree(n, label)) {
|
|
137
|
+
if (n.type !== ELEMENT_NODE) continue;
|
|
138
|
+
if (!FORM_CONTROL_TAGS.has(n.name)) continue;
|
|
139
|
+
if (selector === "*" || matchesSelector(n, selector)) return n;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function getLabelsImpl(ctx, element, selector = "*") {
|
|
143
|
+
const ariaLabelledBy = attr(element, "aria-labelledby");
|
|
144
|
+
const labelsId = ariaLabelledBy ? ariaLabelledBy.split(" ") : [];
|
|
145
|
+
if (labelsId.length) return labelsId.map((labelId) => {
|
|
146
|
+
const labellingElement = ctx.byIdInContainer(labelId);
|
|
147
|
+
return labellingElement ? {
|
|
148
|
+
content: getLabelContentImpl(labellingElement),
|
|
149
|
+
formControl: null
|
|
150
|
+
} : {
|
|
151
|
+
content: "",
|
|
152
|
+
formControl: null
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
return ctx.labelsOf(element).map((label) => ({
|
|
156
|
+
content: getLabelContentImpl(label),
|
|
157
|
+
formControl: labelledFormControl(label, selector)
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/matches.ts
|
|
162
|
+
function assertNotNullOrUndefined(matcher) {
|
|
163
|
+
if (matcher === null || matcher === void 0) throw new Error(`It looks like ${matcher} was passed instead of a matcher. Did you do something like getByText(${matcher})?`);
|
|
164
|
+
}
|
|
165
|
+
function fuzzyMatches(textToMatch, node, matcher, normalizer) {
|
|
166
|
+
if (typeof textToMatch !== "string") return false;
|
|
167
|
+
assertNotNullOrUndefined(matcher);
|
|
168
|
+
const normalizedText = normalizer(textToMatch);
|
|
169
|
+
if (typeof matcher === "string" || typeof matcher === "number") return normalizedText.toLowerCase().includes(matcher.toString().toLowerCase());
|
|
170
|
+
else if (typeof matcher === "function") return matcher(normalizedText, node);
|
|
171
|
+
else return matchRegExp(matcher, normalizedText);
|
|
172
|
+
}
|
|
173
|
+
function matches$1(textToMatch, node, matcher, normalizer) {
|
|
174
|
+
if (typeof textToMatch !== "string") return false;
|
|
175
|
+
assertNotNullOrUndefined(matcher);
|
|
176
|
+
const normalizedText = normalizer(textToMatch);
|
|
177
|
+
if (matcher instanceof Function) return matcher(normalizedText, node);
|
|
178
|
+
else if (matcher instanceof RegExp) return matchRegExp(matcher, normalizedText);
|
|
179
|
+
else return normalizedText === String(matcher);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Whether code unit `c` is matched by the RegExp `\s` class, which is also the set
|
|
183
|
+
* `String.prototype.trim` removes (https://tc39.es/ecma262/#sec-compiletocharset — WhiteSpace
|
|
184
|
+
* and LineTerminator).
|
|
185
|
+
*/
|
|
186
|
+
function isRegExpWhitespace(c) {
|
|
187
|
+
if (c <= 32) return c === 32 || c >= 9 && c <= 13;
|
|
188
|
+
if (c < 160) return false;
|
|
189
|
+
return c === 160 || c === 5760 || c >= 8192 && c <= 8202 || c === 8232 || c === 8233 || c === 8239 || c === 8287 || c === 12288 || c === 65279;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Whether `trim()` and/or `replace(/\s+/g, " ")` would change `s`. When not, the default
|
|
193
|
+
* normalizer returns its input as is: text like "Row 12 label" (single spaces, nothing to trim)
|
|
194
|
+
* is the common case, and the two passes would allocate two new strings per candidate node.
|
|
195
|
+
*/
|
|
196
|
+
function changedByNormalizing(s, trim, collapse) {
|
|
197
|
+
const last = s.length - 1;
|
|
198
|
+
let prevWhitespace = false;
|
|
199
|
+
for (let i = 0; i <= last; i++) {
|
|
200
|
+
const c = s.charCodeAt(i);
|
|
201
|
+
const ws = isRegExpWhitespace(c);
|
|
202
|
+
if (ws) {
|
|
203
|
+
if (trim && (i === 0 || i === last)) return true;
|
|
204
|
+
if (collapse && (prevWhitespace || c !== 32)) return true;
|
|
205
|
+
}
|
|
206
|
+
prevWhitespace = ws;
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
const WHITESPACE_RUN = /\s+/g;
|
|
211
|
+
function getDefaultNormalizer({ trim = true, collapseWhitespace = true } = {}) {
|
|
212
|
+
return (text) => {
|
|
213
|
+
if (!changedByNormalizing(text, trim, collapseWhitespace)) return text;
|
|
214
|
+
let normalizedText = text;
|
|
215
|
+
normalizedText = trim ? normalizedText.trim() : normalizedText;
|
|
216
|
+
normalizedText = collapseWhitespace ? normalizedText.replace(WHITESPACE_RUN, " ") : normalizedText;
|
|
217
|
+
return normalizedText;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const defaultNormalizer = getDefaultNormalizer();
|
|
221
|
+
/**
|
|
222
|
+
* Constructs a normalizer to pass to functions in matches.ts
|
|
223
|
+
* @param trim The user-specified value for `trim`, without any defaulting having been applied
|
|
224
|
+
* @param collapseWhitespace The user-specified value for `collapseWhitespace`, without any defaulting having been applied
|
|
225
|
+
* @param normalizer The user-specified normalizer
|
|
226
|
+
*/
|
|
227
|
+
function makeNormalizer({ trim, collapseWhitespace, normalizer }) {
|
|
228
|
+
if (!normalizer) {
|
|
229
|
+
if (trim === void 0 && collapseWhitespace === void 0) return defaultNormalizer;
|
|
230
|
+
return getDefaultNormalizer({
|
|
231
|
+
trim,
|
|
232
|
+
collapseWhitespace
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (typeof trim !== "undefined" || typeof collapseWhitespace !== "undefined") throw new Error("trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use \"getDefaultNormalizer({trim, collapseWhitespace})\" and compose that into your normalizer");
|
|
236
|
+
return normalizer;
|
|
237
|
+
}
|
|
238
|
+
function matchRegExp(matcher, text) {
|
|
239
|
+
const match = matcher.test(text);
|
|
240
|
+
if (matcher.global && matcher.lastIndex !== 0) {
|
|
241
|
+
console.warn(`To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp.`);
|
|
242
|
+
matcher.lastIndex = 0;
|
|
243
|
+
}
|
|
244
|
+
return match;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// src/get-node-text.ts
|
|
248
|
+
/** `el.matches('input[type=submit], input[type=button], input[type=reset]')` without the selector engine. */
|
|
249
|
+
function isButtonLikeInput(impl) {
|
|
250
|
+
if (impl.tag !== T.input || impl.ns !== HTML_NS) return false;
|
|
251
|
+
const type = attr(impl, "type");
|
|
252
|
+
if (type === null) return false;
|
|
253
|
+
const t = asciiLowercase(type);
|
|
254
|
+
return t === "submit" || t === "button" || t === "reset";
|
|
255
|
+
}
|
|
256
|
+
/** Concatenated data of the direct Text children (or a button-like input's value). */
|
|
257
|
+
function getNodeTextImpl(impl) {
|
|
258
|
+
if (isButtonLikeInput(impl)) return impl.node.value;
|
|
259
|
+
let text = "";
|
|
260
|
+
for (let c = impl.first; c !== null; c = c.next) if (c.type === TEXT_NODE) text += c.data;
|
|
261
|
+
return text;
|
|
262
|
+
}
|
|
263
|
+
function getNodeText(node) {
|
|
264
|
+
const impl = implOf(node);
|
|
265
|
+
if (impl.type !== ELEMENT_NODE) return node.matches("input[type=submit], input[type=button], input[type=reset]");
|
|
266
|
+
return getNodeTextImpl(impl);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/aria.ts
|
|
270
|
+
const PSEUDO_OPTIONS = { computedStyleSupportsPseudoElements: true };
|
|
271
|
+
/**
|
|
272
|
+
* The user-replaced `window.getComputedStyle` of `el`'s window, or null (the fast path).
|
|
273
|
+
* Upstream reads every style through `window.getComputedStyle`, so test setups that replace it
|
|
274
|
+
* (Sentry: `el => el.style`) change what ByRole considers hidden and how names are computed.
|
|
275
|
+
* Callers check once per query/call and pass the result to the functions below.
|
|
276
|
+
*/
|
|
277
|
+
function styleOverride(el) {
|
|
278
|
+
return getComputedStyleOverride(el);
|
|
279
|
+
}
|
|
280
|
+
/** dom-accessibility-api 0.5 options for testing-library's `computedStyleSupportsPseudoElements` config. */
|
|
281
|
+
function nameOptions(computedStyleSupportsPseudoElements, gcs) {
|
|
282
|
+
if (gcs !== null) return {
|
|
283
|
+
computedStyleSupportsPseudoElements,
|
|
284
|
+
getComputedStyle: gcs
|
|
285
|
+
};
|
|
286
|
+
return computedStyleSupportsPseudoElements ? PSEUDO_OPTIONS : void 0;
|
|
287
|
+
}
|
|
288
|
+
const aria = {
|
|
289
|
+
/** First implicit ARIA role (aria-query 5.3.0 `elementRoles` semantics), or null. */
|
|
290
|
+
implicitRole(el) {
|
|
291
|
+
const r = implicitRole(el);
|
|
292
|
+
return r === "" ? null : r;
|
|
293
|
+
},
|
|
294
|
+
/** Testing Library's role filter (explicit first token / any token with queryFallbacks / implicit). */
|
|
295
|
+
roleMatches: tlRoleMatches,
|
|
296
|
+
/** `roles.get(role)?.props[prop] !== undefined` (aria-query 5.3.0). */
|
|
297
|
+
roleSupportsProp(role, prop) {
|
|
298
|
+
return typeof role === "string" && roleSupportsProp(role, prop);
|
|
299
|
+
},
|
|
300
|
+
/** `gcs`: `styleOverride(el)` (or null), checked once by the caller. */
|
|
301
|
+
computeAccessibleName(el, computedStyleSupportsPseudoElements, gcs) {
|
|
302
|
+
return computeAccessibleNameImpl(el, nameOptions(computedStyleSupportsPseudoElements, gcs), 5);
|
|
303
|
+
},
|
|
304
|
+
computeAccessibleDescription(el, computedStyleSupportsPseudoElements, gcs) {
|
|
305
|
+
return computeAccessibleDescriptionImpl(el, nameOptions(computedStyleSupportsPseudoElements, gcs), 5);
|
|
306
|
+
},
|
|
307
|
+
/** Testing Library's `isInaccessible(element)` (default subtree check, memoized per node). */
|
|
308
|
+
isInaccessible: isInaccessibleImpl,
|
|
309
|
+
/**
|
|
310
|
+
* `isInaccessible(element, { isSubtreeInaccessible: cached })` reading styles through a
|
|
311
|
+
* user-replaced getComputedStyle; `memo` is the per-query subtree cache (or null).
|
|
312
|
+
*/
|
|
313
|
+
isInaccessibleWithStyle,
|
|
314
|
+
isSubtreeInaccessible: isSubtreeInaccessibleImpl
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// src/role-helpers.ts
|
|
318
|
+
/** `element.parentElement` */
|
|
319
|
+
function parentElement(el) {
|
|
320
|
+
const p = el.parent;
|
|
321
|
+
return p !== null && p.type === ELEMENT_NODE ? p : null;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Partial implementation https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion
|
|
325
|
+
* which should only be used for elements with a non-presentational role i.e.
|
|
326
|
+
* `role="none"` and `role="presentation"` will not be excluded.
|
|
327
|
+
*
|
|
328
|
+
* Implements aria-hidden semantics (i.e. parent overrides child)
|
|
329
|
+
* Ignores "Child Presentational: True" characteristics
|
|
330
|
+
*
|
|
331
|
+
* The default subtree check is memoized per element by @ctrl/dom/aria (stamped with the document
|
|
332
|
+
* version), which covers upstream's per-query `subtreeIsInaccessibleCache` and more.
|
|
333
|
+
*/
|
|
334
|
+
function isInaccessibleImpl$1(element) {
|
|
335
|
+
return aria.isInaccessible(element);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* `isInaccessible(element)` for one-off callers (suggestions): honors a user-replaced
|
|
339
|
+
* `window.getComputedStyle` like upstream, at the cost of one check per call.
|
|
340
|
+
*/
|
|
341
|
+
function isInaccessibleChecked(element) {
|
|
342
|
+
const gcs = styleOverride(element);
|
|
343
|
+
return gcs === null ? aria.isInaccessible(element) : aria.isInaccessibleWithStyle(element, gcs, null);
|
|
344
|
+
}
|
|
345
|
+
function isInaccessible(element, options = {}) {
|
|
346
|
+
const impl = implOf(element);
|
|
347
|
+
const custom = options.isSubtreeInaccessible;
|
|
348
|
+
const gcs = styleOverride(impl);
|
|
349
|
+
if (custom === void 0) return gcs === null ? isInaccessibleImpl$1(impl) : aria.isInaccessibleWithStyle(impl, gcs, null);
|
|
350
|
+
if (gcs !== null ? gcs(element).visibility === "hidden" : isVisibilityHidden$1(impl)) return true;
|
|
351
|
+
for (let current = impl; current !== null; current = parentElement(current)) if (custom(current.node)) return true;
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
/** Explicit role token or implicit role, as `getRoles` groups them ("" for `role=""`). */
|
|
355
|
+
function getImplicitAriaRolesImpl(el) {
|
|
356
|
+
const role = aria.implicitRole(el);
|
|
357
|
+
return role === null ? [] : [role];
|
|
358
|
+
}
|
|
359
|
+
function getRoles(container, { hidden = false } = {}) {
|
|
360
|
+
const root = implOf(container);
|
|
361
|
+
const roles = {};
|
|
362
|
+
const gcs = hidden !== false ? null : styleOverride(root);
|
|
363
|
+
const memo = gcs !== null ? /* @__PURE__ */ new Map() : null;
|
|
364
|
+
const visit = (node) => {
|
|
365
|
+
if (hidden !== false || (gcs === null ? isInaccessibleImpl$1(node) : aria.isInaccessibleWithStyle(node, gcs, memo)) === false) {
|
|
366
|
+
const explicit = attr(node, "role");
|
|
367
|
+
const nodeRoles = explicit !== null ? explicit.split(" ").slice(0, 1) : getImplicitAriaRolesImpl(node);
|
|
368
|
+
for (const role of nodeRoles) {
|
|
369
|
+
const list = roles[role];
|
|
370
|
+
if (Array.isArray(list)) list.push(node.node);
|
|
371
|
+
else roles[role] = [node.node];
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
for (let c = node.first; c !== null; c = c.next) if (c.type === ELEMENT_NODE) visit(c);
|
|
375
|
+
};
|
|
376
|
+
visit(root);
|
|
377
|
+
return roles;
|
|
378
|
+
}
|
|
379
|
+
const PRETTY = { format: "pretty" };
|
|
380
|
+
function prettyRoles(dom, { hidden, includeDescription }) {
|
|
381
|
+
const roles = getRoles(dom, { hidden });
|
|
382
|
+
const pseudo = getConfig().computedStyleSupportsPseudoElements;
|
|
383
|
+
const gcs = styleOverride(implOf(dom));
|
|
384
|
+
return Object.entries(roles).filter(([role]) => role !== "generic").map(([role, elements]) => {
|
|
385
|
+
const delimiterBar = "-".repeat(50);
|
|
386
|
+
return `${role}:\n\n${elements.map((el) => {
|
|
387
|
+
const impl = implOf(el);
|
|
388
|
+
const nameString = `Name "${aria.computeAccessibleName(impl, pseudo, gcs)}":\n`;
|
|
389
|
+
const domString = prettyDOM(el.cloneNode(false), void 0, PRETTY);
|
|
390
|
+
if (includeDescription) return `${nameString}${`Description "${aria.computeAccessibleDescription(impl, pseudo, gcs)}":\n`}${domString}`;
|
|
391
|
+
return `${nameString}${domString}`;
|
|
392
|
+
}).join("\n\n")}\n\n${delimiterBar}`;
|
|
393
|
+
}).join("\n");
|
|
394
|
+
}
|
|
395
|
+
const logRoles = (dom, { hidden = false } = {}) => console.log(prettyRoles(dom, { hidden }));
|
|
396
|
+
function checkBooleanAttribute(element, attribute) {
|
|
397
|
+
const attributeValue = attr(element, attribute);
|
|
398
|
+
if (attributeValue === "true") return true;
|
|
399
|
+
if (attributeValue === "false") return false;
|
|
400
|
+
}
|
|
401
|
+
/** false/true if (not)selected, undefined if not selectable */
|
|
402
|
+
function computeAriaSelected$1(element) {
|
|
403
|
+
if (element.tag === T.option && element.ns === HTML_NS) return element.node.selected;
|
|
404
|
+
return checkBooleanAttribute(element, "aria-selected");
|
|
405
|
+
}
|
|
406
|
+
function computeAriaBusy$1(element) {
|
|
407
|
+
return attr(element, "aria-busy") === "true";
|
|
408
|
+
}
|
|
409
|
+
/** false/true if (not)checked, undefined if not checked-able */
|
|
410
|
+
function computeAriaChecked(element) {
|
|
411
|
+
const node = element.node;
|
|
412
|
+
if ("indeterminate" in node && node.indeterminate) return;
|
|
413
|
+
if ("checked" in node) return node.checked;
|
|
414
|
+
return checkBooleanAttribute(element, "aria-checked");
|
|
415
|
+
}
|
|
416
|
+
function computeAriaPressed(element) {
|
|
417
|
+
return checkBooleanAttribute(element, "aria-pressed");
|
|
418
|
+
}
|
|
419
|
+
function computeAriaCurrent$1(element) {
|
|
420
|
+
return checkBooleanAttribute(element, "aria-current") ?? attr(element, "aria-current") ?? false;
|
|
421
|
+
}
|
|
422
|
+
function computeAriaExpanded$1(element) {
|
|
423
|
+
return checkBooleanAttribute(element, "aria-expanded");
|
|
424
|
+
}
|
|
425
|
+
/** number if implicit heading or aria-level present, otherwise undefined */
|
|
426
|
+
function computeHeadingLevelImpl(element) {
|
|
427
|
+
const level = attr(element, "aria-level");
|
|
428
|
+
const ariaLevelAttribute = level && Number(level);
|
|
429
|
+
if (ariaLevelAttribute) return ariaLevelAttribute;
|
|
430
|
+
if (element.ns !== HTML_NS) return void 0;
|
|
431
|
+
switch (element.tag) {
|
|
432
|
+
case T.h1: return 1;
|
|
433
|
+
case T.h2: return 2;
|
|
434
|
+
case T.h3: return 3;
|
|
435
|
+
case T.h4: return 4;
|
|
436
|
+
case T.h5: return 5;
|
|
437
|
+
case T.h6: return 6;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function computeAriaValueNow(element) {
|
|
441
|
+
const valueNow = attr(element, "aria-valuenow");
|
|
442
|
+
return valueNow === null ? void 0 : +valueNow;
|
|
443
|
+
}
|
|
444
|
+
function computeAriaValueMax(element) {
|
|
445
|
+
const valueMax = attr(element, "aria-valuemax");
|
|
446
|
+
return valueMax === null ? void 0 : +valueMax;
|
|
447
|
+
}
|
|
448
|
+
function computeAriaValueMin(element) {
|
|
449
|
+
const valueMin = attr(element, "aria-valuemin");
|
|
450
|
+
return valueMin === null ? void 0 : +valueMin;
|
|
451
|
+
}
|
|
452
|
+
function computeAriaValueText(element) {
|
|
453
|
+
const valueText = attr(element, "aria-valuetext");
|
|
454
|
+
return valueText === null ? void 0 : valueText;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/suggestions.ts
|
|
458
|
+
const normalize$1 = getDefaultNormalizer();
|
|
459
|
+
function escapeRegExp(string) {
|
|
460
|
+
return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
461
|
+
}
|
|
462
|
+
function getRegExpMatcher(string) {
|
|
463
|
+
return new RegExp(escapeRegExp(string.toLowerCase()), "i");
|
|
464
|
+
}
|
|
465
|
+
function makeSuggestion(queryName, element, content, { variant, name }) {
|
|
466
|
+
let warning = "";
|
|
467
|
+
const queryOptions = {};
|
|
468
|
+
const queryArgs = [["Role", "TestId"].includes(queryName) ? content : getRegExpMatcher(content)];
|
|
469
|
+
if (name) queryOptions.name = getRegExpMatcher(name);
|
|
470
|
+
if (queryName === "Role" && isInaccessibleChecked(implOf(element))) {
|
|
471
|
+
queryOptions.hidden = true;
|
|
472
|
+
warning = `Element is inaccessible. This means that the element and all its children are invisible to screen readers.
|
|
473
|
+
If you are using the aria-hidden prop, make sure this is the right choice for your case.
|
|
474
|
+
`;
|
|
475
|
+
}
|
|
476
|
+
if (Object.keys(queryOptions).length > 0) queryArgs.push(queryOptions);
|
|
477
|
+
const queryMethod = `${variant}By${queryName}`;
|
|
478
|
+
return {
|
|
479
|
+
queryName,
|
|
480
|
+
queryMethod,
|
|
481
|
+
queryArgs,
|
|
482
|
+
variant,
|
|
483
|
+
warning,
|
|
484
|
+
toString() {
|
|
485
|
+
if (warning) console.warn(warning);
|
|
486
|
+
let [text, options] = queryArgs;
|
|
487
|
+
text = typeof text === "string" ? `'${text}'` : text;
|
|
488
|
+
options = options ? `, { ${Object.entries(options).map(([k, v]) => `${k}: ${v}`).join(", ")} }` : "";
|
|
489
|
+
return `${queryMethod}(${text}${options})`;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function canSuggest(currentMethod, requestedMethod, data) {
|
|
494
|
+
return Boolean(data && (!requestedMethod || requestedMethod.toLowerCase() === currentMethod.toLowerCase()));
|
|
495
|
+
}
|
|
496
|
+
function getSuggestedQuery(element, variant = "get", method) {
|
|
497
|
+
const impl = implOf(element);
|
|
498
|
+
if (matchesSelector(impl, getConfig().defaultIgnore)) return;
|
|
499
|
+
const role = attr(impl, "role") ?? getImplicitAriaRolesImpl(impl)?.[0];
|
|
500
|
+
if (role !== "generic" && canSuggest("Role", method, role)) return makeSuggestion("Role", element, role, {
|
|
501
|
+
variant,
|
|
502
|
+
name: aria.computeAccessibleName(impl, getConfig().computedStyleSupportsPseudoElements, styleOverride(impl))
|
|
503
|
+
});
|
|
504
|
+
const labelText = getLabelsImpl(new LabelContext(implOf(getDocument())), impl).map((label) => label.content).join(" ");
|
|
505
|
+
if (canSuggest("LabelText", method, labelText)) return makeSuggestion("LabelText", element, labelText, { variant });
|
|
506
|
+
const placeholderText = attr(impl, "placeholder");
|
|
507
|
+
if (canSuggest("PlaceholderText", method, placeholderText)) return makeSuggestion("PlaceholderText", element, placeholderText, { variant });
|
|
508
|
+
const textContent = normalize$1(getNodeTextImpl(impl));
|
|
509
|
+
if (canSuggest("Text", method, textContent)) return makeSuggestion("Text", element, textContent, { variant });
|
|
510
|
+
if (canSuggest("DisplayValue", method, element.value)) return makeSuggestion("DisplayValue", element, normalize$1(element.value), { variant });
|
|
511
|
+
const alt = attr(impl, "alt");
|
|
512
|
+
if (canSuggest("AltText", method, alt)) return makeSuggestion("AltText", element, alt, { variant });
|
|
513
|
+
const title = attr(impl, "title");
|
|
514
|
+
if (canSuggest("Title", method, title)) return makeSuggestion("Title", element, title, { variant });
|
|
515
|
+
const testId = element.getAttribute(getConfig().testIdAttribute);
|
|
516
|
+
if (canSuggest("TestId", method, testId)) return makeSuggestion("TestId", element, testId, { variant });
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// src/wait-for.ts
|
|
520
|
+
function copyStackTrace(target, source) {
|
|
521
|
+
target.stack = source.stack.replace(source.message, target.message);
|
|
522
|
+
}
|
|
523
|
+
function waitForImpl(callback, { container = getDocument(), timeout = getConfig().asyncUtilTimeout, showOriginalStackTrace = getConfig().showOriginalStackTrace, stackTraceError, interval = 50, onTimeout = (error) => {
|
|
524
|
+
if (error.name === "TestingLibraryElementError" && envDebugFormat() !== null) return error;
|
|
525
|
+
Object.defineProperty(error, "message", { value: getConfig().getElementError(error.message, container).message });
|
|
526
|
+
return error;
|
|
527
|
+
}, mutationObserverOptions = {
|
|
528
|
+
subtree: true,
|
|
529
|
+
childList: true,
|
|
530
|
+
attributes: true,
|
|
531
|
+
characterData: true
|
|
532
|
+
} }, span = null) {
|
|
533
|
+
if (typeof callback !== "function") throw new TypeError("Received `callback` arg must be a function");
|
|
534
|
+
return new Promise(async (resolve, reject) => {
|
|
535
|
+
let lastError;
|
|
536
|
+
let intervalId;
|
|
537
|
+
let observer;
|
|
538
|
+
let finished = false;
|
|
539
|
+
let promiseStatus = "idle";
|
|
540
|
+
const overallTimeoutTimer = setTimeout(handleTimeout, timeout);
|
|
541
|
+
const usingJestFakeTimers = jestFakeTimersAreEnabled();
|
|
542
|
+
if (usingJestFakeTimers) {
|
|
543
|
+
const { unstable_advanceTimersWrapper: advanceTimersWrapper } = getConfig();
|
|
544
|
+
checkCallback();
|
|
545
|
+
while (!finished) {
|
|
546
|
+
if (!jestFakeTimersAreEnabled()) {
|
|
547
|
+
const error = /* @__PURE__ */ new Error(`Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`);
|
|
548
|
+
if (!showOriginalStackTrace) copyStackTrace(error, stackTraceError);
|
|
549
|
+
reject(error);
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
await advanceTimersWrapper(async () => {
|
|
553
|
+
advanceFakeTimersByTime(interval);
|
|
554
|
+
});
|
|
555
|
+
if (finished) break;
|
|
556
|
+
checkCallback();
|
|
557
|
+
}
|
|
558
|
+
} else {
|
|
559
|
+
try {
|
|
560
|
+
checkContainerType(container);
|
|
561
|
+
} catch (e) {
|
|
562
|
+
finished = true;
|
|
563
|
+
clearTimeout(overallTimeoutTimer);
|
|
564
|
+
reject(e);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
const inSpan = span !== null ? AsyncLocalStorage.snapshot() : null;
|
|
568
|
+
const onTick = inSpan === null ? checkRealTimersCallback : () => inSpan(checkRealTimersCallback);
|
|
569
|
+
intervalId = setInterval(onTick, interval);
|
|
570
|
+
const { MutationObserver } = getWindowFromNode(container);
|
|
571
|
+
observer = new MutationObserver(onTick);
|
|
572
|
+
observer.observe(container, mutationObserverOptions);
|
|
573
|
+
checkCallback();
|
|
574
|
+
}
|
|
575
|
+
function onDone(error, result) {
|
|
576
|
+
finished = true;
|
|
577
|
+
clearTimeout(overallTimeoutTimer);
|
|
578
|
+
if (!usingJestFakeTimers) {
|
|
579
|
+
clearInterval(intervalId);
|
|
580
|
+
observer.disconnect();
|
|
581
|
+
}
|
|
582
|
+
if (error) reject(error);
|
|
583
|
+
else resolve(result);
|
|
584
|
+
}
|
|
585
|
+
function checkRealTimersCallback() {
|
|
586
|
+
if (jestFakeTimersAreEnabled()) {
|
|
587
|
+
const error = /* @__PURE__ */ new Error(`Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`);
|
|
588
|
+
if (!showOriginalStackTrace) copyStackTrace(error, stackTraceError);
|
|
589
|
+
return reject(error);
|
|
590
|
+
} else return checkCallback();
|
|
591
|
+
}
|
|
592
|
+
function checkCallback() {
|
|
593
|
+
if (promiseStatus === "pending") return;
|
|
594
|
+
if (span !== null) span.data.checks = (span.data.checks ?? 0) + 1;
|
|
595
|
+
try {
|
|
596
|
+
const result = runWithExpensiveErrorDiagnosticsDisabled(callback);
|
|
597
|
+
if (typeof result?.then === "function") {
|
|
598
|
+
promiseStatus = "pending";
|
|
599
|
+
result.then((resolvedValue) => {
|
|
600
|
+
promiseStatus = "resolved";
|
|
601
|
+
onDone(null, resolvedValue);
|
|
602
|
+
}, (rejectedValue) => {
|
|
603
|
+
promiseStatus = "rejected";
|
|
604
|
+
lastError = rejectedValue;
|
|
605
|
+
});
|
|
606
|
+
} else onDone(null, result);
|
|
607
|
+
} catch (error) {
|
|
608
|
+
lastError = error;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function handleTimeout() {
|
|
612
|
+
let error;
|
|
613
|
+
if (lastError) {
|
|
614
|
+
error = lastError;
|
|
615
|
+
if (!showOriginalStackTrace && error.name === "TestingLibraryElementError") copyStackTrace(error, stackTraceError);
|
|
616
|
+
} else {
|
|
617
|
+
error = /* @__PURE__ */ new Error("Timed out in waitFor.");
|
|
618
|
+
if (!showOriginalStackTrace) copyStackTrace(error, stackTraceError);
|
|
619
|
+
}
|
|
620
|
+
onDone(onTimeout(error), null);
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
function waitFor(callback, options) {
|
|
625
|
+
if (!tracing()) return waitForInSpan(callback, options, null);
|
|
626
|
+
return tracePromise("testing-library.wait_for", `waitFor(${describeCallback(callback)})`, (span) => waitForInSpan(callback, options, span));
|
|
627
|
+
}
|
|
628
|
+
/** waitFor without a span of its own, counting the callback's runs on `span` (findBy* passes its query span). */
|
|
629
|
+
function waitForInSpan(callback, options, span) {
|
|
630
|
+
const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_MESSAGE");
|
|
631
|
+
return getConfig().asyncWrapper(() => waitForImpl(callback, {
|
|
632
|
+
stackTraceError,
|
|
633
|
+
...options
|
|
634
|
+
}, span));
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* A callback's source on one line, shortened: `() => expect(screen.getByText("Done")).toBeVisible()`.
|
|
638
|
+
* Undoes what transforms do to imported names: Vite's `__vite_ssr_import_0__.screen`, the
|
|
639
|
+
* `(0, expect)(…)` call form (Vite, Babel) and CommonJS interop objects (`_reactTestingLibrary.screen`,
|
|
640
|
+
* Babel and SWC), and drops the braces around a single statement.
|
|
641
|
+
*/
|
|
642
|
+
function describeCallback(callback) {
|
|
643
|
+
if (typeof callback !== "function") return String(callback);
|
|
644
|
+
let source = Function.prototype.toString.call(callback).replace(/\s+/g, " ").replace(/__vite_ssr_import_\d+__\./g, "").replace(/\(0, ?([\w$.]+)\)/g, "$1").replace(/(?<![\w$.])_[a-z][\w$]*\.(?=[\w$])/g, "");
|
|
645
|
+
const block = /^(async )?\(\) ?=> ?\{ ?(?:return )?(.*?);? ?\}$/.exec(source);
|
|
646
|
+
if (block !== null && !block[2].includes(";")) source = `${block[1] ?? ""}() => ${block[2]}`;
|
|
647
|
+
return source.length > 120 ? `${source.slice(0, 119)}…` : source;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// src/query-helpers.ts
|
|
651
|
+
function getElementError(message, container) {
|
|
652
|
+
return getConfig().getElementError(message, container);
|
|
653
|
+
}
|
|
654
|
+
function getMultipleElementsFoundError(message, container) {
|
|
655
|
+
return getElementError(`${message}\n\n(If this is intentional, then use the \`*AllBy*\` variant of the query (like \`queryAllByText\`, \`getAllByText\`, or \`findAllByText\`)).`, container);
|
|
656
|
+
}
|
|
657
|
+
function queryAllByAttribute(attribute, container, text, { exact = true, collapseWhitespace, trim, normalizer } = {}) {
|
|
658
|
+
const matcher = exact ? matches$1 : fuzzyMatches;
|
|
659
|
+
const matchNormalizer = makeNormalizer({
|
|
660
|
+
collapseWhitespace,
|
|
661
|
+
trim,
|
|
662
|
+
normalizer
|
|
663
|
+
});
|
|
664
|
+
const root = implOf(container);
|
|
665
|
+
const lower = asciiLowercase(attribute);
|
|
666
|
+
const out = [];
|
|
667
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) {
|
|
668
|
+
if (n.type !== ELEMENT_NODE || n.attrs === null) continue;
|
|
669
|
+
const value = attr(n, (n.flags & F_HTML) !== 0 ? lower : attribute);
|
|
670
|
+
if (value !== null && matcher(value, n.node, text, matchNormalizer)) out.push(n.node);
|
|
671
|
+
}
|
|
672
|
+
return out;
|
|
673
|
+
}
|
|
674
|
+
function queryByAttribute(attribute, container, text, options) {
|
|
675
|
+
const els = queryAllByAttribute(attribute, container, text, options);
|
|
676
|
+
if (els.length > 1) throw getMultipleElementsFoundError(`Found multiple elements by [${attribute}=${text}]`, container);
|
|
677
|
+
return els[0] || null;
|
|
678
|
+
}
|
|
679
|
+
function makeSingleQuery(allQuery, getMultipleError) {
|
|
680
|
+
return (container, ...args) => {
|
|
681
|
+
const els = allQuery(container, ...args);
|
|
682
|
+
if (els.length > 1) {
|
|
683
|
+
const elementStrings = envDebugFormat() !== null ? els.map((element) => agentElementSummary(element)).join("\n") : els.map((element) => getElementError(null, element).message).join("\n\n");
|
|
684
|
+
throw getMultipleElementsFoundError(`${getMultipleError(container, ...args)}
|
|
685
|
+
|
|
686
|
+
Here are the matching elements:
|
|
687
|
+
|
|
688
|
+
${elementStrings}`, container);
|
|
689
|
+
}
|
|
690
|
+
return els[0] || null;
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function getSuggestionError(suggestion, container) {
|
|
694
|
+
return getConfig().getElementError(`A better query is available, try this:
|
|
695
|
+
${suggestion.toString()}
|
|
696
|
+
`, container);
|
|
697
|
+
}
|
|
698
|
+
function makeGetAllQuery(allQuery, getMissingError) {
|
|
699
|
+
return (container, ...args) => {
|
|
700
|
+
const els = allQuery(container, ...args);
|
|
701
|
+
if (!els.length) throw getConfig().getElementError(getMissingError(container, ...args), container);
|
|
702
|
+
return els;
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function makeFindQuery(getter, name = "find") {
|
|
706
|
+
return (container, text, options, waitForOptions) => {
|
|
707
|
+
const find = (span) => waitForInSpan(() => {
|
|
708
|
+
return getter(container, text, options);
|
|
709
|
+
}, {
|
|
710
|
+
container,
|
|
711
|
+
...waitForOptions
|
|
712
|
+
}, span);
|
|
713
|
+
if (!tracing()) return find(null);
|
|
714
|
+
return tracePromise(QUERY_OP, describeCall(name, [text, options]), async (span) => {
|
|
715
|
+
const result = await find(span);
|
|
716
|
+
span.data.matches = matchCount(result);
|
|
717
|
+
return result;
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
const QUERY_OP = "testing-library.query";
|
|
722
|
+
const matchCount = (result) => Array.isArray(result) ? result.length : result ? 1 : 0;
|
|
723
|
+
/** Ours: a span per call when something subscribes to @ctrl/dom's tracing channel (@ctrl/dom trace.ts). */
|
|
724
|
+
function traceQuery(name, query) {
|
|
725
|
+
return (container, ...args) => {
|
|
726
|
+
if (!tracing()) return query(container, ...args);
|
|
727
|
+
return traceSync(QUERY_OP, describeCall(name, args), (span) => {
|
|
728
|
+
const result = query(container, ...args);
|
|
729
|
+
span.data.matches = matchCount(result);
|
|
730
|
+
return result;
|
|
731
|
+
});
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
const wrapSingleQueryWithSuggestion = (query, queryAllByName, variant) => (container, ...args) => {
|
|
735
|
+
const element = query(container, ...args);
|
|
736
|
+
const [{ suggest = getConfig().throwSuggestions } = {}] = args.slice(-1);
|
|
737
|
+
if (element && suggest) {
|
|
738
|
+
const suggestion = getSuggestedQuery(element, variant);
|
|
739
|
+
if (suggestion && !queryAllByName.endsWith(suggestion.queryName)) throw getSuggestionError(suggestion.toString(), container);
|
|
740
|
+
}
|
|
741
|
+
return element;
|
|
742
|
+
};
|
|
743
|
+
const wrapAllByQueryWithSuggestion = (query, queryAllByName, variant) => (container, ...args) => {
|
|
744
|
+
const els = query(container, ...args);
|
|
745
|
+
const [{ suggest = getConfig().throwSuggestions } = {}] = args.slice(-1);
|
|
746
|
+
if (els.length && suggest) {
|
|
747
|
+
const uniqueSuggestionMessages = [...new Set(els.map((element) => getSuggestedQuery(element, variant)?.toString()))];
|
|
748
|
+
if (uniqueSuggestionMessages.length === 1 && !queryAllByName.endsWith(getSuggestedQuery(els[0], variant).queryName)) throw getSuggestionError(uniqueSuggestionMessages[0], container);
|
|
749
|
+
}
|
|
750
|
+
return els;
|
|
751
|
+
};
|
|
752
|
+
function buildQueries(queryAllBy, getMultipleError, getMissingError) {
|
|
753
|
+
const queryBy = wrapSingleQueryWithSuggestion(makeSingleQuery(queryAllBy, getMultipleError), queryAllBy.name, "query");
|
|
754
|
+
const getAllBy = makeGetAllQuery(queryAllBy, getMissingError);
|
|
755
|
+
const getBy = makeSingleQuery(getAllBy, getMultipleError);
|
|
756
|
+
const getByWithSuggestions = wrapSingleQueryWithSuggestion(getBy, queryAllBy.name, "get");
|
|
757
|
+
const getAllWithSuggestions = wrapAllByQueryWithSuggestion(getAllBy, queryAllBy.name.replace("query", "get"), "getAll");
|
|
758
|
+
const by = queryAllBy.name.startsWith("queryAll") ? queryAllBy.name.slice(8) : "";
|
|
759
|
+
const findAllBy = makeFindQuery(wrapAllByQueryWithSuggestion(getAllBy, queryAllBy.name, "findAll"), `findAll${by}`);
|
|
760
|
+
const findBy = makeFindQuery(wrapSingleQueryWithSuggestion(getBy, queryAllBy.name, "find"), `find${by}`);
|
|
761
|
+
return [
|
|
762
|
+
traceQuery(`query${by}`, queryBy),
|
|
763
|
+
traceQuery(`getAll${by}`, getAllWithSuggestions),
|
|
764
|
+
traceQuery(`get${by}`, getByWithSuggestions),
|
|
765
|
+
findAllBy,
|
|
766
|
+
findBy
|
|
767
|
+
];
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/candidates.ts
|
|
771
|
+
const MAX_CANDIDATES = 10;
|
|
772
|
+
const MAX_TEXT = 80;
|
|
773
|
+
const PRESENTATIONAL = /* @__PURE__ */ new Set([
|
|
774
|
+
"",
|
|
775
|
+
"generic",
|
|
776
|
+
"none",
|
|
777
|
+
"presentation"
|
|
778
|
+
]);
|
|
779
|
+
const identity$1 = (text) => text;
|
|
780
|
+
function normalize(s) {
|
|
781
|
+
return s.replace(/\s+/g, " ").trim();
|
|
782
|
+
}
|
|
783
|
+
/** Loose similarity for string matchers: 0 = equal ignoring case/space, 1 = substring, 2 = shares a word, -1 = unrelated. */
|
|
784
|
+
function similarity(candidate, wanted) {
|
|
785
|
+
const a = normalize(candidate).toLowerCase();
|
|
786
|
+
const b = normalize(wanted).toLowerCase();
|
|
787
|
+
if (a === "" || b === "") return -1;
|
|
788
|
+
if (a === b) return 0;
|
|
789
|
+
if (a.includes(b) || b.includes(a)) return 1;
|
|
790
|
+
const words = b.split(" ");
|
|
791
|
+
for (let i = 0; i < words.length; i++) if (words[i].length > 2 && a.includes(words[i])) return 2;
|
|
792
|
+
return -1;
|
|
793
|
+
}
|
|
794
|
+
/** Whether `text` matches `matcher` exactly, or loosely for string matchers (rank), or not at all (-1). */
|
|
795
|
+
function closeness(text, node, matcher, normalizer, exact = true) {
|
|
796
|
+
if ((exact ? matches$1 : fuzzyMatches)(text, node, matcher, normalizer)) return 0;
|
|
797
|
+
if (typeof matcher === "string" || typeof matcher === "number") {
|
|
798
|
+
const s = similarity(normalizer(text), String(matcher));
|
|
799
|
+
return s === -1 ? -1 : s + 1;
|
|
800
|
+
}
|
|
801
|
+
return -1;
|
|
802
|
+
}
|
|
803
|
+
function line(el, role, name, hidden, comment) {
|
|
804
|
+
const node = {
|
|
805
|
+
role,
|
|
806
|
+
name,
|
|
807
|
+
props: nodeProps(el, role, false, hidden),
|
|
808
|
+
value: null,
|
|
809
|
+
url: null,
|
|
810
|
+
children: [],
|
|
811
|
+
element: el
|
|
812
|
+
};
|
|
813
|
+
return `- ${nodeKey(node, MAX_TEXT)} # ${comment}`;
|
|
814
|
+
}
|
|
815
|
+
function format(title, candidates) {
|
|
816
|
+
if (candidates.length === 0) return "";
|
|
817
|
+
candidates.sort((a, b) => a.rank - b.rank);
|
|
818
|
+
const shown = candidates.slice(0, MAX_CANDIDATES).map((c) => c.line);
|
|
819
|
+
if (candidates.length > MAX_CANDIDATES) shown.push(`# … ${candidates.length - MAX_CANDIDATES} more`);
|
|
820
|
+
return `${title}:\n${shown.join("\n")}`;
|
|
821
|
+
}
|
|
822
|
+
function nameOf(el) {
|
|
823
|
+
return normalize(computeAccessibleNameImpl(el, void 0, 5));
|
|
824
|
+
}
|
|
825
|
+
/** Closest elements for a failed `*ByRole` query, or "". */
|
|
826
|
+
function roleCandidates(container, q) {
|
|
827
|
+
const root = implOf(container);
|
|
828
|
+
const out = [];
|
|
829
|
+
const name = q.name;
|
|
830
|
+
for (let el = root.first; el !== null; el = nextInTree(el, root)) {
|
|
831
|
+
if (el.type !== ELEMENT_NODE) continue;
|
|
832
|
+
const inaccessible = isInaccessibleImpl(el);
|
|
833
|
+
const role = tlRole(el);
|
|
834
|
+
if (tlRoleMatches(el, q.role, q.queryFallbacks)) {
|
|
835
|
+
const elName = nameOf(el);
|
|
836
|
+
const nameRank = name === void 0 ? 0 : closeness(elName, el.node, name, identity$1);
|
|
837
|
+
const stateOk = q.matchesState(el);
|
|
838
|
+
if (nameRank === 0 && stateOk) {
|
|
839
|
+
if (inaccessible && !q.hidden) out.push({
|
|
840
|
+
line: line(el, role, elName, true, `hidden: ${hiddenReason(el)} (or pass { hidden: true })`),
|
|
841
|
+
rank: 0
|
|
842
|
+
});
|
|
843
|
+
} else if (nameRank === 0) out.push({
|
|
844
|
+
line: line(el, role, elName, inaccessible && !q.hidden, `role and name match, state is not ${q.stateHint}`),
|
|
845
|
+
rank: 1
|
|
846
|
+
});
|
|
847
|
+
else if (!inaccessible || q.hidden) out.push({
|
|
848
|
+
line: line(el, role, elName, false, nameRank > 0 ? "similar name" : "same role, other name"),
|
|
849
|
+
rank: nameRank > 0 ? 2 + nameRank : 10
|
|
850
|
+
});
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
if (name === void 0) continue;
|
|
854
|
+
if (!PRESENTATIONAL.has(role)) {
|
|
855
|
+
const elName = nameOf(el);
|
|
856
|
+
if (elName === "") continue;
|
|
857
|
+
const rank = closeness(elName, el.node, name, identity$1);
|
|
858
|
+
if (rank >= 0) out.push({
|
|
859
|
+
line: line(el, role, elName, inaccessible && !q.hidden, `same name, role "${role}"`),
|
|
860
|
+
rank: 2 + rank
|
|
861
|
+
});
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
const text = normalize(getNodeTextImpl(el));
|
|
865
|
+
if (text !== "" && closeness(text, el.node, name, identity$1) === 0) out.push({
|
|
866
|
+
line: `- text: ${quote(truncate(text, MAX_TEXT))} # in ${describeElement(el)}, which has no role: give it role="${q.role}" or use getByText`,
|
|
867
|
+
rank: 2
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
return format("Closest matches", out);
|
|
871
|
+
}
|
|
872
|
+
function roleOrTag(el) {
|
|
873
|
+
const role = tlRole(el);
|
|
874
|
+
return PRESENTATIONAL.has(role) ? describeElement(el) : role;
|
|
875
|
+
}
|
|
876
|
+
/** Closest elements for a failed `*ByText` query, or "". */
|
|
877
|
+
function textCandidates(container, text, normalizer, selector, ignore, exact) {
|
|
878
|
+
if (typeof text === "function") return "";
|
|
879
|
+
const root = implOf(container);
|
|
880
|
+
const out = [];
|
|
881
|
+
const split = [];
|
|
882
|
+
for (let el = root.first; el !== null; el = nextInTree(el, root)) {
|
|
883
|
+
if (el.type !== ELEMENT_NODE) continue;
|
|
884
|
+
if (ignore && typeof ignore === "string" && matchesSelector(el, ignore)) continue;
|
|
885
|
+
const own = getNodeTextImpl(el);
|
|
886
|
+
const rank = own.trim() === "" ? -1 : closeness(own, el.node, text, normalizer, exact);
|
|
887
|
+
if (rank === 0) out.push({
|
|
888
|
+
line: `- ${roleOrTag(el)}: ${quote(truncate(normalizer(own), MAX_TEXT))} # matches, but not selector "${selector}"`,
|
|
889
|
+
rank: 0
|
|
890
|
+
});
|
|
891
|
+
else if (rank > 0) out.push({
|
|
892
|
+
line: `- ${roleOrTag(el)}: ${quote(truncate(normalizer(own), MAX_TEXT))} # similar text in ${describeElement(el)}`,
|
|
893
|
+
rank: 1 + rank
|
|
894
|
+
});
|
|
895
|
+
if (rank !== 0 && el.first !== null && el.first !== el.last && (exact ? matches$1 : fuzzyMatches)(el.node.textContent, el.node, text, normalizer)) split.push(el);
|
|
896
|
+
}
|
|
897
|
+
for (let i = 0; i < split.length; i++) {
|
|
898
|
+
const el = split[i];
|
|
899
|
+
let hasDeeper = false;
|
|
900
|
+
for (let j = i + 1; j < split.length && !hasDeeper; j++) if (isAncestor(el, split[j])) hasDeeper = true;
|
|
901
|
+
if (hasDeeper) continue;
|
|
902
|
+
out.push({
|
|
903
|
+
line: `- ${roleOrTag(el)}: ${quote(truncate(normalizer(el.node.textContent), MAX_TEXT))} # text split across child elements of ${describeElement(el)}: use a function matcher or getByRole`,
|
|
904
|
+
rank: 0
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
return format("Closest matches", out);
|
|
908
|
+
}
|
|
909
|
+
function isAncestor(a, b) {
|
|
910
|
+
for (let p = b.parent; p !== null; p = p.parent) if (p === a) return true;
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
const LABELLABLE_ROLES = /* @__PURE__ */ new Set([
|
|
914
|
+
"textbox",
|
|
915
|
+
"searchbox",
|
|
916
|
+
"combobox",
|
|
917
|
+
"listbox",
|
|
918
|
+
"checkbox",
|
|
919
|
+
"radio",
|
|
920
|
+
"switch",
|
|
921
|
+
"slider",
|
|
922
|
+
"spinbutton"
|
|
923
|
+
]);
|
|
924
|
+
/** Form controls and their accessible names for a failed `*ByLabelText` query, or "". */
|
|
925
|
+
function labelCandidates(container, text, normalizer, exact) {
|
|
926
|
+
if (typeof text === "function") return "";
|
|
927
|
+
const root = implOf(container);
|
|
928
|
+
const out = [];
|
|
929
|
+
for (let el = root.first; el !== null; el = nextInTree(el, root)) {
|
|
930
|
+
if (el.type !== ELEMENT_NODE) continue;
|
|
931
|
+
const role = tlRole(el);
|
|
932
|
+
if (!LABELLABLE_ROLES.has(role)) continue;
|
|
933
|
+
const name = nameOf(el);
|
|
934
|
+
const hidden = isInaccessibleImpl(el);
|
|
935
|
+
if (name === "") {
|
|
936
|
+
const placeholder = attr(el, "placeholder");
|
|
937
|
+
const comment = placeholder ? `no label, placeholder ${quote(placeholder)}: use getByPlaceholderText or add a <label>` : `no label: add a <label>, aria-label or aria-labelledby`;
|
|
938
|
+
out.push({
|
|
939
|
+
line: line(el, role, "", hidden, comment),
|
|
940
|
+
rank: placeholder && closeness(placeholder, el.node, text, normalizer) >= 0 ? 1 : 5
|
|
941
|
+
});
|
|
942
|
+
continue;
|
|
943
|
+
}
|
|
944
|
+
const rank = closeness(name, el.node, text, normalizer, exact);
|
|
945
|
+
out.push({
|
|
946
|
+
line: line(el, role, name, hidden, rank >= 0 ? "similar label" : "labelled control"),
|
|
947
|
+
rank: rank >= 0 ? 2 + rank : 10
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
return format("Labelled form controls", out);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// src/queries/label-text.ts
|
|
954
|
+
var label_text_exports = /* @__PURE__ */ __exportAll({
|
|
955
|
+
findAllByLabelText: () => findAllByLabelText,
|
|
956
|
+
findByLabelText: () => findByLabelText,
|
|
957
|
+
getAllByLabelText: () => getAllByLabelTextWithSuggestions,
|
|
958
|
+
getByLabelText: () => getByLabelTextWithSuggestions,
|
|
959
|
+
queryAllByLabelText: () => queryAllByLabelTextWithSuggestions,
|
|
960
|
+
queryByLabelText: () => queryByLabelText
|
|
961
|
+
});
|
|
962
|
+
function queryAllLabels(container) {
|
|
963
|
+
const root = implOf(container);
|
|
964
|
+
const out = [];
|
|
965
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) {
|
|
966
|
+
if (n.type !== ELEMENT_NODE || n.name !== "label" && n.name !== "input") continue;
|
|
967
|
+
const textToMatch = getLabelContentImpl(n);
|
|
968
|
+
if (textToMatch !== null) out.push({
|
|
969
|
+
node: n.node,
|
|
970
|
+
textToMatch
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
return out;
|
|
974
|
+
}
|
|
975
|
+
function queryAllLabelsByText(container, text, { exact = true, trim, collapseWhitespace, normalizer } = {}) {
|
|
976
|
+
const matcher = exact ? matches$1 : fuzzyMatches;
|
|
977
|
+
const matchNormalizer = makeNormalizer({
|
|
978
|
+
collapseWhitespace,
|
|
979
|
+
trim,
|
|
980
|
+
normalizer
|
|
981
|
+
});
|
|
982
|
+
return queryAllLabels(container).filter(({ node, textToMatch }) => matcher(textToMatch, node, text, matchNormalizer)).map(({ node }) => node);
|
|
983
|
+
}
|
|
984
|
+
function queryAllByLabelText(container, text, { selector = "*", exact = true, collapseWhitespace, trim, normalizer } = {}) {
|
|
985
|
+
checkContainerType(container);
|
|
986
|
+
const matcher = exact ? matches$1 : fuzzyMatches;
|
|
987
|
+
const matchNormalizer = makeNormalizer({
|
|
988
|
+
collapseWhitespace,
|
|
989
|
+
trim,
|
|
990
|
+
normalizer
|
|
991
|
+
});
|
|
992
|
+
const root = implOf(container);
|
|
993
|
+
const ctx = new LabelContext(root);
|
|
994
|
+
const labelledElements = [];
|
|
995
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) {
|
|
996
|
+
if (n.type !== ELEMENT_NODE) continue;
|
|
997
|
+
if (attr(n, "aria-labelledby") === null && ctx.labelsOf(n).length === 0) continue;
|
|
998
|
+
collectLabelled(ctx, n, selector, matcher, text, matchNormalizer, labelledElements);
|
|
999
|
+
}
|
|
1000
|
+
const ariaLabelled = queryAllByAttribute("aria-label", container, text, {
|
|
1001
|
+
exact,
|
|
1002
|
+
normalizer: matchNormalizer
|
|
1003
|
+
});
|
|
1004
|
+
for (let i = 0; i < ariaLabelled.length; i++) labelledElements.push(ariaLabelled[i]);
|
|
1005
|
+
const unique = Array.from(new Set(labelledElements));
|
|
1006
|
+
return selector === "*" ? unique : unique.filter((element) => matchesSelector(element[$impl], selector));
|
|
1007
|
+
}
|
|
1008
|
+
function collectLabelled(ctx, labelledElement, selector, matcher, text, matchNormalizer, labelledElements) {
|
|
1009
|
+
const labelList = getLabelsImpl(ctx, labelledElement, selector);
|
|
1010
|
+
for (const label of labelList) {
|
|
1011
|
+
if (!label.formControl) continue;
|
|
1012
|
+
const formControl = label.formControl.node;
|
|
1013
|
+
if (matcher(label.content, formControl, text, matchNormalizer)) labelledElements.push(formControl);
|
|
1014
|
+
}
|
|
1015
|
+
const labelsValue = labelList.filter((label) => Boolean(label.content)).map((label) => label.content);
|
|
1016
|
+
const node = labelledElement.node;
|
|
1017
|
+
if (matcher(labelsValue.join(" "), node, text, matchNormalizer)) labelledElements.push(node);
|
|
1018
|
+
if (labelsValue.length > 1) labelsValue.forEach((labelValue, index) => {
|
|
1019
|
+
if (matcher(labelValue, node, text, matchNormalizer)) labelledElements.push(node);
|
|
1020
|
+
const labelsFiltered = [...labelsValue];
|
|
1021
|
+
labelsFiltered.splice(index, 1);
|
|
1022
|
+
if (labelsFiltered.length > 1) {
|
|
1023
|
+
if (matcher(labelsFiltered.join(" "), node, text, matchNormalizer)) labelledElements.push(node);
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
function getAllByLabelText(container, text, ...rest) {
|
|
1028
|
+
const els = queryAllByLabelText(container, text, ...rest);
|
|
1029
|
+
if (!els.length) {
|
|
1030
|
+
const labels = queryAllLabelsByText(container, text, ...rest);
|
|
1031
|
+
if (labels.length) {
|
|
1032
|
+
const tagNames = labels.map((label) => getTagNameOfElementAssociatedWithLabelViaFor(container, label)).filter((tagName) => !!tagName);
|
|
1033
|
+
if (tagNames.length) throw getConfig().getElementError(tagNames.map((tagName) => `Found a label with the text of: ${text}, however the element associated with this label (<${tagName} />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <${tagName} />, you can use aria-label or aria-labelledby instead.`).join("\n\n"), container);
|
|
1034
|
+
else throw getConfig().getElementError(`Found a label with the text of: ${text}, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.`, container);
|
|
1035
|
+
} else throw getConfig().getElementError(withLabelCandidates(`Unable to find a label with the text of: ${text}`, container, text, rest[0]), container);
|
|
1036
|
+
}
|
|
1037
|
+
return els;
|
|
1038
|
+
}
|
|
1039
|
+
/** Ours: under CTRL_DOM_DEBUG, append the form controls and their names. */
|
|
1040
|
+
function withLabelCandidates(message, container, text, options = {}) {
|
|
1041
|
+
if (envDebugFormat() === null) return message;
|
|
1042
|
+
const { exact = true, trim, collapseWhitespace, normalizer } = options;
|
|
1043
|
+
const candidates = labelCandidates(container, text, makeNormalizer({
|
|
1044
|
+
trim,
|
|
1045
|
+
collapseWhitespace,
|
|
1046
|
+
normalizer
|
|
1047
|
+
}), exact);
|
|
1048
|
+
return candidates === "" ? message : `${message}\n\n${candidates}`;
|
|
1049
|
+
}
|
|
1050
|
+
function getTagNameOfElementAssociatedWithLabelViaFor(container, label) {
|
|
1051
|
+
const htmlFor = label.getAttribute("for");
|
|
1052
|
+
if (!htmlFor) return null;
|
|
1053
|
+
const element = new LabelContext(implOf(container)).byIdInContainer(htmlFor);
|
|
1054
|
+
return element ? element.node.tagName.toLowerCase() : null;
|
|
1055
|
+
}
|
|
1056
|
+
const getMultipleError$7 = (c, text) => `Found multiple elements with the text of: ${text}`;
|
|
1057
|
+
const queryByLabelText = wrapSingleQueryWithSuggestion(makeSingleQuery(queryAllByLabelText, getMultipleError$7), queryAllByLabelText.name, "query");
|
|
1058
|
+
const getByLabelText = makeSingleQuery(getAllByLabelText, getMultipleError$7);
|
|
1059
|
+
const findAllByLabelText = makeFindQuery(wrapAllByQueryWithSuggestion(getAllByLabelText, getAllByLabelText.name, "findAll"));
|
|
1060
|
+
const findByLabelText = makeFindQuery(wrapSingleQueryWithSuggestion(getByLabelText, getAllByLabelText.name, "find"));
|
|
1061
|
+
const getAllByLabelTextWithSuggestions = wrapAllByQueryWithSuggestion(getAllByLabelText, getAllByLabelText.name, "getAll");
|
|
1062
|
+
const getByLabelTextWithSuggestions = wrapSingleQueryWithSuggestion(getByLabelText, getAllByLabelText.name, "get");
|
|
1063
|
+
const queryAllByLabelTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByLabelText, queryAllByLabelText.name, "queryAll");
|
|
1064
|
+
|
|
1065
|
+
// src/queries/placeholder-text.ts
|
|
1066
|
+
var placeholder_text_exports = /* @__PURE__ */ __exportAll({
|
|
1067
|
+
findAllByPlaceholderText: () => findAllByPlaceholderText,
|
|
1068
|
+
findByPlaceholderText: () => findByPlaceholderText,
|
|
1069
|
+
getAllByPlaceholderText: () => getAllByPlaceholderText,
|
|
1070
|
+
getByPlaceholderText: () => getByPlaceholderText,
|
|
1071
|
+
queryAllByPlaceholderText: () => queryAllByPlaceholderTextWithSuggestions,
|
|
1072
|
+
queryByPlaceholderText: () => queryByPlaceholderText
|
|
1073
|
+
});
|
|
1074
|
+
function queryAllByPlaceholderText(...args) {
|
|
1075
|
+
checkContainerType(args[0]);
|
|
1076
|
+
return queryAllByAttribute("placeholder", ...args);
|
|
1077
|
+
}
|
|
1078
|
+
const getMultipleError$6 = (c, text) => `Found multiple elements with the placeholder text of: ${text}`;
|
|
1079
|
+
const getMissingError$6 = (c, text) => `Unable to find an element with the placeholder text of: ${text}`;
|
|
1080
|
+
const queryAllByPlaceholderTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByPlaceholderText, queryAllByPlaceholderText.name, "queryAll");
|
|
1081
|
+
const [queryByPlaceholderText, getAllByPlaceholderText, getByPlaceholderText, findAllByPlaceholderText, findByPlaceholderText] = buildQueries(queryAllByPlaceholderText, getMultipleError$6, getMissingError$6);
|
|
1082
|
+
|
|
1083
|
+
// src/queries/text.ts
|
|
1084
|
+
var text_exports = /* @__PURE__ */ __exportAll({
|
|
1085
|
+
findAllByText: () => findAllByText,
|
|
1086
|
+
findByText: () => findByText,
|
|
1087
|
+
getAllByText: () => getAllByText,
|
|
1088
|
+
getByText: () => getByText,
|
|
1089
|
+
queryAllByText: () => queryAllByTextWithSuggestions,
|
|
1090
|
+
queryByText: () => queryByText
|
|
1091
|
+
});
|
|
1092
|
+
/** Whether `ignore` is exactly the default "script, style" list (any element named script/style). */
|
|
1093
|
+
function isScriptStyleIgnore(ignore) {
|
|
1094
|
+
return ignore === "script, style" || ignore === "script,style";
|
|
1095
|
+
}
|
|
1096
|
+
function isScriptOrStyle(n) {
|
|
1097
|
+
const name = n.name;
|
|
1098
|
+
return name === "script" || name === "style";
|
|
1099
|
+
}
|
|
1100
|
+
function queryAllByText(container, text, { selector = "*", exact = true, collapseWhitespace, trim, ignore = getConfig().defaultIgnore, normalizer } = {}) {
|
|
1101
|
+
checkContainerType(container);
|
|
1102
|
+
const matcher = exact ? matches$1 : fuzzyMatches;
|
|
1103
|
+
const matchNormalizer = makeNormalizer({
|
|
1104
|
+
collapseWhitespace,
|
|
1105
|
+
trim,
|
|
1106
|
+
normalizer
|
|
1107
|
+
});
|
|
1108
|
+
const root = implOf(container);
|
|
1109
|
+
const anySelector = selector === "*";
|
|
1110
|
+
const fastIgnore = isScriptStyleIgnore(ignore);
|
|
1111
|
+
const out = [];
|
|
1112
|
+
const visit = (n) => {
|
|
1113
|
+
if (!anySelector && !matchesSelector(n, selector)) return;
|
|
1114
|
+
if (ignore) {
|
|
1115
|
+
if (fastIgnore ? isScriptOrStyle(n) : matchesSelector(n, ignore)) return;
|
|
1116
|
+
}
|
|
1117
|
+
if (matcher(getNodeTextImpl(n), n.node, text, matchNormalizer)) out.push(n.node);
|
|
1118
|
+
};
|
|
1119
|
+
if (root.type === ELEMENT_NODE) visit(root);
|
|
1120
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) if (n.type === ELEMENT_NODE) visit(n);
|
|
1121
|
+
return out;
|
|
1122
|
+
}
|
|
1123
|
+
const getMultipleError$5 = (c, text) => `Found multiple elements with the text: ${text}`;
|
|
1124
|
+
const getMissingError$5 = (c, text, options = {}) => {
|
|
1125
|
+
const { collapseWhitespace, trim, normalizer, selector } = options;
|
|
1126
|
+
const matchNormalizer = makeNormalizer({
|
|
1127
|
+
collapseWhitespace,
|
|
1128
|
+
trim,
|
|
1129
|
+
normalizer
|
|
1130
|
+
});
|
|
1131
|
+
const normalizedText = matchNormalizer(text.toString());
|
|
1132
|
+
const isNormalizedDifferent = normalizedText !== text.toString();
|
|
1133
|
+
const isCustomSelector = (selector ?? "*") !== "*";
|
|
1134
|
+
const message = `Unable to find an element with the text: ${isNormalizedDifferent ? `${normalizedText} (normalized from '${text}')` : text}${isCustomSelector ? `, which matches selector '${selector}'` : ""}. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.`;
|
|
1135
|
+
if (envDebugFormat() === null) return message;
|
|
1136
|
+
const { exact = true, ignore = getConfig().defaultIgnore } = options;
|
|
1137
|
+
const candidates = textCandidates(c, text, matchNormalizer, selector ?? "*", ignore, exact);
|
|
1138
|
+
return candidates === "" ? message : `${message}\n\n${candidates}`;
|
|
1139
|
+
};
|
|
1140
|
+
const queryAllByTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByText, queryAllByText.name, "queryAll");
|
|
1141
|
+
const [queryByText, getAllByText, getByText, findAllByText, findByText] = buildQueries(queryAllByText, getMultipleError$5, getMissingError$5);
|
|
1142
|
+
|
|
1143
|
+
// src/queries/display-value.ts
|
|
1144
|
+
var display_value_exports = /* @__PURE__ */ __exportAll({
|
|
1145
|
+
findAllByDisplayValue: () => findAllByDisplayValue,
|
|
1146
|
+
findByDisplayValue: () => findByDisplayValue,
|
|
1147
|
+
getAllByDisplayValue: () => getAllByDisplayValue,
|
|
1148
|
+
getByDisplayValue: () => getByDisplayValue,
|
|
1149
|
+
queryAllByDisplayValue: () => queryAllByDisplayValueWithSuggestions,
|
|
1150
|
+
queryByDisplayValue: () => queryByDisplayValue
|
|
1151
|
+
});
|
|
1152
|
+
function queryAllByDisplayValue(container, value, { exact = true, collapseWhitespace, trim, normalizer } = {}) {
|
|
1153
|
+
checkContainerType(container);
|
|
1154
|
+
const matcher = exact ? matches$1 : fuzzyMatches;
|
|
1155
|
+
const matchNormalizer = makeNormalizer({
|
|
1156
|
+
collapseWhitespace,
|
|
1157
|
+
trim,
|
|
1158
|
+
normalizer
|
|
1159
|
+
});
|
|
1160
|
+
const root = implOf(container);
|
|
1161
|
+
const out = [];
|
|
1162
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) {
|
|
1163
|
+
if (n.type !== ELEMENT_NODE) continue;
|
|
1164
|
+
const name = n.name;
|
|
1165
|
+
if (name !== "input" && name !== "textarea" && name !== "select") continue;
|
|
1166
|
+
const node = n.node;
|
|
1167
|
+
if (n.tag === T.select && n.ns === HTML_NS) {
|
|
1168
|
+
const options = node.options;
|
|
1169
|
+
let found = false;
|
|
1170
|
+
for (let i = 0; i < options.length; i++) {
|
|
1171
|
+
const option = options[i];
|
|
1172
|
+
if (option.selected && matcher(getNodeTextImpl(option[$impl]), option, value, matchNormalizer)) {
|
|
1173
|
+
found = true;
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
if (found) out.push(node);
|
|
1178
|
+
} else if (matcher(node.value, node, value, matchNormalizer)) out.push(node);
|
|
1179
|
+
}
|
|
1180
|
+
return out;
|
|
1181
|
+
}
|
|
1182
|
+
const getMultipleError$4 = (c, value) => `Found multiple elements with the display value: ${value}.`;
|
|
1183
|
+
const getMissingError$4 = (c, value) => `Unable to find an element with the display value: ${value}.`;
|
|
1184
|
+
const queryAllByDisplayValueWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByDisplayValue, queryAllByDisplayValue.name, "queryAll");
|
|
1185
|
+
const [queryByDisplayValue, getAllByDisplayValue, getByDisplayValue, findAllByDisplayValue, findByDisplayValue] = buildQueries(queryAllByDisplayValue, getMultipleError$4, getMissingError$4);
|
|
1186
|
+
|
|
1187
|
+
// src/queries/alt-text.ts
|
|
1188
|
+
var alt_text_exports = /* @__PURE__ */ __exportAll({
|
|
1189
|
+
findAllByAltText: () => findAllByAltText,
|
|
1190
|
+
findByAltText: () => findByAltText,
|
|
1191
|
+
getAllByAltText: () => getAllByAltText,
|
|
1192
|
+
getByAltText: () => getByAltText,
|
|
1193
|
+
queryAllByAltText: () => queryAllByAltTextWithSuggestions,
|
|
1194
|
+
queryByAltText: () => queryByAltText
|
|
1195
|
+
});
|
|
1196
|
+
const VALID_TAG_REGEXP = /^(img|input|area|.+-.+)$/i;
|
|
1197
|
+
function queryAllByAltText(container, alt, options = {}) {
|
|
1198
|
+
checkContainerType(container);
|
|
1199
|
+
return queryAllByAttribute("alt", container, alt, options).filter((node) => VALID_TAG_REGEXP.test(node.tagName));
|
|
1200
|
+
}
|
|
1201
|
+
const getMultipleError$3 = (c, alt) => `Found multiple elements with the alt text: ${alt}`;
|
|
1202
|
+
const getMissingError$3 = (c, alt) => `Unable to find an element with the alt text: ${alt}`;
|
|
1203
|
+
const queryAllByAltTextWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByAltText, queryAllByAltText.name, "queryAll");
|
|
1204
|
+
const [queryByAltText, getAllByAltText, getByAltText, findAllByAltText, findByAltText] = buildQueries(queryAllByAltText, getMultipleError$3, getMissingError$3);
|
|
1205
|
+
|
|
1206
|
+
// src/queries/title.ts
|
|
1207
|
+
var title_exports = /* @__PURE__ */ __exportAll({
|
|
1208
|
+
findAllByTitle: () => findAllByTitle,
|
|
1209
|
+
findByTitle: () => findByTitle,
|
|
1210
|
+
getAllByTitle: () => getAllByTitle,
|
|
1211
|
+
getByTitle: () => getByTitle,
|
|
1212
|
+
queryAllByTitle: () => queryAllByTitleWithSuggestions,
|
|
1213
|
+
queryByTitle: () => queryByTitle
|
|
1214
|
+
});
|
|
1215
|
+
/** `node.tagName.toLowerCase() === 'title' && node.parentElement?.tagName.toLowerCase() === 'svg'` */
|
|
1216
|
+
function isSvgTitle(n) {
|
|
1217
|
+
const parent = n.parent;
|
|
1218
|
+
return asciiLowercase(n.prefix === null ? n.name : n.prefix + ":" + n.name) === "title" && parent !== null && parent.type === ELEMENT_NODE && asciiLowercase(parent.prefix === null ? parent.name : parent.prefix + ":" + parent.name) === "svg";
|
|
1219
|
+
}
|
|
1220
|
+
function queryAllByTitle(container, text, { exact = true, collapseWhitespace, trim, normalizer } = {}) {
|
|
1221
|
+
checkContainerType(container);
|
|
1222
|
+
const matcher = exact ? matches$1 : fuzzyMatches;
|
|
1223
|
+
const matchNormalizer = makeNormalizer({
|
|
1224
|
+
collapseWhitespace,
|
|
1225
|
+
trim,
|
|
1226
|
+
normalizer
|
|
1227
|
+
});
|
|
1228
|
+
const root = implOf(container);
|
|
1229
|
+
const out = [];
|
|
1230
|
+
for (let n = root.first; n !== null; n = nextInTree(n, root)) {
|
|
1231
|
+
if (n.type !== ELEMENT_NODE) continue;
|
|
1232
|
+
const title = n.attrs === null ? null : attr(n, "title");
|
|
1233
|
+
const svgTitle = n.name === "title" && n.parent !== null && n.parent.type === ELEMENT_NODE && n.parent.name === "svg";
|
|
1234
|
+
if (title === null && !svgTitle) continue;
|
|
1235
|
+
if (matcher(title, n.node, text, matchNormalizer) || isSvgTitle(n) && matcher(getNodeTextImpl(n), n.node, text, matchNormalizer)) out.push(n.node);
|
|
1236
|
+
}
|
|
1237
|
+
return out;
|
|
1238
|
+
}
|
|
1239
|
+
const getMultipleError$2 = (c, title) => `Found multiple elements with the title: ${title}.`;
|
|
1240
|
+
const getMissingError$2 = (c, title) => `Unable to find an element with the title: ${title}.`;
|
|
1241
|
+
const queryAllByTitleWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByTitle, queryAllByTitle.name, "queryAll");
|
|
1242
|
+
const [queryByTitle, getAllByTitle, getByTitle, findAllByTitle, findByTitle] = buildQueries(queryAllByTitle, getMultipleError$2, getMissingError$2);
|
|
1243
|
+
|
|
1244
|
+
// src/queries/role.ts
|
|
1245
|
+
var role_exports = /* @__PURE__ */ __exportAll({
|
|
1246
|
+
findAllByRole: () => findAllByRole,
|
|
1247
|
+
findByRole: () => findByRole,
|
|
1248
|
+
getAllByRole: () => getAllByRole,
|
|
1249
|
+
getByRole: () => getByRole,
|
|
1250
|
+
queryAllByRole: () => queryAllByRoleWithSuggestions,
|
|
1251
|
+
queryByRole: () => queryByRole
|
|
1252
|
+
});
|
|
1253
|
+
const identity = (text) => text;
|
|
1254
|
+
function assertSupported(role, prop) {
|
|
1255
|
+
if (!aria.roleSupportsProp(role, prop)) throw new Error(`"${prop}" is not supported on role "${role}".`);
|
|
1256
|
+
}
|
|
1257
|
+
function queryAllByRole(container, role, { hidden = getConfig().defaultHidden, name, description, queryFallbacks = false, selected, busy, checked, pressed, current, level, expanded, value: { now: valueNow, min: valueMin, max: valueMax, text: valueText } = {} } = {}) {
|
|
1258
|
+
checkContainerType(container);
|
|
1259
|
+
if (selected !== void 0) assertSupported(role, "aria-selected");
|
|
1260
|
+
if (busy !== void 0) assertSupported(role, "aria-busy");
|
|
1261
|
+
if (checked !== void 0) assertSupported(role, "aria-checked");
|
|
1262
|
+
if (pressed !== void 0) assertSupported(role, "aria-pressed");
|
|
1263
|
+
if (current !== void 0) assertSupported(role, "aria-current");
|
|
1264
|
+
if (level !== void 0) {
|
|
1265
|
+
if (role !== "heading") throw new Error(`Role "${role}" cannot have "level" property.`);
|
|
1266
|
+
}
|
|
1267
|
+
if (valueNow !== void 0) assertSupported(role, "aria-valuenow");
|
|
1268
|
+
if (valueMax !== void 0) assertSupported(role, "aria-valuemax");
|
|
1269
|
+
if (valueMin !== void 0) assertSupported(role, "aria-valuemin");
|
|
1270
|
+
if (valueText !== void 0) assertSupported(role, "aria-valuetext");
|
|
1271
|
+
if (expanded !== void 0) assertSupported(role, "aria-expanded");
|
|
1272
|
+
const state = {
|
|
1273
|
+
selected,
|
|
1274
|
+
busy,
|
|
1275
|
+
checked,
|
|
1276
|
+
pressed,
|
|
1277
|
+
current,
|
|
1278
|
+
level,
|
|
1279
|
+
expanded,
|
|
1280
|
+
valueNow,
|
|
1281
|
+
valueMin,
|
|
1282
|
+
valueMax,
|
|
1283
|
+
valueText
|
|
1284
|
+
};
|
|
1285
|
+
const pseudo = getConfig().computedStyleSupportsPseudoElements;
|
|
1286
|
+
const root = implOf(container);
|
|
1287
|
+
const out = [];
|
|
1288
|
+
const gcs = styleOverride(root);
|
|
1289
|
+
const memo = gcs !== null && hidden === false ? /* @__PURE__ */ new Map() : null;
|
|
1290
|
+
for (let el = root.first; el !== null; el = nextInTree(el, root)) {
|
|
1291
|
+
if (el.type !== ELEMENT_NODE) continue;
|
|
1292
|
+
if (!aria.roleMatches(el, role, queryFallbacks)) continue;
|
|
1293
|
+
if (!matchesState(el, state)) continue;
|
|
1294
|
+
if (hidden === false && (gcs === null ? isInaccessibleImpl$1(el) : aria.isInaccessibleWithStyle(el, gcs, memo))) continue;
|
|
1295
|
+
if (name !== void 0 && !matches$1(aria.computeAccessibleName(el, pseudo, gcs), el.node, name, identity)) continue;
|
|
1296
|
+
if (description !== void 0 && !matches$1(aria.computeAccessibleDescription(el, pseudo, gcs), el.node, description, identity)) continue;
|
|
1297
|
+
out.push(el.node);
|
|
1298
|
+
}
|
|
1299
|
+
return out;
|
|
1300
|
+
}
|
|
1301
|
+
/** ByRole's state filters (upstream's closure `matchesState`); one object per query, no per-element allocation. */
|
|
1302
|
+
function matchesState(element, s) {
|
|
1303
|
+
if (s.selected !== void 0) return s.selected === computeAriaSelected$1(element);
|
|
1304
|
+
if (s.busy !== void 0) return s.busy === computeAriaBusy$1(element);
|
|
1305
|
+
if (s.checked !== void 0) return s.checked === computeAriaChecked(element);
|
|
1306
|
+
if (s.pressed !== void 0) return s.pressed === computeAriaPressed(element);
|
|
1307
|
+
if (s.current !== void 0) return s.current === computeAriaCurrent$1(element);
|
|
1308
|
+
if (s.expanded !== void 0) return s.expanded === computeAriaExpanded$1(element);
|
|
1309
|
+
if (s.level !== void 0) return s.level === computeHeadingLevelImpl(element);
|
|
1310
|
+
if (s.valueNow !== void 0 || s.valueMax !== void 0 || s.valueMin !== void 0 || s.valueText !== void 0) {
|
|
1311
|
+
let valueMatches = true;
|
|
1312
|
+
if (s.valueNow !== void 0) valueMatches &&= s.valueNow === computeAriaValueNow(element);
|
|
1313
|
+
if (s.valueMax !== void 0) valueMatches &&= s.valueMax === computeAriaValueMax(element);
|
|
1314
|
+
if (s.valueMin !== void 0) valueMatches &&= s.valueMin === computeAriaValueMin(element);
|
|
1315
|
+
if (s.valueText !== void 0) valueMatches &&= matches$1(computeAriaValueText(element) ?? null, element.node, s.valueText, identity);
|
|
1316
|
+
return valueMatches;
|
|
1317
|
+
}
|
|
1318
|
+
return true;
|
|
1319
|
+
}
|
|
1320
|
+
const getNameHint = (name) => {
|
|
1321
|
+
let nameHint = "";
|
|
1322
|
+
if (name === void 0) nameHint = "";
|
|
1323
|
+
else if (typeof name === "string") nameHint = ` and name "${name}"`;
|
|
1324
|
+
else nameHint = ` and name \`${name}\``;
|
|
1325
|
+
return nameHint;
|
|
1326
|
+
};
|
|
1327
|
+
const getMultipleError$1 = (c, role, { name } = {}) => {
|
|
1328
|
+
return `Found multiple elements with the role "${role}"${getNameHint(name)}`;
|
|
1329
|
+
};
|
|
1330
|
+
const getMissingError$1 = (container, role, options = {}) => {
|
|
1331
|
+
const { hidden = getConfig().defaultHidden, name, description } = options;
|
|
1332
|
+
if (envDebugFormat() !== null) return agentMissingError(container, role, options, hidden);
|
|
1333
|
+
if (getConfig()._disableExpensiveErrorDiagnostics) return `Unable to find role="${role}"${getNameHint(name)}`;
|
|
1334
|
+
let roles = "";
|
|
1335
|
+
Array.from(container.children).forEach((childElement) => {
|
|
1336
|
+
roles += prettyRoles(childElement, {
|
|
1337
|
+
hidden,
|
|
1338
|
+
includeDescription: description !== void 0
|
|
1339
|
+
});
|
|
1340
|
+
});
|
|
1341
|
+
let roleMessage;
|
|
1342
|
+
if (roles.length === 0) {
|
|
1343
|
+
if (hidden === false) roleMessage = "There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole";
|
|
1344
|
+
else roleMessage = "There are no available roles.";
|
|
1345
|
+
} else roleMessage = `
|
|
1346
|
+
Here are the ${hidden === false ? "accessible" : "available"} roles:
|
|
1347
|
+
|
|
1348
|
+
${roles.replace(/\n/g, "\n ").replace(/\n\s\s\n/g, "\n\n")}
|
|
1349
|
+
`.trim();
|
|
1350
|
+
let nameHint = "";
|
|
1351
|
+
if (name === void 0) nameHint = "";
|
|
1352
|
+
else if (typeof name === "string") nameHint = ` and name "${name}"`;
|
|
1353
|
+
else nameHint = ` and name \`${name}\``;
|
|
1354
|
+
let descriptionHint = "";
|
|
1355
|
+
if (description === void 0) descriptionHint = "";
|
|
1356
|
+
else if (typeof description === "string") descriptionHint = ` and description "${description}"`;
|
|
1357
|
+
else descriptionHint = ` and description \`${description}\``;
|
|
1358
|
+
return `
|
|
1359
|
+
Unable to find an ${hidden === false ? "accessible " : ""}element with the role "${role}"${nameHint}${descriptionHint}
|
|
1360
|
+
|
|
1361
|
+
${roleMessage}`.trim();
|
|
1362
|
+
};
|
|
1363
|
+
function agentMissingError(container, role, options, hidden) {
|
|
1364
|
+
const { name, description, queryFallbacks = false, value: { now: valueNow, min: valueMin, max: valueMax, text: valueText } = {} } = options;
|
|
1365
|
+
const { selected, busy, checked, pressed, current, level, expanded } = options;
|
|
1366
|
+
const state = {
|
|
1367
|
+
selected,
|
|
1368
|
+
busy,
|
|
1369
|
+
checked,
|
|
1370
|
+
pressed,
|
|
1371
|
+
current,
|
|
1372
|
+
level,
|
|
1373
|
+
expanded,
|
|
1374
|
+
valueNow,
|
|
1375
|
+
valueMin,
|
|
1376
|
+
valueMax,
|
|
1377
|
+
valueText
|
|
1378
|
+
};
|
|
1379
|
+
const stateHint = Object.entries({
|
|
1380
|
+
selected,
|
|
1381
|
+
busy,
|
|
1382
|
+
checked,
|
|
1383
|
+
pressed,
|
|
1384
|
+
current,
|
|
1385
|
+
level,
|
|
1386
|
+
expanded,
|
|
1387
|
+
value: options.value
|
|
1388
|
+
}).filter(([, v]) => v !== void 0).map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join(", ");
|
|
1389
|
+
const descriptionHint = description === void 0 ? "" : typeof description === "string" ? ` and description "${description}"` : ` and description \`${description}\``;
|
|
1390
|
+
const head = `Unable to find an ${hidden === false ? "accessible " : ""}element with the role "${role}"${getNameHint(name)}${descriptionHint}`;
|
|
1391
|
+
const candidates = roleCandidates(container, {
|
|
1392
|
+
role: String(role),
|
|
1393
|
+
name,
|
|
1394
|
+
hidden,
|
|
1395
|
+
queryFallbacks,
|
|
1396
|
+
matchesState: (el) => matchesState(el, state),
|
|
1397
|
+
stateHint: `{ ${stateHint} }`
|
|
1398
|
+
});
|
|
1399
|
+
return candidates === "" ? head : `${head}\n\n${candidates}`;
|
|
1400
|
+
}
|
|
1401
|
+
const queryAllByRoleWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByRole, queryAllByRole.name, "queryAll");
|
|
1402
|
+
const [queryByRole, getAllByRole, getByRole, findAllByRole, findByRole] = buildQueries(queryAllByRole, getMultipleError$1, getMissingError$1);
|
|
1403
|
+
|
|
1404
|
+
// src/queries/test-id.ts
|
|
1405
|
+
var test_id_exports = /* @__PURE__ */ __exportAll({
|
|
1406
|
+
findAllByTestId: () => findAllByTestId,
|
|
1407
|
+
findByTestId: () => findByTestId,
|
|
1408
|
+
getAllByTestId: () => getAllByTestId,
|
|
1409
|
+
getByTestId: () => getByTestId,
|
|
1410
|
+
queryAllByTestId: () => queryAllByTestIdWithSuggestions,
|
|
1411
|
+
queryByTestId: () => queryByTestId
|
|
1412
|
+
});
|
|
1413
|
+
const getTestIdAttribute = () => getConfig().testIdAttribute;
|
|
1414
|
+
function queryAllByTestId(...args) {
|
|
1415
|
+
checkContainerType(args[0]);
|
|
1416
|
+
return queryAllByAttribute(getTestIdAttribute(), ...args);
|
|
1417
|
+
}
|
|
1418
|
+
const getMultipleError = (c, id) => `Found multiple elements by: [${getTestIdAttribute()}="${id}"]`;
|
|
1419
|
+
const getMissingError = (c, id) => `Unable to find an element by: [${getTestIdAttribute()}="${id}"]`;
|
|
1420
|
+
const queryAllByTestIdWithSuggestions = wrapAllByQueryWithSuggestion(queryAllByTestId, queryAllByTestId.name, "queryAll");
|
|
1421
|
+
const [queryByTestId, getAllByTestId, getByTestId, findAllByTestId, findByTestId] = buildQueries(queryAllByTestId, getMultipleError, getMissingError);
|
|
1422
|
+
|
|
1423
|
+
// src/queries/ordered.ts
|
|
1424
|
+
/**
|
|
1425
|
+
* All query functions as a plain object in upstream's key order (module order, then
|
|
1426
|
+
* findAllBy/findBy/getAllBy/getBy/queryAllBy/queryBy). An ES module namespace would sort
|
|
1427
|
+
* the keys alphabetically; `screen`/`within` key order follows upstream's CJS build.
|
|
1428
|
+
*/
|
|
1429
|
+
function build() {
|
|
1430
|
+
const out = {};
|
|
1431
|
+
const groups = [
|
|
1432
|
+
[label_text_exports, "LabelText"],
|
|
1433
|
+
[placeholder_text_exports, "PlaceholderText"],
|
|
1434
|
+
[text_exports, "Text"],
|
|
1435
|
+
[display_value_exports, "DisplayValue"],
|
|
1436
|
+
[alt_text_exports, "AltText"],
|
|
1437
|
+
[title_exports, "Title"],
|
|
1438
|
+
[role_exports, "Role"],
|
|
1439
|
+
[test_id_exports, "TestId"]
|
|
1440
|
+
];
|
|
1441
|
+
for (const [mod, name] of groups) for (const variant of [
|
|
1442
|
+
"findAllBy",
|
|
1443
|
+
"findBy",
|
|
1444
|
+
"getAllBy",
|
|
1445
|
+
"getBy",
|
|
1446
|
+
"queryAllBy",
|
|
1447
|
+
"queryBy"
|
|
1448
|
+
]) out[variant + name] = mod[variant + name];
|
|
1449
|
+
return out;
|
|
1450
|
+
}
|
|
1451
|
+
const queries = build();
|
|
1452
|
+
|
|
1453
|
+
// src/get-queries-for-element.ts
|
|
1454
|
+
/**
|
|
1455
|
+
* @param element container
|
|
1456
|
+
* @param queries object of functions
|
|
1457
|
+
* @param initialValue for reducer
|
|
1458
|
+
* @returns object of functions bound to container
|
|
1459
|
+
*/
|
|
1460
|
+
function getQueriesForElement(element, queries$1 = queries, initialValue = {}) {
|
|
1461
|
+
return Object.keys(queries$1).reduce((helpers, key) => {
|
|
1462
|
+
helpers[key] = queries$1[key].bind(null, element);
|
|
1463
|
+
return helpers;
|
|
1464
|
+
}, initialValue);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// src/wait-for-element-to-be-removed.ts
|
|
1468
|
+
const isRemoved = (result) => !result || Array.isArray(result) && !result.length;
|
|
1469
|
+
function initialCheck(elements) {
|
|
1470
|
+
if (isRemoved(elements)) throw new Error("The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.");
|
|
1471
|
+
}
|
|
1472
|
+
async function waitForElementToBeRemoved(callback, options) {
|
|
1473
|
+
const timeoutError = /* @__PURE__ */ new Error("Timed out in waitForElementToBeRemoved.");
|
|
1474
|
+
if (typeof callback !== "function") {
|
|
1475
|
+
initialCheck(callback);
|
|
1476
|
+
const getRemainingElements = (Array.isArray(callback) ? callback : [callback]).map((element) => {
|
|
1477
|
+
let parent = element.parentElement;
|
|
1478
|
+
if (parent === null) return () => null;
|
|
1479
|
+
while (parent.parentElement) parent = parent.parentElement;
|
|
1480
|
+
return () => parent.contains(element) ? element : null;
|
|
1481
|
+
});
|
|
1482
|
+
callback = () => getRemainingElements.map((c) => c()).filter(Boolean);
|
|
1483
|
+
}
|
|
1484
|
+
const cb = callback;
|
|
1485
|
+
initialCheck(cb());
|
|
1486
|
+
return waitFor(() => {
|
|
1487
|
+
let result;
|
|
1488
|
+
try {
|
|
1489
|
+
result = cb();
|
|
1490
|
+
} catch (error) {
|
|
1491
|
+
if (error.name === "TestingLibraryElementError") return;
|
|
1492
|
+
throw error;
|
|
1493
|
+
}
|
|
1494
|
+
if (!isRemoved(result)) throw timeoutError;
|
|
1495
|
+
}, options);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// src/event-map.ts
|
|
1499
|
+
const eventMap = {
|
|
1500
|
+
copy: {
|
|
1501
|
+
EventType: "ClipboardEvent",
|
|
1502
|
+
defaultInit: {
|
|
1503
|
+
bubbles: true,
|
|
1504
|
+
cancelable: true,
|
|
1505
|
+
composed: true
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
cut: {
|
|
1509
|
+
EventType: "ClipboardEvent",
|
|
1510
|
+
defaultInit: {
|
|
1511
|
+
bubbles: true,
|
|
1512
|
+
cancelable: true,
|
|
1513
|
+
composed: true
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1516
|
+
paste: {
|
|
1517
|
+
EventType: "ClipboardEvent",
|
|
1518
|
+
defaultInit: {
|
|
1519
|
+
bubbles: true,
|
|
1520
|
+
cancelable: true,
|
|
1521
|
+
composed: true
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
compositionEnd: {
|
|
1525
|
+
EventType: "CompositionEvent",
|
|
1526
|
+
defaultInit: {
|
|
1527
|
+
bubbles: true,
|
|
1528
|
+
cancelable: true,
|
|
1529
|
+
composed: true
|
|
1530
|
+
}
|
|
1531
|
+
},
|
|
1532
|
+
compositionStart: {
|
|
1533
|
+
EventType: "CompositionEvent",
|
|
1534
|
+
defaultInit: {
|
|
1535
|
+
bubbles: true,
|
|
1536
|
+
cancelable: true,
|
|
1537
|
+
composed: true
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
compositionUpdate: {
|
|
1541
|
+
EventType: "CompositionEvent",
|
|
1542
|
+
defaultInit: {
|
|
1543
|
+
bubbles: true,
|
|
1544
|
+
cancelable: true,
|
|
1545
|
+
composed: true
|
|
1546
|
+
}
|
|
1547
|
+
},
|
|
1548
|
+
keyDown: {
|
|
1549
|
+
EventType: "KeyboardEvent",
|
|
1550
|
+
defaultInit: {
|
|
1551
|
+
bubbles: true,
|
|
1552
|
+
cancelable: true,
|
|
1553
|
+
charCode: 0,
|
|
1554
|
+
composed: true
|
|
1555
|
+
}
|
|
1556
|
+
},
|
|
1557
|
+
keyPress: {
|
|
1558
|
+
EventType: "KeyboardEvent",
|
|
1559
|
+
defaultInit: {
|
|
1560
|
+
bubbles: true,
|
|
1561
|
+
cancelable: true,
|
|
1562
|
+
charCode: 0,
|
|
1563
|
+
composed: true
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
keyUp: {
|
|
1567
|
+
EventType: "KeyboardEvent",
|
|
1568
|
+
defaultInit: {
|
|
1569
|
+
bubbles: true,
|
|
1570
|
+
cancelable: true,
|
|
1571
|
+
charCode: 0,
|
|
1572
|
+
composed: true
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
focus: {
|
|
1576
|
+
EventType: "FocusEvent",
|
|
1577
|
+
defaultInit: {
|
|
1578
|
+
bubbles: false,
|
|
1579
|
+
cancelable: false,
|
|
1580
|
+
composed: true
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
blur: {
|
|
1584
|
+
EventType: "FocusEvent",
|
|
1585
|
+
defaultInit: {
|
|
1586
|
+
bubbles: false,
|
|
1587
|
+
cancelable: false,
|
|
1588
|
+
composed: true
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
focusIn: {
|
|
1592
|
+
EventType: "FocusEvent",
|
|
1593
|
+
defaultInit: {
|
|
1594
|
+
bubbles: true,
|
|
1595
|
+
cancelable: false,
|
|
1596
|
+
composed: true
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
focusOut: {
|
|
1600
|
+
EventType: "FocusEvent",
|
|
1601
|
+
defaultInit: {
|
|
1602
|
+
bubbles: true,
|
|
1603
|
+
cancelable: false,
|
|
1604
|
+
composed: true
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
change: {
|
|
1608
|
+
EventType: "Event",
|
|
1609
|
+
defaultInit: {
|
|
1610
|
+
bubbles: true,
|
|
1611
|
+
cancelable: false
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
input: {
|
|
1615
|
+
EventType: "InputEvent",
|
|
1616
|
+
defaultInit: {
|
|
1617
|
+
bubbles: true,
|
|
1618
|
+
cancelable: false,
|
|
1619
|
+
composed: true
|
|
1620
|
+
}
|
|
1621
|
+
},
|
|
1622
|
+
invalid: {
|
|
1623
|
+
EventType: "Event",
|
|
1624
|
+
defaultInit: {
|
|
1625
|
+
bubbles: false,
|
|
1626
|
+
cancelable: true
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
submit: {
|
|
1630
|
+
EventType: "Event",
|
|
1631
|
+
defaultInit: {
|
|
1632
|
+
bubbles: true,
|
|
1633
|
+
cancelable: true
|
|
1634
|
+
}
|
|
1635
|
+
},
|
|
1636
|
+
reset: {
|
|
1637
|
+
EventType: "Event",
|
|
1638
|
+
defaultInit: {
|
|
1639
|
+
bubbles: true,
|
|
1640
|
+
cancelable: true
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
click: {
|
|
1644
|
+
EventType: "MouseEvent",
|
|
1645
|
+
defaultInit: {
|
|
1646
|
+
bubbles: true,
|
|
1647
|
+
cancelable: true,
|
|
1648
|
+
button: 0,
|
|
1649
|
+
composed: true
|
|
1650
|
+
}
|
|
1651
|
+
},
|
|
1652
|
+
contextMenu: {
|
|
1653
|
+
EventType: "MouseEvent",
|
|
1654
|
+
defaultInit: {
|
|
1655
|
+
bubbles: true,
|
|
1656
|
+
cancelable: true,
|
|
1657
|
+
composed: true
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
dblClick: {
|
|
1661
|
+
EventType: "MouseEvent",
|
|
1662
|
+
defaultInit: {
|
|
1663
|
+
bubbles: true,
|
|
1664
|
+
cancelable: true,
|
|
1665
|
+
composed: true
|
|
1666
|
+
}
|
|
1667
|
+
},
|
|
1668
|
+
drag: {
|
|
1669
|
+
EventType: "DragEvent",
|
|
1670
|
+
defaultInit: {
|
|
1671
|
+
bubbles: true,
|
|
1672
|
+
cancelable: true,
|
|
1673
|
+
composed: true
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
dragEnd: {
|
|
1677
|
+
EventType: "DragEvent",
|
|
1678
|
+
defaultInit: {
|
|
1679
|
+
bubbles: true,
|
|
1680
|
+
cancelable: false,
|
|
1681
|
+
composed: true
|
|
1682
|
+
}
|
|
1683
|
+
},
|
|
1684
|
+
dragEnter: {
|
|
1685
|
+
EventType: "DragEvent",
|
|
1686
|
+
defaultInit: {
|
|
1687
|
+
bubbles: true,
|
|
1688
|
+
cancelable: true,
|
|
1689
|
+
composed: true
|
|
1690
|
+
}
|
|
1691
|
+
},
|
|
1692
|
+
dragExit: {
|
|
1693
|
+
EventType: "DragEvent",
|
|
1694
|
+
defaultInit: {
|
|
1695
|
+
bubbles: true,
|
|
1696
|
+
cancelable: false,
|
|
1697
|
+
composed: true
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
dragLeave: {
|
|
1701
|
+
EventType: "DragEvent",
|
|
1702
|
+
defaultInit: {
|
|
1703
|
+
bubbles: true,
|
|
1704
|
+
cancelable: false,
|
|
1705
|
+
composed: true
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
dragOver: {
|
|
1709
|
+
EventType: "DragEvent",
|
|
1710
|
+
defaultInit: {
|
|
1711
|
+
bubbles: true,
|
|
1712
|
+
cancelable: true,
|
|
1713
|
+
composed: true
|
|
1714
|
+
}
|
|
1715
|
+
},
|
|
1716
|
+
dragStart: {
|
|
1717
|
+
EventType: "DragEvent",
|
|
1718
|
+
defaultInit: {
|
|
1719
|
+
bubbles: true,
|
|
1720
|
+
cancelable: true,
|
|
1721
|
+
composed: true
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
drop: {
|
|
1725
|
+
EventType: "DragEvent",
|
|
1726
|
+
defaultInit: {
|
|
1727
|
+
bubbles: true,
|
|
1728
|
+
cancelable: true,
|
|
1729
|
+
composed: true
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
mouseDown: {
|
|
1733
|
+
EventType: "MouseEvent",
|
|
1734
|
+
defaultInit: {
|
|
1735
|
+
bubbles: true,
|
|
1736
|
+
cancelable: true,
|
|
1737
|
+
composed: true
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
mouseEnter: {
|
|
1741
|
+
EventType: "MouseEvent",
|
|
1742
|
+
defaultInit: {
|
|
1743
|
+
bubbles: false,
|
|
1744
|
+
cancelable: false,
|
|
1745
|
+
composed: true
|
|
1746
|
+
}
|
|
1747
|
+
},
|
|
1748
|
+
mouseLeave: {
|
|
1749
|
+
EventType: "MouseEvent",
|
|
1750
|
+
defaultInit: {
|
|
1751
|
+
bubbles: false,
|
|
1752
|
+
cancelable: false,
|
|
1753
|
+
composed: true
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
mouseMove: {
|
|
1757
|
+
EventType: "MouseEvent",
|
|
1758
|
+
defaultInit: {
|
|
1759
|
+
bubbles: true,
|
|
1760
|
+
cancelable: true,
|
|
1761
|
+
composed: true
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
mouseOut: {
|
|
1765
|
+
EventType: "MouseEvent",
|
|
1766
|
+
defaultInit: {
|
|
1767
|
+
bubbles: true,
|
|
1768
|
+
cancelable: true,
|
|
1769
|
+
composed: true
|
|
1770
|
+
}
|
|
1771
|
+
},
|
|
1772
|
+
mouseOver: {
|
|
1773
|
+
EventType: "MouseEvent",
|
|
1774
|
+
defaultInit: {
|
|
1775
|
+
bubbles: true,
|
|
1776
|
+
cancelable: true,
|
|
1777
|
+
composed: true
|
|
1778
|
+
}
|
|
1779
|
+
},
|
|
1780
|
+
mouseUp: {
|
|
1781
|
+
EventType: "MouseEvent",
|
|
1782
|
+
defaultInit: {
|
|
1783
|
+
bubbles: true,
|
|
1784
|
+
cancelable: true,
|
|
1785
|
+
composed: true
|
|
1786
|
+
}
|
|
1787
|
+
},
|
|
1788
|
+
select: {
|
|
1789
|
+
EventType: "Event",
|
|
1790
|
+
defaultInit: {
|
|
1791
|
+
bubbles: true,
|
|
1792
|
+
cancelable: false
|
|
1793
|
+
}
|
|
1794
|
+
},
|
|
1795
|
+
touchCancel: {
|
|
1796
|
+
EventType: "TouchEvent",
|
|
1797
|
+
defaultInit: {
|
|
1798
|
+
bubbles: true,
|
|
1799
|
+
cancelable: false,
|
|
1800
|
+
composed: true
|
|
1801
|
+
}
|
|
1802
|
+
},
|
|
1803
|
+
touchEnd: {
|
|
1804
|
+
EventType: "TouchEvent",
|
|
1805
|
+
defaultInit: {
|
|
1806
|
+
bubbles: true,
|
|
1807
|
+
cancelable: true,
|
|
1808
|
+
composed: true
|
|
1809
|
+
}
|
|
1810
|
+
},
|
|
1811
|
+
touchMove: {
|
|
1812
|
+
EventType: "TouchEvent",
|
|
1813
|
+
defaultInit: {
|
|
1814
|
+
bubbles: true,
|
|
1815
|
+
cancelable: true,
|
|
1816
|
+
composed: true
|
|
1817
|
+
}
|
|
1818
|
+
},
|
|
1819
|
+
touchStart: {
|
|
1820
|
+
EventType: "TouchEvent",
|
|
1821
|
+
defaultInit: {
|
|
1822
|
+
bubbles: true,
|
|
1823
|
+
cancelable: true,
|
|
1824
|
+
composed: true
|
|
1825
|
+
}
|
|
1826
|
+
},
|
|
1827
|
+
resize: {
|
|
1828
|
+
EventType: "UIEvent",
|
|
1829
|
+
defaultInit: {
|
|
1830
|
+
bubbles: false,
|
|
1831
|
+
cancelable: false
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
scroll: {
|
|
1835
|
+
EventType: "UIEvent",
|
|
1836
|
+
defaultInit: {
|
|
1837
|
+
bubbles: false,
|
|
1838
|
+
cancelable: false
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
wheel: {
|
|
1842
|
+
EventType: "WheelEvent",
|
|
1843
|
+
defaultInit: {
|
|
1844
|
+
bubbles: true,
|
|
1845
|
+
cancelable: true,
|
|
1846
|
+
composed: true
|
|
1847
|
+
}
|
|
1848
|
+
},
|
|
1849
|
+
abort: {
|
|
1850
|
+
EventType: "Event",
|
|
1851
|
+
defaultInit: {
|
|
1852
|
+
bubbles: false,
|
|
1853
|
+
cancelable: false
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
canPlay: {
|
|
1857
|
+
EventType: "Event",
|
|
1858
|
+
defaultInit: {
|
|
1859
|
+
bubbles: false,
|
|
1860
|
+
cancelable: false
|
|
1861
|
+
}
|
|
1862
|
+
},
|
|
1863
|
+
canPlayThrough: {
|
|
1864
|
+
EventType: "Event",
|
|
1865
|
+
defaultInit: {
|
|
1866
|
+
bubbles: false,
|
|
1867
|
+
cancelable: false
|
|
1868
|
+
}
|
|
1869
|
+
},
|
|
1870
|
+
durationChange: {
|
|
1871
|
+
EventType: "Event",
|
|
1872
|
+
defaultInit: {
|
|
1873
|
+
bubbles: false,
|
|
1874
|
+
cancelable: false
|
|
1875
|
+
}
|
|
1876
|
+
},
|
|
1877
|
+
emptied: {
|
|
1878
|
+
EventType: "Event",
|
|
1879
|
+
defaultInit: {
|
|
1880
|
+
bubbles: false,
|
|
1881
|
+
cancelable: false
|
|
1882
|
+
}
|
|
1883
|
+
},
|
|
1884
|
+
encrypted: {
|
|
1885
|
+
EventType: "Event",
|
|
1886
|
+
defaultInit: {
|
|
1887
|
+
bubbles: false,
|
|
1888
|
+
cancelable: false
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
ended: {
|
|
1892
|
+
EventType: "Event",
|
|
1893
|
+
defaultInit: {
|
|
1894
|
+
bubbles: false,
|
|
1895
|
+
cancelable: false
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
loadedData: {
|
|
1899
|
+
EventType: "Event",
|
|
1900
|
+
defaultInit: {
|
|
1901
|
+
bubbles: false,
|
|
1902
|
+
cancelable: false
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1905
|
+
loadedMetadata: {
|
|
1906
|
+
EventType: "Event",
|
|
1907
|
+
defaultInit: {
|
|
1908
|
+
bubbles: false,
|
|
1909
|
+
cancelable: false
|
|
1910
|
+
}
|
|
1911
|
+
},
|
|
1912
|
+
loadStart: {
|
|
1913
|
+
EventType: "ProgressEvent",
|
|
1914
|
+
defaultInit: {
|
|
1915
|
+
bubbles: false,
|
|
1916
|
+
cancelable: false
|
|
1917
|
+
}
|
|
1918
|
+
},
|
|
1919
|
+
pause: {
|
|
1920
|
+
EventType: "Event",
|
|
1921
|
+
defaultInit: {
|
|
1922
|
+
bubbles: false,
|
|
1923
|
+
cancelable: false
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
play: {
|
|
1927
|
+
EventType: "Event",
|
|
1928
|
+
defaultInit: {
|
|
1929
|
+
bubbles: false,
|
|
1930
|
+
cancelable: false
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
playing: {
|
|
1934
|
+
EventType: "Event",
|
|
1935
|
+
defaultInit: {
|
|
1936
|
+
bubbles: false,
|
|
1937
|
+
cancelable: false
|
|
1938
|
+
}
|
|
1939
|
+
},
|
|
1940
|
+
progress: {
|
|
1941
|
+
EventType: "ProgressEvent",
|
|
1942
|
+
defaultInit: {
|
|
1943
|
+
bubbles: false,
|
|
1944
|
+
cancelable: false
|
|
1945
|
+
}
|
|
1946
|
+
},
|
|
1947
|
+
rateChange: {
|
|
1948
|
+
EventType: "Event",
|
|
1949
|
+
defaultInit: {
|
|
1950
|
+
bubbles: false,
|
|
1951
|
+
cancelable: false
|
|
1952
|
+
}
|
|
1953
|
+
},
|
|
1954
|
+
seeked: {
|
|
1955
|
+
EventType: "Event",
|
|
1956
|
+
defaultInit: {
|
|
1957
|
+
bubbles: false,
|
|
1958
|
+
cancelable: false
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
seeking: {
|
|
1962
|
+
EventType: "Event",
|
|
1963
|
+
defaultInit: {
|
|
1964
|
+
bubbles: false,
|
|
1965
|
+
cancelable: false
|
|
1966
|
+
}
|
|
1967
|
+
},
|
|
1968
|
+
stalled: {
|
|
1969
|
+
EventType: "Event",
|
|
1970
|
+
defaultInit: {
|
|
1971
|
+
bubbles: false,
|
|
1972
|
+
cancelable: false
|
|
1973
|
+
}
|
|
1974
|
+
},
|
|
1975
|
+
suspend: {
|
|
1976
|
+
EventType: "Event",
|
|
1977
|
+
defaultInit: {
|
|
1978
|
+
bubbles: false,
|
|
1979
|
+
cancelable: false
|
|
1980
|
+
}
|
|
1981
|
+
},
|
|
1982
|
+
timeUpdate: {
|
|
1983
|
+
EventType: "Event",
|
|
1984
|
+
defaultInit: {
|
|
1985
|
+
bubbles: false,
|
|
1986
|
+
cancelable: false
|
|
1987
|
+
}
|
|
1988
|
+
},
|
|
1989
|
+
volumeChange: {
|
|
1990
|
+
EventType: "Event",
|
|
1991
|
+
defaultInit: {
|
|
1992
|
+
bubbles: false,
|
|
1993
|
+
cancelable: false
|
|
1994
|
+
}
|
|
1995
|
+
},
|
|
1996
|
+
waiting: {
|
|
1997
|
+
EventType: "Event",
|
|
1998
|
+
defaultInit: {
|
|
1999
|
+
bubbles: false,
|
|
2000
|
+
cancelable: false
|
|
2001
|
+
}
|
|
2002
|
+
},
|
|
2003
|
+
load: {
|
|
2004
|
+
EventType: "Event",
|
|
2005
|
+
defaultInit: {
|
|
2006
|
+
bubbles: false,
|
|
2007
|
+
cancelable: false
|
|
2008
|
+
}
|
|
2009
|
+
},
|
|
2010
|
+
error: {
|
|
2011
|
+
EventType: "Event",
|
|
2012
|
+
defaultInit: {
|
|
2013
|
+
bubbles: false,
|
|
2014
|
+
cancelable: false
|
|
2015
|
+
}
|
|
2016
|
+
},
|
|
2017
|
+
animationStart: {
|
|
2018
|
+
EventType: "AnimationEvent",
|
|
2019
|
+
defaultInit: {
|
|
2020
|
+
bubbles: true,
|
|
2021
|
+
cancelable: false
|
|
2022
|
+
}
|
|
2023
|
+
},
|
|
2024
|
+
animationEnd: {
|
|
2025
|
+
EventType: "AnimationEvent",
|
|
2026
|
+
defaultInit: {
|
|
2027
|
+
bubbles: true,
|
|
2028
|
+
cancelable: false
|
|
2029
|
+
}
|
|
2030
|
+
},
|
|
2031
|
+
animationIteration: {
|
|
2032
|
+
EventType: "AnimationEvent",
|
|
2033
|
+
defaultInit: {
|
|
2034
|
+
bubbles: true,
|
|
2035
|
+
cancelable: false
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
2038
|
+
transitionCancel: {
|
|
2039
|
+
EventType: "TransitionEvent",
|
|
2040
|
+
defaultInit: {
|
|
2041
|
+
bubbles: true,
|
|
2042
|
+
cancelable: false
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
transitionEnd: {
|
|
2046
|
+
EventType: "TransitionEvent",
|
|
2047
|
+
defaultInit: {
|
|
2048
|
+
bubbles: true,
|
|
2049
|
+
cancelable: true
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
transitionRun: {
|
|
2053
|
+
EventType: "TransitionEvent",
|
|
2054
|
+
defaultInit: {
|
|
2055
|
+
bubbles: true,
|
|
2056
|
+
cancelable: false
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2059
|
+
transitionStart: {
|
|
2060
|
+
EventType: "TransitionEvent",
|
|
2061
|
+
defaultInit: {
|
|
2062
|
+
bubbles: true,
|
|
2063
|
+
cancelable: false
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
pointerOver: {
|
|
2067
|
+
EventType: "PointerEvent",
|
|
2068
|
+
defaultInit: {
|
|
2069
|
+
bubbles: true,
|
|
2070
|
+
cancelable: true,
|
|
2071
|
+
composed: true
|
|
2072
|
+
}
|
|
2073
|
+
},
|
|
2074
|
+
pointerEnter: {
|
|
2075
|
+
EventType: "PointerEvent",
|
|
2076
|
+
defaultInit: {
|
|
2077
|
+
bubbles: false,
|
|
2078
|
+
cancelable: false
|
|
2079
|
+
}
|
|
2080
|
+
},
|
|
2081
|
+
pointerDown: {
|
|
2082
|
+
EventType: "PointerEvent",
|
|
2083
|
+
defaultInit: {
|
|
2084
|
+
bubbles: true,
|
|
2085
|
+
cancelable: true,
|
|
2086
|
+
composed: true
|
|
2087
|
+
}
|
|
2088
|
+
},
|
|
2089
|
+
pointerMove: {
|
|
2090
|
+
EventType: "PointerEvent",
|
|
2091
|
+
defaultInit: {
|
|
2092
|
+
bubbles: true,
|
|
2093
|
+
cancelable: true,
|
|
2094
|
+
composed: true
|
|
2095
|
+
}
|
|
2096
|
+
},
|
|
2097
|
+
pointerUp: {
|
|
2098
|
+
EventType: "PointerEvent",
|
|
2099
|
+
defaultInit: {
|
|
2100
|
+
bubbles: true,
|
|
2101
|
+
cancelable: true,
|
|
2102
|
+
composed: true
|
|
2103
|
+
}
|
|
2104
|
+
},
|
|
2105
|
+
pointerCancel: {
|
|
2106
|
+
EventType: "PointerEvent",
|
|
2107
|
+
defaultInit: {
|
|
2108
|
+
bubbles: true,
|
|
2109
|
+
cancelable: false,
|
|
2110
|
+
composed: true
|
|
2111
|
+
}
|
|
2112
|
+
},
|
|
2113
|
+
pointerOut: {
|
|
2114
|
+
EventType: "PointerEvent",
|
|
2115
|
+
defaultInit: {
|
|
2116
|
+
bubbles: true,
|
|
2117
|
+
cancelable: true,
|
|
2118
|
+
composed: true
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
pointerLeave: {
|
|
2122
|
+
EventType: "PointerEvent",
|
|
2123
|
+
defaultInit: {
|
|
2124
|
+
bubbles: false,
|
|
2125
|
+
cancelable: false
|
|
2126
|
+
}
|
|
2127
|
+
},
|
|
2128
|
+
gotPointerCapture: {
|
|
2129
|
+
EventType: "PointerEvent",
|
|
2130
|
+
defaultInit: {
|
|
2131
|
+
bubbles: true,
|
|
2132
|
+
cancelable: false,
|
|
2133
|
+
composed: true
|
|
2134
|
+
}
|
|
2135
|
+
},
|
|
2136
|
+
lostPointerCapture: {
|
|
2137
|
+
EventType: "PointerEvent",
|
|
2138
|
+
defaultInit: {
|
|
2139
|
+
bubbles: true,
|
|
2140
|
+
cancelable: false,
|
|
2141
|
+
composed: true
|
|
2142
|
+
}
|
|
2143
|
+
},
|
|
2144
|
+
popState: {
|
|
2145
|
+
EventType: "PopStateEvent",
|
|
2146
|
+
defaultInit: {
|
|
2147
|
+
bubbles: true,
|
|
2148
|
+
cancelable: false
|
|
2149
|
+
}
|
|
2150
|
+
},
|
|
2151
|
+
offline: {
|
|
2152
|
+
EventType: "Event",
|
|
2153
|
+
defaultInit: {
|
|
2154
|
+
bubbles: false,
|
|
2155
|
+
cancelable: false
|
|
2156
|
+
}
|
|
2157
|
+
},
|
|
2158
|
+
online: {
|
|
2159
|
+
EventType: "Event",
|
|
2160
|
+
defaultInit: {
|
|
2161
|
+
bubbles: false,
|
|
2162
|
+
cancelable: false
|
|
2163
|
+
}
|
|
2164
|
+
},
|
|
2165
|
+
pageHide: {
|
|
2166
|
+
EventType: "PageTransitionEvent",
|
|
2167
|
+
defaultInit: {
|
|
2168
|
+
bubbles: true,
|
|
2169
|
+
cancelable: true
|
|
2170
|
+
}
|
|
2171
|
+
},
|
|
2172
|
+
pageShow: {
|
|
2173
|
+
EventType: "PageTransitionEvent",
|
|
2174
|
+
defaultInit: {
|
|
2175
|
+
bubbles: true,
|
|
2176
|
+
cancelable: true
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
};
|
|
2180
|
+
const eventAliasMap = { doubleClick: "dblClick" };
|
|
2181
|
+
|
|
2182
|
+
// src/events.ts
|
|
2183
|
+
function fireEvent_(element, event) {
|
|
2184
|
+
if (tracing() && event && element) return traceSync("testing-library.fire_event", `fireEvent.${event.type}(${describeNode(element)})`, () => fireEventUntraced(element, event));
|
|
2185
|
+
return fireEventUntraced(element, event);
|
|
2186
|
+
}
|
|
2187
|
+
function fireEventUntraced(element, event) {
|
|
2188
|
+
return getConfig().eventWrapper(() => {
|
|
2189
|
+
if (!event) throw new Error(`Unable to fire an event - please provide an event object.`);
|
|
2190
|
+
if (!element) throw new Error(`Unable to fire a "${event.type}" event - please provide a DOM element.`);
|
|
2191
|
+
return element.dispatchEvent(event);
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
function createEvent_(eventName, node, init, { EventType = "Event", defaultInit = {} } = {}) {
|
|
2195
|
+
if (!node) throw new Error(`Unable to fire a "${eventName}" event - please provide a DOM element.`);
|
|
2196
|
+
const eventInit = {
|
|
2197
|
+
...defaultInit,
|
|
2198
|
+
...init
|
|
2199
|
+
};
|
|
2200
|
+
const { target: { value, files, ...targetProperties } = {} } = eventInit;
|
|
2201
|
+
if (value !== void 0) setNativeValue(node, value);
|
|
2202
|
+
if (files !== void 0) Object.defineProperty(node, "files", {
|
|
2203
|
+
configurable: true,
|
|
2204
|
+
enumerable: true,
|
|
2205
|
+
writable: true,
|
|
2206
|
+
value: files
|
|
2207
|
+
});
|
|
2208
|
+
Object.assign(node, targetProperties);
|
|
2209
|
+
const window = getWindowFromNode(node);
|
|
2210
|
+
const EventConstructor = window[EventType] || window.Event;
|
|
2211
|
+
let event;
|
|
2212
|
+
if (typeof EventConstructor === "function") event = new EventConstructor(eventName, eventInit);
|
|
2213
|
+
else {
|
|
2214
|
+
event = window.document.createEvent(EventType);
|
|
2215
|
+
const { bubbles, cancelable, detail, ...otherInit } = eventInit;
|
|
2216
|
+
event.initEvent(eventName, bubbles, cancelable, detail);
|
|
2217
|
+
Object.keys(otherInit).forEach((eventKey) => {
|
|
2218
|
+
event[eventKey] = otherInit[eventKey];
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
["dataTransfer", "clipboardData"].forEach((dataTransferKey) => {
|
|
2222
|
+
const dataTransferValue = eventInit[dataTransferKey];
|
|
2223
|
+
if (typeof dataTransferValue === "object") {
|
|
2224
|
+
if (typeof window.DataTransfer === "function") Object.defineProperty(event, dataTransferKey, { value: Object.getOwnPropertyNames(dataTransferValue).reduce((acc, propName) => {
|
|
2225
|
+
Object.defineProperty(acc, propName, { value: dataTransferValue[propName] });
|
|
2226
|
+
return acc;
|
|
2227
|
+
}, new window.DataTransfer()) });
|
|
2228
|
+
else Object.defineProperty(event, dataTransferKey, { value: dataTransferValue });
|
|
2229
|
+
}
|
|
2230
|
+
});
|
|
2231
|
+
return event;
|
|
2232
|
+
}
|
|
2233
|
+
function setNativeValue(element, value) {
|
|
2234
|
+
const { set: valueSetter } = Object.getOwnPropertyDescriptor(element, "value") || {};
|
|
2235
|
+
const prototype = Object.getPrototypeOf(element);
|
|
2236
|
+
const { set: prototypeValueSetter } = Object.getOwnPropertyDescriptor(prototype, "value") || {};
|
|
2237
|
+
if (prototypeValueSetter && valueSetter !== prototypeValueSetter) prototypeValueSetter.call(element, value);
|
|
2238
|
+
else if (valueSetter) valueSetter.call(element, value);
|
|
2239
|
+
else throw new Error("The given element does not have a value setter");
|
|
2240
|
+
}
|
|
2241
|
+
Object.defineProperty(fireEvent_, "name", { value: "fireEvent" });
|
|
2242
|
+
Object.defineProperty(createEvent_, "name", { value: "createEvent" });
|
|
2243
|
+
const fireEvent = fireEvent_;
|
|
2244
|
+
const createEvent = createEvent_;
|
|
2245
|
+
Object.keys(eventMap).forEach((key) => {
|
|
2246
|
+
const { EventType, defaultInit } = eventMap[key];
|
|
2247
|
+
const eventName = key.toLowerCase();
|
|
2248
|
+
createEvent[key] = (node, init) => createEvent(eventName, node, init, {
|
|
2249
|
+
EventType,
|
|
2250
|
+
defaultInit
|
|
2251
|
+
});
|
|
2252
|
+
fireEvent[key] = (node, init) => fireEvent(node, createEvent[key](node, init));
|
|
2253
|
+
});
|
|
2254
|
+
Object.keys(eventAliasMap).forEach((aliasKey) => {
|
|
2255
|
+
const key = eventAliasMap[aliasKey];
|
|
2256
|
+
fireEvent[aliasKey] = (...args) => fireEvent[key](...args);
|
|
2257
|
+
});
|
|
2258
|
+
|
|
2259
|
+
// src/lz-string.ts
|
|
2260
|
+
const keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
2261
|
+
var BitWriter = class {
|
|
2262
|
+
out = [];
|
|
2263
|
+
val = 0;
|
|
2264
|
+
pos = 0;
|
|
2265
|
+
/** Write the low `n` bits of `value`, least significant bit first. */
|
|
2266
|
+
write(value, n) {
|
|
2267
|
+
for (let i = 0; i < n; i++) {
|
|
2268
|
+
this.val = this.val << 1 | value & 1;
|
|
2269
|
+
if (this.pos === 5) {
|
|
2270
|
+
this.pos = 0;
|
|
2271
|
+
this.out.push(keyStrUriSafe.charAt(this.val));
|
|
2272
|
+
this.val = 0;
|
|
2273
|
+
} else this.pos++;
|
|
2274
|
+
value >>= 1;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
flush() {
|
|
2278
|
+
for (;;) {
|
|
2279
|
+
this.val <<= 1;
|
|
2280
|
+
if (this.pos === 5) {
|
|
2281
|
+
this.out.push(keyStrUriSafe.charAt(this.val));
|
|
2282
|
+
break;
|
|
2283
|
+
}
|
|
2284
|
+
this.pos++;
|
|
2285
|
+
}
|
|
2286
|
+
return this.out.join("");
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
function compressToEncodedURIComponent(uncompressed) {
|
|
2290
|
+
if (uncompressed == null) return "";
|
|
2291
|
+
const dictionary = /* @__PURE__ */ new Map();
|
|
2292
|
+
const toCreate = /* @__PURE__ */ new Set();
|
|
2293
|
+
const w8 = new BitWriter();
|
|
2294
|
+
let w = "";
|
|
2295
|
+
let enlargeIn = 2;
|
|
2296
|
+
let dictSize = 3;
|
|
2297
|
+
let numBits = 2;
|
|
2298
|
+
const emit = (word) => {
|
|
2299
|
+
if (toCreate.has(word)) {
|
|
2300
|
+
const code = word.charCodeAt(0);
|
|
2301
|
+
if (code < 256) {
|
|
2302
|
+
w8.write(0, numBits);
|
|
2303
|
+
w8.write(code, 8);
|
|
2304
|
+
} else {
|
|
2305
|
+
w8.write(1, numBits);
|
|
2306
|
+
w8.write(code, 16);
|
|
2307
|
+
}
|
|
2308
|
+
enlargeIn--;
|
|
2309
|
+
if (enlargeIn === 0) {
|
|
2310
|
+
enlargeIn = Math.pow(2, numBits);
|
|
2311
|
+
numBits++;
|
|
2312
|
+
}
|
|
2313
|
+
toCreate.delete(word);
|
|
2314
|
+
} else w8.write(dictionary.get(word), numBits);
|
|
2315
|
+
enlargeIn--;
|
|
2316
|
+
if (enlargeIn === 0) {
|
|
2317
|
+
enlargeIn = Math.pow(2, numBits);
|
|
2318
|
+
numBits++;
|
|
2319
|
+
}
|
|
2320
|
+
};
|
|
2321
|
+
for (let ii = 0; ii < uncompressed.length; ii++) {
|
|
2322
|
+
const c = uncompressed.charAt(ii);
|
|
2323
|
+
if (!dictionary.has(c)) {
|
|
2324
|
+
dictionary.set(c, dictSize++);
|
|
2325
|
+
toCreate.add(c);
|
|
2326
|
+
}
|
|
2327
|
+
const wc = w + c;
|
|
2328
|
+
if (dictionary.has(wc)) w = wc;
|
|
2329
|
+
else {
|
|
2330
|
+
emit(w);
|
|
2331
|
+
dictionary.set(wc, dictSize++);
|
|
2332
|
+
w = c;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
if (w !== "") emit(w);
|
|
2336
|
+
w8.write(2, numBits);
|
|
2337
|
+
return w8.flush();
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
// src/screen.ts
|
|
2341
|
+
function unindent(string) {
|
|
2342
|
+
return string.replace(/[ \t]*[\n][ \t]*/g, "\n");
|
|
2343
|
+
}
|
|
2344
|
+
function encode(value) {
|
|
2345
|
+
return compressToEncodedURIComponent(unindent(value));
|
|
2346
|
+
}
|
|
2347
|
+
function getPlaygroundUrl(markup) {
|
|
2348
|
+
return `https://testing-playground.com/#markup=${encode(markup)}`;
|
|
2349
|
+
}
|
|
2350
|
+
const debug = (element, maxLength, options) => Array.isArray(element) ? element.forEach((el) => logDOM(el, maxLength, options)) : logDOM(element, maxLength, options);
|
|
2351
|
+
const logTestingPlaygroundURL = (element = getDocument().body) => {
|
|
2352
|
+
if (!element || !("innerHTML" in element)) {
|
|
2353
|
+
console.log(`The element you're providing isn't a valid DOM element.`);
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
if (!element.innerHTML) {
|
|
2357
|
+
console.log(`The provided element doesn't have any children.`);
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
const playgroundUrl = getPlaygroundUrl(element.innerHTML);
|
|
2361
|
+
console.log(`Open this URL in your browser\n\n${playgroundUrl}`);
|
|
2362
|
+
return playgroundUrl;
|
|
2363
|
+
};
|
|
2364
|
+
const initialValue = {
|
|
2365
|
+
debug,
|
|
2366
|
+
logTestingPlaygroundURL,
|
|
2367
|
+
ariaSnapshot
|
|
2368
|
+
};
|
|
2369
|
+
const screen = typeof document !== "undefined" && document.body ? getQueriesForElement(document.body, queries, initialValue) : Object.keys(queries).reduce((helpers, key) => {
|
|
2370
|
+
helpers[key] = () => {
|
|
2371
|
+
throw new TypeError("For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error");
|
|
2372
|
+
};
|
|
2373
|
+
return helpers;
|
|
2374
|
+
}, initialValue);
|
|
2375
|
+
|
|
2376
|
+
// src/index.ts
|
|
2377
|
+
const queryHelpers = {
|
|
2378
|
+
getElementError,
|
|
2379
|
+
wrapAllByQueryWithSuggestion,
|
|
2380
|
+
wrapSingleQueryWithSuggestion,
|
|
2381
|
+
getMultipleElementsFoundError,
|
|
2382
|
+
queryAllByAttribute,
|
|
2383
|
+
queryByAttribute,
|
|
2384
|
+
makeSingleQuery,
|
|
2385
|
+
makeGetAllQuery,
|
|
2386
|
+
makeFindQuery,
|
|
2387
|
+
buildQueries
|
|
2388
|
+
};
|
|
2389
|
+
|
|
2390
|
+
export { ariaSnapshot, buildQueries, configure, createEvent, diffAriaSnapshots, findAllByAltText, findAllByDisplayValue, findAllByLabelText, findAllByPlaceholderText, findAllByRole, findAllByTestId, findAllByText, findAllByTitle, findByAltText, findByDisplayValue, findByLabelText, findByPlaceholderText, findByRole, findByTestId, findByText, findByTitle, fireEvent, getAllByAltText, getAllByDisplayValue, getAllByLabelTextWithSuggestions as getAllByLabelText, getAllByPlaceholderText, getAllByRole, getAllByTestId, getAllByText, getAllByTitle, getByAltText, getByDisplayValue, getByLabelTextWithSuggestions as getByLabelText, getByPlaceholderText, getByRole, getByTestId, getByText, getByTitle, getConfig, getDefaultNormalizer, getElementError, getMultipleElementsFoundError, getNodeText, getQueriesForElement, getQueriesForElement as within, getRoles, getSuggestedQuery, isInaccessible, logDOM, logRoles, makeFindQuery, makeGetAllQuery, makeSingleQuery, prettyDOM, prettyFormat, queries, queryAllByAltTextWithSuggestions as queryAllByAltText, queryAllByAttribute, queryAllByDisplayValueWithSuggestions as queryAllByDisplayValue, queryAllByLabelTextWithSuggestions as queryAllByLabelText, queryAllByPlaceholderTextWithSuggestions as queryAllByPlaceholderText, queryAllByRoleWithSuggestions as queryAllByRole, queryAllByTestIdWithSuggestions as queryAllByTestId, queryAllByTextWithSuggestions as queryAllByText, queryAllByTitleWithSuggestions as queryAllByTitle, queryByAltText, queryByAttribute, queryByDisplayValue, queryByLabelText, queryByPlaceholderText, queryByRole, queryByTestId, queryByText, queryByTitle, queryHelpers, screen, waitFor, waitForElementToBeRemoved, wrapAllByQueryWithSuggestion, wrapSingleQueryWithSuggestion };
|