@ctrl/dom 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-Hv_BAHIV.js +47537 -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 +163 -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 +3923 -0
- package/dist/user-event/index.js +3898 -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 +55 -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 +178 -4
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import {ByRoleMatcher, Matcher, MatcherOptions} from './matches.js'
|
|
2
|
+
import {SelectorMatcherOptions} from './query-helpers.js'
|
|
3
|
+
import {waitForOptions} from './wait-for.js'
|
|
4
|
+
|
|
5
|
+
export type QueryByBoundAttribute<T extends HTMLElement = HTMLElement> = (
|
|
6
|
+
container: HTMLElement,
|
|
7
|
+
id: Matcher,
|
|
8
|
+
options?: MatcherOptions,
|
|
9
|
+
) => T | null
|
|
10
|
+
|
|
11
|
+
export type AllByBoundAttribute<T extends HTMLElement = HTMLElement> = (
|
|
12
|
+
container: HTMLElement,
|
|
13
|
+
id: Matcher,
|
|
14
|
+
options?: MatcherOptions,
|
|
15
|
+
) => T[]
|
|
16
|
+
|
|
17
|
+
export type FindAllByBoundAttribute<T extends HTMLElement = HTMLElement> = (
|
|
18
|
+
container: HTMLElement,
|
|
19
|
+
id: Matcher,
|
|
20
|
+
options?: MatcherOptions,
|
|
21
|
+
waitForElementOptions?: waitForOptions,
|
|
22
|
+
) => Promise<T[]>
|
|
23
|
+
|
|
24
|
+
export type GetByBoundAttribute<T extends HTMLElement = HTMLElement> = (
|
|
25
|
+
container: HTMLElement,
|
|
26
|
+
id: Matcher,
|
|
27
|
+
options?: MatcherOptions,
|
|
28
|
+
) => T
|
|
29
|
+
|
|
30
|
+
export type FindByBoundAttribute<T extends HTMLElement = HTMLElement> = (
|
|
31
|
+
container: HTMLElement,
|
|
32
|
+
id: Matcher,
|
|
33
|
+
options?: MatcherOptions,
|
|
34
|
+
waitForElementOptions?: waitForOptions,
|
|
35
|
+
) => Promise<T>
|
|
36
|
+
|
|
37
|
+
export type QueryByText<T extends HTMLElement = HTMLElement> = (
|
|
38
|
+
container: HTMLElement,
|
|
39
|
+
id: Matcher,
|
|
40
|
+
options?: SelectorMatcherOptions,
|
|
41
|
+
) => T | null
|
|
42
|
+
|
|
43
|
+
export type AllByText<T extends HTMLElement = HTMLElement> = (
|
|
44
|
+
container: HTMLElement,
|
|
45
|
+
id: Matcher,
|
|
46
|
+
options?: SelectorMatcherOptions,
|
|
47
|
+
) => T[]
|
|
48
|
+
|
|
49
|
+
export type FindAllByText<T extends HTMLElement = HTMLElement> = (
|
|
50
|
+
container: HTMLElement,
|
|
51
|
+
id: Matcher,
|
|
52
|
+
options?: SelectorMatcherOptions,
|
|
53
|
+
waitForElementOptions?: waitForOptions,
|
|
54
|
+
) => Promise<T[]>
|
|
55
|
+
|
|
56
|
+
export type GetByText<T extends HTMLElement = HTMLElement> = (
|
|
57
|
+
container: HTMLElement,
|
|
58
|
+
id: Matcher,
|
|
59
|
+
options?: SelectorMatcherOptions,
|
|
60
|
+
) => T
|
|
61
|
+
|
|
62
|
+
export type FindByText<T extends HTMLElement = HTMLElement> = (
|
|
63
|
+
container: HTMLElement,
|
|
64
|
+
id: Matcher,
|
|
65
|
+
options?: SelectorMatcherOptions,
|
|
66
|
+
waitForElementOptions?: waitForOptions,
|
|
67
|
+
) => Promise<T>
|
|
68
|
+
|
|
69
|
+
export interface ByRoleOptions {
|
|
70
|
+
/** suppress suggestions for a specific query */
|
|
71
|
+
suggest?: boolean
|
|
72
|
+
/**
|
|
73
|
+
* If true includes elements in the query set that are usually excluded from
|
|
74
|
+
* the accessibility tree. `role="none"` or `role="presentation"` are included
|
|
75
|
+
* in either case.
|
|
76
|
+
*/
|
|
77
|
+
hidden?: boolean
|
|
78
|
+
/**
|
|
79
|
+
* If true only includes elements in the query set that are marked as
|
|
80
|
+
* selected in the accessibility tree, i.e., `aria-selected="true"`
|
|
81
|
+
*/
|
|
82
|
+
selected?: boolean
|
|
83
|
+
/**
|
|
84
|
+
* If true only includes elements in the query set that are marked as
|
|
85
|
+
* busy in the accessibility tree, i.e., `aria-busy="true"`
|
|
86
|
+
*/
|
|
87
|
+
busy?: boolean
|
|
88
|
+
/**
|
|
89
|
+
* If true only includes elements in the query set that are marked as
|
|
90
|
+
* checked in the accessibility tree, i.e., `aria-checked="true"`
|
|
91
|
+
*/
|
|
92
|
+
checked?: boolean
|
|
93
|
+
/**
|
|
94
|
+
* If true only includes elements in the query set that are marked as
|
|
95
|
+
* pressed in the accessibility tree, i.e., `aria-pressed="true"`
|
|
96
|
+
*/
|
|
97
|
+
pressed?: boolean
|
|
98
|
+
/**
|
|
99
|
+
* Filters elements by their `aria-current` state. `true` and `false` match `aria-current="true"` and `aria-current="false"` (as well as a missing `aria-current` attribute) respectively.
|
|
100
|
+
*/
|
|
101
|
+
current?: boolean | string
|
|
102
|
+
/**
|
|
103
|
+
* If true only includes elements in the query set that are marked as
|
|
104
|
+
* expanded in the accessibility tree, i.e., `aria-expanded="true"`
|
|
105
|
+
*/
|
|
106
|
+
expanded?: boolean
|
|
107
|
+
/**
|
|
108
|
+
* Includes elements with the `"heading"` role matching the indicated level,
|
|
109
|
+
* either by the semantic HTML heading elements `<h1>-<h6>` or matching
|
|
110
|
+
* the `aria-level` attribute.
|
|
111
|
+
*/
|
|
112
|
+
level?: number
|
|
113
|
+
value?: {
|
|
114
|
+
now?: number
|
|
115
|
+
min?: number
|
|
116
|
+
max?: number
|
|
117
|
+
text?: Matcher
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Includes every role used in the `role` attribute
|
|
121
|
+
* For example *ByRole('progressbar', {queryFallbacks: true})` will find <div role="meter progressbar">`.
|
|
122
|
+
*/
|
|
123
|
+
queryFallbacks?: boolean
|
|
124
|
+
/**
|
|
125
|
+
* Only considers elements with the specified accessible name.
|
|
126
|
+
*/
|
|
127
|
+
name?:
|
|
128
|
+
| RegExp
|
|
129
|
+
| string
|
|
130
|
+
| ((accessibleName: string, element: Element) => boolean)
|
|
131
|
+
/**
|
|
132
|
+
* Only considers elements with the specified accessible description.
|
|
133
|
+
*/
|
|
134
|
+
description?:
|
|
135
|
+
| RegExp
|
|
136
|
+
| string
|
|
137
|
+
| ((accessibleDescription: string, element: Element) => boolean)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type AllByRole<T extends HTMLElement = HTMLElement> = (
|
|
141
|
+
container: HTMLElement,
|
|
142
|
+
role: ByRoleMatcher,
|
|
143
|
+
options?: ByRoleOptions,
|
|
144
|
+
) => T[]
|
|
145
|
+
|
|
146
|
+
export type GetByRole<T extends HTMLElement = HTMLElement> = (
|
|
147
|
+
container: HTMLElement,
|
|
148
|
+
role: ByRoleMatcher,
|
|
149
|
+
options?: ByRoleOptions,
|
|
150
|
+
) => T
|
|
151
|
+
|
|
152
|
+
export type QueryByRole<T extends HTMLElement = HTMLElement> = (
|
|
153
|
+
container: HTMLElement,
|
|
154
|
+
role: ByRoleMatcher,
|
|
155
|
+
options?: ByRoleOptions,
|
|
156
|
+
) => T | null
|
|
157
|
+
|
|
158
|
+
export type FindByRole<T extends HTMLElement = HTMLElement> = (
|
|
159
|
+
container: HTMLElement,
|
|
160
|
+
role: ByRoleMatcher,
|
|
161
|
+
options?: ByRoleOptions,
|
|
162
|
+
waitForElementOptions?: waitForOptions,
|
|
163
|
+
) => Promise<T>
|
|
164
|
+
|
|
165
|
+
export type FindAllByRole<T extends HTMLElement = HTMLElement> = (
|
|
166
|
+
container: HTMLElement,
|
|
167
|
+
role: ByRoleMatcher,
|
|
168
|
+
options?: ByRoleOptions,
|
|
169
|
+
waitForElementOptions?: waitForOptions,
|
|
170
|
+
) => Promise<T[]>
|
|
171
|
+
|
|
172
|
+
export function getByLabelText<T extends HTMLElement = HTMLElement>(
|
|
173
|
+
...args: Parameters<GetByText<T>>
|
|
174
|
+
): ReturnType<GetByText<T>>
|
|
175
|
+
export function getAllByLabelText<T extends HTMLElement = HTMLElement>(
|
|
176
|
+
...args: Parameters<AllByText<T>>
|
|
177
|
+
): ReturnType<AllByText<T>>
|
|
178
|
+
export function queryByLabelText<T extends HTMLElement = HTMLElement>(
|
|
179
|
+
...args: Parameters<QueryByText<T>>
|
|
180
|
+
): ReturnType<QueryByText<T>>
|
|
181
|
+
export function queryAllByLabelText<T extends HTMLElement = HTMLElement>(
|
|
182
|
+
...args: Parameters<AllByText<T>>
|
|
183
|
+
): ReturnType<AllByText<T>>
|
|
184
|
+
export function findByLabelText<T extends HTMLElement = HTMLElement>(
|
|
185
|
+
...args: Parameters<FindByText<T>>
|
|
186
|
+
): ReturnType<FindByText<T>>
|
|
187
|
+
export function findAllByLabelText<T extends HTMLElement = HTMLElement>(
|
|
188
|
+
...args: Parameters<FindAllByText<T>>
|
|
189
|
+
): ReturnType<FindAllByText<T>>
|
|
190
|
+
export function getByPlaceholderText<T extends HTMLElement = HTMLElement>(
|
|
191
|
+
...args: Parameters<GetByBoundAttribute<T>>
|
|
192
|
+
): ReturnType<GetByBoundAttribute<T>>
|
|
193
|
+
export function getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
|
|
194
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
195
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
196
|
+
export function queryByPlaceholderText<T extends HTMLElement = HTMLElement>(
|
|
197
|
+
...args: Parameters<QueryByBoundAttribute<T>>
|
|
198
|
+
): ReturnType<QueryByBoundAttribute<T>>
|
|
199
|
+
export function queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
|
|
200
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
201
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
202
|
+
export function findByPlaceholderText<T extends HTMLElement = HTMLElement>(
|
|
203
|
+
...args: Parameters<FindByBoundAttribute<T>>
|
|
204
|
+
): ReturnType<FindByBoundAttribute<T>>
|
|
205
|
+
export function findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
|
|
206
|
+
...args: Parameters<FindAllByBoundAttribute<T>>
|
|
207
|
+
): ReturnType<FindAllByBoundAttribute<T>>
|
|
208
|
+
export function getByText<T extends HTMLElement = HTMLElement>(
|
|
209
|
+
...args: Parameters<GetByText<T>>
|
|
210
|
+
): ReturnType<GetByText<T>>
|
|
211
|
+
export function getAllByText<T extends HTMLElement = HTMLElement>(
|
|
212
|
+
...args: Parameters<AllByText<T>>
|
|
213
|
+
): ReturnType<AllByText<T>>
|
|
214
|
+
export function queryByText<T extends HTMLElement = HTMLElement>(
|
|
215
|
+
...args: Parameters<QueryByText<T>>
|
|
216
|
+
): ReturnType<QueryByText<T>>
|
|
217
|
+
export function queryAllByText<T extends HTMLElement = HTMLElement>(
|
|
218
|
+
...args: Parameters<AllByText<T>>
|
|
219
|
+
): ReturnType<AllByText<T>>
|
|
220
|
+
export function findByText<T extends HTMLElement = HTMLElement>(
|
|
221
|
+
...args: Parameters<FindByText<T>>
|
|
222
|
+
): ReturnType<FindByText<T>>
|
|
223
|
+
export function findAllByText<T extends HTMLElement = HTMLElement>(
|
|
224
|
+
...args: Parameters<FindAllByText<T>>
|
|
225
|
+
): ReturnType<FindAllByText<T>>
|
|
226
|
+
export function getByAltText<T extends HTMLElement = HTMLElement>(
|
|
227
|
+
...args: Parameters<GetByBoundAttribute<T>>
|
|
228
|
+
): ReturnType<GetByBoundAttribute<T>>
|
|
229
|
+
export function getAllByAltText<T extends HTMLElement = HTMLElement>(
|
|
230
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
231
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
232
|
+
export function queryByAltText<T extends HTMLElement = HTMLElement>(
|
|
233
|
+
...args: Parameters<QueryByBoundAttribute<T>>
|
|
234
|
+
): ReturnType<QueryByBoundAttribute<T>>
|
|
235
|
+
export function queryAllByAltText<T extends HTMLElement = HTMLElement>(
|
|
236
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
237
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
238
|
+
export function findByAltText<T extends HTMLElement = HTMLElement>(
|
|
239
|
+
...args: Parameters<FindByBoundAttribute<T>>
|
|
240
|
+
): ReturnType<FindByBoundAttribute<T>>
|
|
241
|
+
export function findAllByAltText<T extends HTMLElement = HTMLElement>(
|
|
242
|
+
...args: Parameters<FindAllByBoundAttribute<T>>
|
|
243
|
+
): ReturnType<FindAllByBoundAttribute<T>>
|
|
244
|
+
export function getByTitle<T extends HTMLElement = HTMLElement>(
|
|
245
|
+
...args: Parameters<GetByBoundAttribute<T>>
|
|
246
|
+
): ReturnType<GetByBoundAttribute<T>>
|
|
247
|
+
export function getAllByTitle<T extends HTMLElement = HTMLElement>(
|
|
248
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
249
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
250
|
+
export function queryByTitle<T extends HTMLElement = HTMLElement>(
|
|
251
|
+
...args: Parameters<QueryByBoundAttribute<T>>
|
|
252
|
+
): ReturnType<QueryByBoundAttribute<T>>
|
|
253
|
+
export function queryAllByTitle<T extends HTMLElement = HTMLElement>(
|
|
254
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
255
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
256
|
+
export function findByTitle<T extends HTMLElement = HTMLElement>(
|
|
257
|
+
...args: Parameters<FindByBoundAttribute<T>>
|
|
258
|
+
): ReturnType<FindByBoundAttribute<T>>
|
|
259
|
+
export function findAllByTitle<T extends HTMLElement = HTMLElement>(
|
|
260
|
+
...args: Parameters<FindAllByBoundAttribute<T>>
|
|
261
|
+
): ReturnType<FindAllByBoundAttribute<T>>
|
|
262
|
+
export function getByDisplayValue<T extends HTMLElement = HTMLElement>(
|
|
263
|
+
...args: Parameters<GetByBoundAttribute<T>>
|
|
264
|
+
): ReturnType<GetByBoundAttribute<T>>
|
|
265
|
+
export function getAllByDisplayValue<T extends HTMLElement = HTMLElement>(
|
|
266
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
267
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
268
|
+
export function queryByDisplayValue<T extends HTMLElement = HTMLElement>(
|
|
269
|
+
...args: Parameters<QueryByBoundAttribute<T>>
|
|
270
|
+
): ReturnType<QueryByBoundAttribute<T>>
|
|
271
|
+
export function queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(
|
|
272
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
273
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
274
|
+
export function findByDisplayValue<T extends HTMLElement = HTMLElement>(
|
|
275
|
+
...args: Parameters<FindByBoundAttribute<T>>
|
|
276
|
+
): ReturnType<FindByBoundAttribute<T>>
|
|
277
|
+
export function findAllByDisplayValue<T extends HTMLElement = HTMLElement>(
|
|
278
|
+
...args: Parameters<FindAllByBoundAttribute<T>>
|
|
279
|
+
): ReturnType<FindAllByBoundAttribute<T>>
|
|
280
|
+
export function getByRole<T extends HTMLElement = HTMLElement>(
|
|
281
|
+
...args: Parameters<GetByRole<T>>
|
|
282
|
+
): ReturnType<GetByRole<T>>
|
|
283
|
+
export function getAllByRole<T extends HTMLElement = HTMLElement>(
|
|
284
|
+
...args: Parameters<AllByRole<T>>
|
|
285
|
+
): ReturnType<AllByRole<T>>
|
|
286
|
+
export function queryByRole<T extends HTMLElement = HTMLElement>(
|
|
287
|
+
...args: Parameters<QueryByRole<T>>
|
|
288
|
+
): ReturnType<QueryByRole<T>>
|
|
289
|
+
export function queryAllByRole<T extends HTMLElement = HTMLElement>(
|
|
290
|
+
...args: Parameters<AllByRole<T>>
|
|
291
|
+
): ReturnType<AllByRole<T>>
|
|
292
|
+
export function findByRole<T extends HTMLElement = HTMLElement>(
|
|
293
|
+
...args: Parameters<FindByRole<T>>
|
|
294
|
+
): ReturnType<FindByRole<T>>
|
|
295
|
+
export function findAllByRole<T extends HTMLElement = HTMLElement>(
|
|
296
|
+
...args: Parameters<FindAllByRole<T>>
|
|
297
|
+
): ReturnType<FindAllByRole<T>>
|
|
298
|
+
export function getByTestId<T extends HTMLElement = HTMLElement>(
|
|
299
|
+
...args: Parameters<GetByBoundAttribute<T>>
|
|
300
|
+
): ReturnType<GetByBoundAttribute<T>>
|
|
301
|
+
export function getAllByTestId<T extends HTMLElement = HTMLElement>(
|
|
302
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
303
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
304
|
+
export function queryByTestId<T extends HTMLElement = HTMLElement>(
|
|
305
|
+
...args: Parameters<QueryByBoundAttribute<T>>
|
|
306
|
+
): ReturnType<QueryByBoundAttribute<T>>
|
|
307
|
+
export function queryAllByTestId<T extends HTMLElement = HTMLElement>(
|
|
308
|
+
...args: Parameters<AllByBoundAttribute<T>>
|
|
309
|
+
): ReturnType<AllByBoundAttribute<T>>
|
|
310
|
+
export function findByTestId<T extends HTMLElement = HTMLElement>(
|
|
311
|
+
...args: Parameters<FindByBoundAttribute<T>>
|
|
312
|
+
): ReturnType<FindByBoundAttribute<T>>
|
|
313
|
+
export function findAllByTestId<T extends HTMLElement = HTMLElement>(
|
|
314
|
+
...args: Parameters<FindAllByBoundAttribute<T>>
|
|
315
|
+
): ReturnType<FindAllByBoundAttribute<T>>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {Matcher, MatcherOptions} from './matches.js'
|
|
2
|
+
import {waitForOptions} from './wait-for.js'
|
|
3
|
+
import {Variant} from './suggestions.js'
|
|
4
|
+
|
|
5
|
+
export type WithSuggest = {suggest?: boolean}
|
|
6
|
+
|
|
7
|
+
export type GetErrorFunction<Arguments extends any[] = [string]> = (
|
|
8
|
+
c: Element | null,
|
|
9
|
+
...args: Arguments
|
|
10
|
+
) => string
|
|
11
|
+
|
|
12
|
+
export interface SelectorMatcherOptions extends MatcherOptions {
|
|
13
|
+
selector?: string
|
|
14
|
+
ignore?: boolean | string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type QueryByAttribute = (
|
|
18
|
+
attribute: string,
|
|
19
|
+
container: HTMLElement,
|
|
20
|
+
id: Matcher,
|
|
21
|
+
options?: MatcherOptions,
|
|
22
|
+
) => HTMLElement | null
|
|
23
|
+
|
|
24
|
+
export type AllByAttribute = (
|
|
25
|
+
attribute: string,
|
|
26
|
+
container: HTMLElement,
|
|
27
|
+
id: Matcher,
|
|
28
|
+
options?: MatcherOptions,
|
|
29
|
+
) => HTMLElement[]
|
|
30
|
+
|
|
31
|
+
export const queryByAttribute: QueryByAttribute
|
|
32
|
+
export const queryAllByAttribute: AllByAttribute
|
|
33
|
+
export function getElementError(
|
|
34
|
+
message: string | null,
|
|
35
|
+
container: HTMLElement,
|
|
36
|
+
): Error
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* query methods have a common call signature. Only the return type differs.
|
|
40
|
+
*/
|
|
41
|
+
export type QueryMethod<Arguments extends any[], Return> = (
|
|
42
|
+
container: HTMLElement,
|
|
43
|
+
...args: Arguments
|
|
44
|
+
) => Return
|
|
45
|
+
export type QueryBy<Arguments extends any[]> = QueryMethod<
|
|
46
|
+
Arguments,
|
|
47
|
+
HTMLElement | null
|
|
48
|
+
>
|
|
49
|
+
export type GetAllBy<Arguments extends any[]> = QueryMethod<
|
|
50
|
+
Arguments,
|
|
51
|
+
HTMLElement[]
|
|
52
|
+
>
|
|
53
|
+
export type FindAllBy<Arguments extends any[]> = QueryMethod<
|
|
54
|
+
[Arguments[0], Arguments[1]?, waitForOptions?],
|
|
55
|
+
Promise<HTMLElement[]>
|
|
56
|
+
>
|
|
57
|
+
export type GetBy<Arguments extends any[]> = QueryMethod<Arguments, HTMLElement>
|
|
58
|
+
export type FindBy<Arguments extends any[]> = QueryMethod<
|
|
59
|
+
[Arguments[0], Arguments[1]?, waitForOptions?],
|
|
60
|
+
Promise<HTMLElement>
|
|
61
|
+
>
|
|
62
|
+
|
|
63
|
+
export type BuiltQueryMethods<Arguments extends any[]> = [
|
|
64
|
+
QueryBy<Arguments>,
|
|
65
|
+
GetAllBy<Arguments>,
|
|
66
|
+
GetBy<Arguments>,
|
|
67
|
+
FindAllBy<Arguments>,
|
|
68
|
+
FindBy<Arguments>,
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
export function buildQueries<Arguments extends any[]>(
|
|
72
|
+
queryAllBy: GetAllBy<Arguments>,
|
|
73
|
+
getMultipleError: GetErrorFunction<Arguments>,
|
|
74
|
+
getMissingError: GetErrorFunction<Arguments>,
|
|
75
|
+
): BuiltQueryMethods<Arguments>
|
|
76
|
+
|
|
77
|
+
// Divergence (additions): exported at runtime by @testing-library/dom@10.4.2 (src/query-helpers.ts)
|
|
78
|
+
// but missing from its published typings.
|
|
79
|
+
export function getMultipleElementsFoundError(
|
|
80
|
+
message: string,
|
|
81
|
+
container: HTMLElement,
|
|
82
|
+
): Error
|
|
83
|
+
export function makeSingleQuery<Arguments extends any[]>(
|
|
84
|
+
allQuery: QueryMethod<Arguments, HTMLElement[]>,
|
|
85
|
+
getMultipleError: GetErrorFunction<Arguments>,
|
|
86
|
+
): QueryMethod<Arguments, HTMLElement | null>
|
|
87
|
+
export function makeGetAllQuery<Arguments extends any[]>(
|
|
88
|
+
allQuery: QueryMethod<Arguments, HTMLElement[]>,
|
|
89
|
+
getMissingError: GetErrorFunction<Arguments>,
|
|
90
|
+
): QueryMethod<Arguments, HTMLElement[]>
|
|
91
|
+
export function makeFindQuery<QueryFor>(
|
|
92
|
+
getter: (
|
|
93
|
+
container: HTMLElement,
|
|
94
|
+
text: Matcher,
|
|
95
|
+
options: MatcherOptions,
|
|
96
|
+
) => QueryFor,
|
|
97
|
+
): (
|
|
98
|
+
container: HTMLElement,
|
|
99
|
+
text: Matcher,
|
|
100
|
+
options: MatcherOptions,
|
|
101
|
+
waitForOptions: waitForOptions,
|
|
102
|
+
) => Promise<QueryFor>
|
|
103
|
+
export function wrapSingleQueryWithSuggestion<Arguments extends any[]>(
|
|
104
|
+
query: QueryMethod<Arguments, HTMLElement | null>,
|
|
105
|
+
queryAllByName: string,
|
|
106
|
+
variant: Variant,
|
|
107
|
+
): QueryMethod<Arguments, HTMLElement | null>
|
|
108
|
+
export function wrapAllByQueryWithSuggestion<Arguments extends any[]>(
|
|
109
|
+
query: QueryMethod<Arguments, HTMLElement[]>,
|
|
110
|
+
queryAllByName: string,
|
|
111
|
+
variant: Variant,
|
|
112
|
+
): QueryMethod<Arguments, HTMLElement[]>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function logRoles(
|
|
2
|
+
container: HTMLElement,
|
|
3
|
+
options?: LogRolesOptions,
|
|
4
|
+
): string
|
|
5
|
+
|
|
6
|
+
interface LogRolesOptions {
|
|
7
|
+
hidden?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getRoles(container: HTMLElement): {
|
|
11
|
+
[index: string]: HTMLElement[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* https://testing-library.com/docs/dom-testing-library/api-helpers#isinaccessible
|
|
16
|
+
*/
|
|
17
|
+
export function isInaccessible(element: Element): boolean
|
|
18
|
+
|
|
19
|
+
export function computeHeadingLevel(element: Element): number | undefined
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {OptionsReceived} from 'pretty-format'
|
|
2
|
+
import {BoundFunctions, Queries} from './get-queries-for-element.js'
|
|
3
|
+
import * as queries from './queries.js'
|
|
4
|
+
import {AriaSnapshotOptions} from './aria-snapshot.js'
|
|
5
|
+
import {PrettyDOMOptions} from './pretty-dom.js'
|
|
6
|
+
|
|
7
|
+
export type Screen<Q extends Queries = typeof queries> = BoundFunctions<Q> & {
|
|
8
|
+
/**
|
|
9
|
+
* Convenience function for `pretty-dom` which also allows an array
|
|
10
|
+
* of elements
|
|
11
|
+
*/
|
|
12
|
+
debug: (
|
|
13
|
+
element?: Array<Element | HTMLDocument> | Element | HTMLDocument,
|
|
14
|
+
maxLength?: number,
|
|
15
|
+
options?: OptionsReceived & Pick<PrettyDOMOptions, 'format'> & AriaSnapshotOptions,
|
|
16
|
+
) => void
|
|
17
|
+
/**
|
|
18
|
+
* Convenience function for `Testing Playground` which logs and returns the URL that
|
|
19
|
+
* can be opened in a browser
|
|
20
|
+
*/
|
|
21
|
+
logTestingPlaygroundURL: (element?: Element | HTMLDocument) => string
|
|
22
|
+
/**
|
|
23
|
+
* @ctrl/dom addition: the accessibility tree of `element` (default `document.body`) as
|
|
24
|
+
* Playwright-style aria snapshot YAML: roles, accessible names, states and text, exactly as
|
|
25
|
+
* `*ByRole` queries see them. Far smaller than `debug()`'s HTML; meant for reading failures.
|
|
26
|
+
*/
|
|
27
|
+
ariaSnapshot: (element?: Element | HTMLDocument | DocumentFragment, options?: AriaSnapshotOptions) => string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const screen: Screen
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface QueryOptions {
|
|
2
|
+
[key: string]: RegExp | boolean
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export type QueryArgs = [string, QueryOptions?]
|
|
6
|
+
|
|
7
|
+
export interface Suggestion {
|
|
8
|
+
queryName: string
|
|
9
|
+
queryMethod: string
|
|
10
|
+
queryArgs: QueryArgs
|
|
11
|
+
variant: string
|
|
12
|
+
warning?: string
|
|
13
|
+
toString(): string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type Variant =
|
|
17
|
+
| 'find'
|
|
18
|
+
| 'findAll'
|
|
19
|
+
| 'get'
|
|
20
|
+
| 'getAll'
|
|
21
|
+
| 'query'
|
|
22
|
+
| 'queryAll'
|
|
23
|
+
|
|
24
|
+
export type Method =
|
|
25
|
+
| 'AltText'
|
|
26
|
+
| 'alttext'
|
|
27
|
+
| 'DisplayValue'
|
|
28
|
+
| 'displayvalue'
|
|
29
|
+
| 'LabelText'
|
|
30
|
+
| 'labeltext'
|
|
31
|
+
| 'PlaceholderText'
|
|
32
|
+
| 'placeholdertext'
|
|
33
|
+
| 'Role'
|
|
34
|
+
| 'role'
|
|
35
|
+
| 'TestId'
|
|
36
|
+
| 'testid'
|
|
37
|
+
| 'Text'
|
|
38
|
+
| 'text'
|
|
39
|
+
| 'Title'
|
|
40
|
+
| 'title'
|
|
41
|
+
|
|
42
|
+
export function getSuggestedQuery(
|
|
43
|
+
element: HTMLElement,
|
|
44
|
+
variant?: Variant,
|
|
45
|
+
method?: Method,
|
|
46
|
+
): Suggestion | undefined
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface waitForOptions {
|
|
2
|
+
container?: HTMLElement
|
|
3
|
+
timeout?: number
|
|
4
|
+
interval?: number
|
|
5
|
+
onTimeout?: (error: Error) => Error
|
|
6
|
+
mutationObserverOptions?: MutationObserverInit
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function waitFor<T>(
|
|
10
|
+
callback: () => Promise<T> | T,
|
|
11
|
+
options?: waitForOptions,
|
|
12
|
+
): Promise<T>
|