@orkestrel/test 0.0.12 → 0.0.14
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/README.md +42 -38
- package/dist/src/browser/index.d.ts +74 -37
- package/dist/src/browser/index.js +12 -22
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +63 -3
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +83 -7
- package/dist/src/core/index.d.ts +83 -7
- package/dist/src/core/index.js +63 -3
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +185 -4
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +194 -11
- package/dist/src/server/index.d.ts +194 -11
- package/dist/src/server/index.js +185 -4
- package/dist/src/server/index.js.map +1 -1
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
# @orkestrel/test
|
|
2
2
|
|
|
3
|
-
The test helpers the `@orkestrel` fleet kept rewriting, published once
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
here
|
|
11
|
-
[Limits](guides/test.md#limits) section states that rule, what it excluded, and the one door the
|
|
12
|
-
journey layer came through instead. Add it as a devDependency; nothing here runs in production
|
|
13
|
-
code. Part of the `@orkestrel` line.
|
|
3
|
+
> The test helpers the `@orkestrel` fleet kept rewriting, published once: families of what a test
|
|
4
|
+
> records, what it waits for, and what it owns, with a pair outside all of them and a browser
|
|
5
|
+
> journey layer beside them.
|
|
6
|
+
|
|
7
|
+
Add it as a devDependency and import the core from `@orkestrel/test`. A helper ships here only when
|
|
8
|
+
enough packages had already written their own; the guide's [Limits](guides/test.md#limits) section
|
|
9
|
+
states that rule, what it excluded, and the one door the journey layer came through instead. Nothing
|
|
10
|
+
here runs in production code. Part of the `@orkestrel` line.
|
|
14
11
|
|
|
15
12
|
It has **zero runtime dependencies**, and no exported signature names an `@orkestrel/*` type. Both
|
|
16
13
|
rules exist for one reason: a test helper hands its types straight into the consumer's assertions,
|
|
@@ -73,21 +70,27 @@ once, in its own setup, because registering it here would take a runtime depende
|
|
|
73
70
|
runner. A handler that throws does not stop the run: one failure is rethrown by identity, so the
|
|
74
71
|
test can assert on the value it threw, and several arrive as an `AggregateError` in run order.
|
|
75
72
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
`
|
|
83
|
-
`
|
|
73
|
+
Core also carries the wait family (`waitForCondition`, `retryUntil`, `waitForEvent`, `waitForAbort`,
|
|
74
|
+
and the leaves they share), the recorder map and the abort-signal instrument, the unchecked
|
|
75
|
+
boundary, the header flattener, and the JSON Lines decoder — the guide's
|
|
76
|
+
[Surface](guides/test.md#surface) section carries every export. Among them are `collect` (drains an
|
|
77
|
+
async iterable), `collectStream` (drains a `ReadableStream`), `roundTripJSON` (copies any value
|
|
78
|
+
`JSONSafe` accepts, including an interface-typed one, and throws rather than turning a non-finite
|
|
79
|
+
number into `null`), `resolveRoot` (the directory above the calling module, from `import.meta`), and
|
|
80
|
+
`createHostileValues` (a frozen array of fresh values that each make a naive read throw or violate a
|
|
81
|
+
naive structural assumption). Beside them sits the statechart contract the fleet repeats:
|
|
82
|
+
`StateTransition` and `StateScenario` for one row of a transition table, `executeScenario` and
|
|
83
|
+
`executeScenarios` to walk it, and `STATECHART_ATTRIBUTES` and `STATECHART_STATUSES` for the harness
|
|
84
|
+
a browser workspace renders that table in.
|
|
84
85
|
|
|
85
86
|
The server face adds `readInventory`, which reads a checkout into a map of root-relative path to
|
|
86
87
|
file text that a parity suite can assert against, and `createLoopback`, which binds a server the
|
|
87
|
-
test built to an ephemeral loopback port. Behind
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
test built to an ephemeral loopback port. Behind them sit the pure leaves the server face also
|
|
89
|
+
exports on its own: `readInventory` refuses an escape with `resolveContained` and prunes with
|
|
90
|
+
`isExcluded`, while `createScratch` refuses one with `requireContained`, the throwing form, and
|
|
91
|
+
reads and compares its allocation with `readIdentity` and `matchesIdentity` before `destroy()`
|
|
92
|
+
removes anything. `createLink` and `removeTree` do the writing under it, and both decide on the
|
|
93
|
+
errno `readErrorCode` reads off an unknown throw.
|
|
91
94
|
|
|
92
95
|
```ts
|
|
93
96
|
import { resolveRoot } from '@orkestrel/test'
|
|
@@ -129,21 +132,22 @@ Object.keys(readInventory(root, ['src'], { extensions: ['.ts'], exclude: ['src/s
|
|
|
129
132
|
// 'src/core/validators.ts']
|
|
130
133
|
```
|
|
131
134
|
|
|
132
|
-
Keys are root-relative and `/`-separated whatever the host separator is
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
key that is not integer-like.
|
|
135
|
+
Keys are root-relative and `/`-separated whatever the host separator is. The suite gates that proof
|
|
136
|
+
on a runtime reading of `node:path` rather than on a platform name, so it runs only where the host
|
|
137
|
+
separator differs from `/`. Keys are inserted in sorted order, and a plain object reads that order
|
|
138
|
+
back for every key that is not integer-like.
|
|
136
139
|
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
`createScratch` and `readInventory` promise different things, and each boundary is worth stating up
|
|
141
|
+
front. `createScratch` allocates its own directory at POSIX mode `0700` — under the host temporary
|
|
139
142
|
directory, or under a `parent` you name — and refuses a path that lexically escapes it. The suite
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
gates that assertion on `supportsMode`, the shipped probe that reads whether permission bits
|
|
144
|
+
round-trip on this host, so it runs only where they do and claims nothing about a host that emulates
|
|
145
|
+
them. The mode keeps another uid out, and neither a sibling test worker nor the code under test is
|
|
146
|
+
another uid. It does not walk segments for symbolic links. A link inside its own allocation was
|
|
147
|
+
created by the test process, by the code the test drives, or by this package's own `link` — handing
|
|
148
|
+
that code `scratch.path` is the ordinary use of this helper — and a contained path reaches outside
|
|
149
|
+
the allocation through one. The guide's [traversal](guides/test.md#traversal) section states what
|
|
150
|
+
each member does with a link it meets. Naming a `parent` inside a package tree costs one more thing:
|
|
147
151
|
while the allocation exists, everything that walks that tree sees it. `destroy()` is unaffected by
|
|
148
152
|
where the allocation sits, because it matches the allocation's identity rather than its path. One
|
|
149
153
|
field of that identity is the host's to supply: where a host reports no real creation time, libuv
|
|
@@ -203,8 +207,8 @@ rule deciding what ships and what stays in the package that owns it — see
|
|
|
203
207
|
|
|
204
208
|
## Package
|
|
205
209
|
|
|
206
|
-
Published as
|
|
207
|
-
|
|
210
|
+
Published as typed entry points per the `exports` field in `package.json`: `@orkestrel/test` for the
|
|
211
|
+
host-independent core, `@orkestrel/test/browser` for the journey layer, and
|
|
208
212
|
`@orkestrel/test/server` for the Node helpers. Core and server ship ESM and CommonJS; the browser
|
|
209
213
|
face ships ESM only, because `vitest/browser` is an ES-only module.
|
|
210
214
|
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads only inside Vitest Browser Mode, where it drives a real browser through the installed
|
|
3
|
+
* provider.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This entry imports `vitest/browser` at module scope, so importing it from a Node host throws at
|
|
7
|
+
* module load. That throw is the contract: it arrives at the import that caused it rather than
|
|
8
|
+
* inside the first helper call, and no Node host half-loads a surface whose every verb assumes the
|
|
9
|
+
* Browser Mode runner.
|
|
10
|
+
*
|
|
11
|
+
* A module that must load under Node as well reaches this entry through a dynamic import behind a
|
|
12
|
+
* DOM guard. A setup file that a Node project and a browser project both register is the case that
|
|
13
|
+
* needs it.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* let render: ((markup: string) => HTMLDivElement) | undefined
|
|
18
|
+
* if (typeof document !== 'undefined') {
|
|
19
|
+
* ;({ render } = await import('@orkestrel/test/browser'))
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
|
|
1
26
|
/**
|
|
2
27
|
* Names the interactive ARIA roles a bare accessible name is searched across.
|
|
3
28
|
*
|
|
@@ -45,7 +70,7 @@ export declare function blendColor(front: Color, back: Color): Color;
|
|
|
45
70
|
export declare function build<K extends keyof HTMLElementTagNameMap>(tag: K, options?: ElementOptions): HTMLElementTagNameMap[K];
|
|
46
71
|
|
|
47
72
|
/**
|
|
48
|
-
* Names the color a browser paints an unstyled document with.
|
|
73
|
+
* Names the color a browser paints an unstyled document with: opaque white.
|
|
49
74
|
*
|
|
50
75
|
* @remarks
|
|
51
76
|
* This is the floor a backdrop walk ends on wherever the caller wants the browser's own canvas
|
|
@@ -144,7 +169,7 @@ export declare const CAPTURE_STAGINGS = 4;
|
|
|
144
169
|
*/
|
|
145
170
|
export declare function captureFrame(options: FrameOptions): Promise<string>;
|
|
146
171
|
|
|
147
|
-
/** Represents one theme-and-viewport pair a capture run renders. */
|
|
172
|
+
/** Represents one theme-and-viewport pair a capture run renders, and the document change it needs first. */
|
|
148
173
|
export declare interface CaptureVariant {
|
|
149
174
|
/** Holds the variant's name, which is the second half of every filename the run writes. */
|
|
150
175
|
readonly name: string;
|
|
@@ -496,7 +521,7 @@ export declare function describeFocus(element: Element): string;
|
|
|
496
521
|
export declare function describeTree(element: Element): string;
|
|
497
522
|
|
|
498
523
|
/**
|
|
499
|
-
* Configures one built element.
|
|
524
|
+
* Configures one built element: its class list, its text, and its attributes.
|
|
500
525
|
*
|
|
501
526
|
* @remarks
|
|
502
527
|
* `classes` is written the way a `class` attribute is written — one space-separated string — so a
|
|
@@ -668,7 +693,7 @@ export declare function findRule(selector: string): CSSStyleRule | undefined;
|
|
|
668
693
|
*/
|
|
669
694
|
export declare const FOCUSABLE_SELECTOR = "a[href], area[href], button, input, select, summary, textarea, [tabindex]";
|
|
670
695
|
|
|
671
|
-
/** Configures one captured frame. */
|
|
696
|
+
/** Configures one captured frame: where it is written, the viewport it is shot at, and what it shoots. */
|
|
672
697
|
export declare interface FrameOptions {
|
|
673
698
|
/** Holds the frame's path, relative to the calling test file. */
|
|
674
699
|
readonly path: string;
|
|
@@ -681,7 +706,8 @@ export declare interface FrameOptions {
|
|
|
681
706
|
}
|
|
682
707
|
|
|
683
708
|
/**
|
|
684
|
-
* Represents one written frame
|
|
709
|
+
* Represents one written frame read back from the file a capture produced: its size in device
|
|
710
|
+
* pixels, and the single color its bottom row paints.
|
|
685
711
|
*
|
|
686
712
|
* @remarks
|
|
687
713
|
* The floor is the frame's bottom row, because that row is where coverage shows: a frame shot at a
|
|
@@ -747,7 +773,7 @@ export declare const IMPLICIT_ROLES: Readonly<Record<string, string>>;
|
|
|
747
773
|
export declare function isOutsideViewport(rectangle: DOMRectReadOnly): boolean;
|
|
748
774
|
|
|
749
775
|
/**
|
|
750
|
-
* Determines whether a person can click one element where it
|
|
776
|
+
* Determines whether a person can click one element where it sits.
|
|
751
777
|
*
|
|
752
778
|
* @param element - The element to judge.
|
|
753
779
|
* @returns True if the element is connected, visible, laid out with a non-zero box, in the
|
|
@@ -833,6 +859,8 @@ export declare interface JournalInterface {
|
|
|
833
859
|
* @param action - What the run did, as one verb.
|
|
834
860
|
* @param trigger - The exact thing it did it to.
|
|
835
861
|
* @param result - What was observed on the surface after the step landed.
|
|
862
|
+
* @remarks The appended step is frozen. A step taken before `start` or after `stop` is not
|
|
863
|
+
* recorded at all.
|
|
836
864
|
*/
|
|
837
865
|
record(action: string, trigger: string, result: string): void;
|
|
838
866
|
}
|
|
@@ -1043,7 +1071,10 @@ export declare interface PortfolioInterface {
|
|
|
1043
1071
|
place(state: string, element?: Element): Promise<string | undefined>;
|
|
1044
1072
|
}
|
|
1045
1073
|
|
|
1046
|
-
/**
|
|
1074
|
+
/**
|
|
1075
|
+
* Configures a capture portfolio: the state registry, the variant matrix, this run's variant, where
|
|
1076
|
+
* it writes, and whether it writes at all.
|
|
1077
|
+
*/
|
|
1047
1078
|
export declare interface PortfolioOptions {
|
|
1048
1079
|
/**
|
|
1049
1080
|
* Lists every state name the journeys place, declared once. `place` refuses a name absent from
|
|
@@ -1063,19 +1094,6 @@ export declare interface PortfolioOptions {
|
|
|
1063
1094
|
readonly enabled?: boolean;
|
|
1064
1095
|
}
|
|
1065
1096
|
|
|
1066
|
-
/**
|
|
1067
|
-
* Presses a browser-keyboard sequence using Vitest's installed user-event syntax.
|
|
1068
|
-
*
|
|
1069
|
-
* @param keys - The keys or key descriptors to press.
|
|
1070
|
-
* @returns A promise resolving after the sequence completes.
|
|
1071
|
-
*
|
|
1072
|
-
* @example
|
|
1073
|
-
* ```ts
|
|
1074
|
-
* await pressKeys('{ArrowRight}{Enter}')
|
|
1075
|
-
* ```
|
|
1076
|
-
*/
|
|
1077
|
-
export declare function pressKeys(keys: string): Promise<void>;
|
|
1078
|
-
|
|
1079
1097
|
/**
|
|
1080
1098
|
* Resolves the opaque color standing behind one element.
|
|
1081
1099
|
*
|
|
@@ -1194,7 +1212,7 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1194
1212
|
export declare function readContrast(element: Element, floor?: Color): number;
|
|
1195
1213
|
|
|
1196
1214
|
/**
|
|
1197
|
-
* Reads the rendered text of the element that
|
|
1215
|
+
* Reads the rendered text of the element that holds focus.
|
|
1198
1216
|
*
|
|
1199
1217
|
* @returns The focused HTML element's trimmed rendered text, including an empty string, or
|
|
1200
1218
|
* `undefined` when focus rests on a non-HTML element. When nothing holds focus, the browser
|
|
@@ -1357,9 +1375,9 @@ export declare function readPixels(element: Element, property: string): number;
|
|
|
1357
1375
|
*
|
|
1358
1376
|
* @remarks
|
|
1359
1377
|
* This reads and never acts. Focus arrives through the published verbs — `traverseAccessible`,
|
|
1360
|
-
* `
|
|
1361
|
-
* that is not matching `:focus-visible` when the call is made
|
|
1362
|
-
* measurement taken then would be about focus.
|
|
1378
|
+
* `userEvent.keyboard` from `vitest/browser`, a real click — and this measures what the browser
|
|
1379
|
+
* painted once it landed. A control that is not matching `:focus-visible` when the call is made
|
|
1380
|
+
* reports nothing, because no measurement taken then would be about focus.
|
|
1363
1381
|
*
|
|
1364
1382
|
* Some controls are two elements: one that takes the focus and one a reader can see. A hidden radio
|
|
1365
1383
|
* beside the label that carries every pixel of its chrome is the case `worn` exists for, so a
|
|
@@ -1632,32 +1650,47 @@ export declare function releasePane(): Promise<void>;
|
|
|
1632
1650
|
export declare function removeDatabase(name: string): Promise<void>;
|
|
1633
1651
|
|
|
1634
1652
|
/**
|
|
1635
|
-
* Renders one fixture into the document
|
|
1653
|
+
* Renders one fixture into the document from trusted markup.
|
|
1636
1654
|
*
|
|
1637
|
-
* @param
|
|
1638
|
-
* @
|
|
1639
|
-
* @returns The attached container for the markup form, and the attached element itself for the tag
|
|
1640
|
-
* form.
|
|
1655
|
+
* @param markup - The fixture markup to parse.
|
|
1656
|
+
* @returns The attached container holding the fixture's own nodes.
|
|
1641
1657
|
*
|
|
1642
1658
|
* @remarks
|
|
1643
1659
|
* The class list is required in the tag form, which is what keeps the two forms apart: a
|
|
1644
|
-
* one-argument call is always markup.
|
|
1660
|
+
* one-argument call is always markup.
|
|
1645
1661
|
*
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
* as it is for {@link mount}.
|
|
1662
|
+
* This form parses `markup` into a fresh container and returns that container, so the fixture's own
|
|
1663
|
+
* nodes are its children. It attaches to `document.body` and records nothing, so removal is the
|
|
1664
|
+
* caller's, exactly as it is for {@link mount}.
|
|
1650
1665
|
*
|
|
1651
1666
|
* @example
|
|
1652
1667
|
* ```ts
|
|
1653
1668
|
* const container = render('<button type="button">Save</button>')
|
|
1654
|
-
* const panel = render('section', 'surface muted')
|
|
1655
1669
|
* container.remove()
|
|
1656
|
-
* panel.remove()
|
|
1657
1670
|
* ```
|
|
1658
1671
|
*/
|
|
1659
1672
|
export declare function render(markup: string): HTMLDivElement;
|
|
1660
1673
|
|
|
1674
|
+
/**
|
|
1675
|
+
* Renders one fixture into the document from a tag name and its class list.
|
|
1676
|
+
*
|
|
1677
|
+
* @param tag - The HTML tag name to create.
|
|
1678
|
+
* @param classes - The class list to place on the created element.
|
|
1679
|
+
* @returns The attached element itself, typed as exactly that tag.
|
|
1680
|
+
*
|
|
1681
|
+
* @remarks
|
|
1682
|
+
* The class list is required in the tag form, which is what keeps the two forms apart: a
|
|
1683
|
+
* one-argument call is always markup. A tag with no classes is `mount(build(tag))`.
|
|
1684
|
+
*
|
|
1685
|
+
* This form returns the element itself rather than a container. It attaches to `document.body` and
|
|
1686
|
+
* records nothing, so removal is the caller's, exactly as it is for {@link mount}.
|
|
1687
|
+
*
|
|
1688
|
+
* @example
|
|
1689
|
+
* ```ts
|
|
1690
|
+
* const panel = render('section', 'surface muted')
|
|
1691
|
+
* panel.remove()
|
|
1692
|
+
* ```
|
|
1693
|
+
*/
|
|
1661
1694
|
export declare function render<K extends keyof HTMLElementTagNameMap>(tag: K, classes: string): HTMLElementTagNameMap[K];
|
|
1662
1695
|
|
|
1663
1696
|
/**
|
|
@@ -1744,7 +1777,7 @@ export declare function resolveRendered(first: string, second?: string): HTMLEle
|
|
|
1744
1777
|
* therefore unscaled and lifted to the window's own origin for the shot. The `iframe[data-vitest]`
|
|
1745
1778
|
* selector and the `--tester-transform`, `--tester-margin-left`, `--viewport-width`, and
|
|
1746
1779
|
* `--viewport-height` custom properties are the runner's, so a Vitest release that renames any of
|
|
1747
|
-
* them reddens the size check
|
|
1780
|
+
* them reddens the size check that follows rather than writing a wrong frame.
|
|
1748
1781
|
*
|
|
1749
1782
|
* Hand the pane straight back with {@link releasePane}. A tester pinned at a viewport taller than
|
|
1750
1783
|
* the window puts its lower half beyond what a pointer can reach, so an ordinary press then fails
|
|
@@ -1797,6 +1830,10 @@ export declare function traverseAccessible(name: string): Promise<HTMLElement>;
|
|
|
1797
1830
|
* @param text - The text to type.
|
|
1798
1831
|
* @returns A promise resolving after every keystroke completes.
|
|
1799
1832
|
*
|
|
1833
|
+
* @remarks
|
|
1834
|
+
* The text is escaped against the provider's own key syntax, so a literal `{` or `[` is typed
|
|
1835
|
+
* rather than read as the start of a key sequence.
|
|
1836
|
+
*
|
|
1800
1837
|
* @example
|
|
1801
1838
|
* ```ts
|
|
1802
1839
|
* await typeAccessible('Runs', '3')
|
|
@@ -27,7 +27,7 @@ var ACCESSIBLE_ROLES = Object.freeze([
|
|
|
27
27
|
"treeitem"
|
|
28
28
|
]);
|
|
29
29
|
/**
|
|
30
|
-
* Names the color a browser paints an unstyled document with.
|
|
30
|
+
* Names the color a browser paints an unstyled document with: opaque white.
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
33
|
* This is the floor a backdrop walk ends on wherever the caller wants the browser's own canvas
|
|
@@ -207,7 +207,7 @@ function isOutsideViewport(rectangle) {
|
|
|
207
207
|
return rectangle.bottom <= 0 || rectangle.right <= 0 || rectangle.top >= window.innerHeight || rectangle.left >= window.innerWidth;
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
|
-
* Determines whether a person can click one element where it
|
|
210
|
+
* Determines whether a person can click one element where it sits.
|
|
211
211
|
*
|
|
212
212
|
* @param element - The element to judge.
|
|
213
213
|
* @returns True if the element is connected, visible, laid out with a non-zero box, in the
|
|
@@ -435,6 +435,10 @@ async function clickDisclosure(name) {
|
|
|
435
435
|
* @param text - The text to type.
|
|
436
436
|
* @returns A promise resolving after every keystroke completes.
|
|
437
437
|
*
|
|
438
|
+
* @remarks
|
|
439
|
+
* The text is escaped against the provider's own key syntax, so a literal `{` or `[` is typed
|
|
440
|
+
* rather than read as the start of a key sequence.
|
|
441
|
+
*
|
|
438
442
|
* @example
|
|
439
443
|
* ```ts
|
|
440
444
|
* await typeAccessible('Runs', '3')
|
|
@@ -466,20 +470,6 @@ async function fillAccessible(name, text) {
|
|
|
466
470
|
await userEvent.fill(resolveRendered(name), text);
|
|
467
471
|
}
|
|
468
472
|
/**
|
|
469
|
-
* Presses a browser-keyboard sequence using Vitest's installed user-event syntax.
|
|
470
|
-
*
|
|
471
|
-
* @param keys - The keys or key descriptors to press.
|
|
472
|
-
* @returns A promise resolving after the sequence completes.
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* ```ts
|
|
476
|
-
* await pressKeys('{ArrowRight}{Enter}')
|
|
477
|
-
* ```
|
|
478
|
-
*/
|
|
479
|
-
async function pressKeys(keys) {
|
|
480
|
-
await userEvent.keyboard(keys);
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
473
|
* Reaches a named control only through natural forward Tab traversal from the current focus.
|
|
484
474
|
*
|
|
485
475
|
* @param name - The target's exact accessible name.
|
|
@@ -580,7 +570,7 @@ function readPage() {
|
|
|
580
570
|
return document.body.innerText.replaceAll(/\s+/g, " ").trim();
|
|
581
571
|
}
|
|
582
572
|
/**
|
|
583
|
-
* Reads the rendered text of the element that
|
|
573
|
+
* Reads the rendered text of the element that holds focus.
|
|
584
574
|
*
|
|
585
575
|
* @returns The focused HTML element's trimmed rendered text, including an empty string, or
|
|
586
576
|
* `undefined` when focus rests on a non-HTML element. When nothing holds focus, the browser
|
|
@@ -1329,9 +1319,9 @@ function readContrast(element, floor) {
|
|
|
1329
1319
|
*
|
|
1330
1320
|
* @remarks
|
|
1331
1321
|
* This reads and never acts. Focus arrives through the published verbs — `traverseAccessible`,
|
|
1332
|
-
* `
|
|
1333
|
-
* that is not matching `:focus-visible` when the call is made
|
|
1334
|
-
* measurement taken then would be about focus.
|
|
1322
|
+
* `userEvent.keyboard` from `vitest/browser`, a real click — and this measures what the browser
|
|
1323
|
+
* painted once it landed. A control that is not matching `:focus-visible` when the call is made
|
|
1324
|
+
* reports nothing, because no measurement taken then would be about focus.
|
|
1335
1325
|
*
|
|
1336
1326
|
* Some controls are two elements: one that takes the focus and one a reader can see. A hidden radio
|
|
1337
1327
|
* beside the label that carries every pixel of its chrome is the case `worn` exists for, so a
|
|
@@ -1756,7 +1746,7 @@ function measureContent() {
|
|
|
1756
1746
|
* therefore unscaled and lifted to the window's own origin for the shot. The `iframe[data-vitest]`
|
|
1757
1747
|
* selector and the `--tester-transform`, `--tester-margin-left`, `--viewport-width`, and
|
|
1758
1748
|
* `--viewport-height` custom properties are the runner's, so a Vitest release that renames any of
|
|
1759
|
-
* them reddens the size check
|
|
1749
|
+
* them reddens the size check that follows rather than writing a wrong frame.
|
|
1760
1750
|
*
|
|
1761
1751
|
* Hand the pane straight back with {@link releasePane}. A tester pinned at a viewport taller than
|
|
1762
1752
|
* the window puts its lower half beyond what a pointer can reach, so an ordinary press then fails
|
|
@@ -2256,6 +2246,6 @@ function createJournal() {
|
|
|
2256
2246
|
};
|
|
2257
2247
|
}
|
|
2258
2248
|
//#endregion
|
|
2259
|
-
export { ACCESSIBLE_ROLES, CANVAS_COLOR, CAPTURE_PANE, CAPTURE_STAGINGS, CONTENT_ROLES, FIELD_ROLES, FOCUSABLE_SELECTOR, HEADER_ROLES, IMPLICIT_ROLES, blendColor, build, captureFrame, clearStorage, clickAccessible, clickAccessibleWithin, clickDisclosure, commitInput, computeNamePattern, createChannel, createDragEvent, createJournal, createPointerEvent, createPortfolio, describeFocus, describeTree, expandCaptures, extractOrphans, extractStyles, fillAccessible, findKeyframes, findRule, isOutsideViewport, isReachable, isRendered, matchesColor, measureContent, measureContrast, measureLuminance, mount, parseCSSColor, parseColor,
|
|
2249
|
+
export { ACCESSIBLE_ROLES, CANVAS_COLOR, CAPTURE_PANE, CAPTURE_STAGINGS, CONTENT_ROLES, FIELD_ROLES, FOCUSABLE_SELECTOR, HEADER_ROLES, IMPLICIT_ROLES, blendColor, build, captureFrame, clearStorage, clickAccessible, clickAccessibleWithin, clickDisclosure, commitInput, computeNamePattern, createChannel, createDragEvent, createJournal, createPointerEvent, createPortfolio, describeFocus, describeTree, expandCaptures, extractOrphans, extractStyles, fillAccessible, findKeyframes, findRule, isOutsideViewport, isReachable, isRendered, matchesColor, measureContent, measureContrast, measureLuminance, mount, parseCSSColor, parseColor, readBackdrop, readCascade, readClasses, readContrast, readFocus, readFrame, readLayers, readName, readPage, readPerception, readPixels, readRing, readRole, readRootToken, readRows, readRules, readStates, readStyle, readText, readToken, readValue, releasePane, removeDatabase, render, resolveAccessible, resolveRendered, stagePane, traverseAccessible, typeAccessible, typeInput, waitForFrame };
|
|
2260
2250
|
|
|
2261
2251
|
//# sourceMappingURL=index.js.map
|