@rind-ui/testing 0.3.0 → 0.4.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/dist/{adapter-B05M46SW.d.mts → adapter-C3LQTPFi.d.mts} +2 -0
- package/dist/{compose-BpR_PG11.mjs → compose-m76ER6GL.mjs} +1 -1
- package/dist/{dom-Ur_VPlTe.d.mts → dom-BH8CVBb2.d.mts} +1 -1
- package/dist/{dom-Bnnr_fg-.mjs → dom-DjurZVd0.mjs} +35 -4
- package/dist/dom.d.mts +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/index.d.mts +3276 -852
- package/dist/index.mjs +217 -25
- package/dist/inpage.iife.js +7 -7
- package/dist/{playwright-C3Ue38p3.mjs → playwright-BbVj53fU.mjs} +10 -3
- package/dist/{playwright-By15MZsN.d.mts → playwright-D2coDhsT.d.mts} +1 -1
- package/dist/playwright.d.mts +1 -1
- package/dist/playwright.mjs +1 -1
- package/dist/setup.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as isEnvFactory, i as hostedPartName, n as UntilTimeout, o as mirror } from "./compose-
|
|
2
|
-
import { a as navigationLog, i as interceptNativeNavigation, n as installErrorLog, o as installAnnouncementLog, r as fakeRouter, s as recordingAnnouncer, t as domEnv } from "./dom-
|
|
3
|
-
import { n as playwrightEnv, r as watchPageErrors, t as isPage } from "./playwright-
|
|
4
|
-
import { accordionContract, alertContract,
|
|
1
|
+
import { a as isEnvFactory, i as hostedPartName, n as UntilTimeout, o as mirror } from "./compose-m76ER6GL.mjs";
|
|
2
|
+
import { a as navigationLog, i as interceptNativeNavigation, n as installErrorLog, o as installAnnouncementLog, r as fakeRouter, s as recordingAnnouncer, t as domEnv } from "./dom-DjurZVd0.mjs";
|
|
3
|
+
import { n as playwrightEnv, r as watchPageErrors, t as isPage } from "./playwright-BbVj53fU.mjs";
|
|
4
|
+
import { accordionContract, alertContract, alertDialogRoleContract, avatarContract, badgeContract, breadcrumbsContract, buttonContract, calendarContract, checkboxContract, checkboxGroupContract, codeBlockContract, collapsibleContract, colorPickerContract, comboboxContract, contextMenuContract, createService, dateFieldContract, dateRangeFieldContract, dialogContract, drawerContract, fieldContract, fieldsetContract, formContract, gridListContract, headingContract, hoverCardContract, imageContract, inlineComboboxContract, labelContract, linkContract, listboxContract, menuContract, menubarContract, menubarMenuContract, meterContract, modalPopoverContract, modalTourContract, navigationMenuContract, nonModalContextMenuContract, nonModalDialogContract, nonModalDrawerContract, nonModalMenuContract, nonModalMenubarMenuContract, numberInputContract, paginationContract, pinInputContract, platforms, platforms as platforms$1, popoverContract, progressContract, promptInputContract, qrCodeContractWith, quirkActive, radioGroupContract, ratingContract, scrollAreaContract, segmentedControlContract, selectContract, separatorContract, separatorContractFor, skeletonContract, sliderContract, splitterContract, switchContract, tabsContract, tagGroupContract, tagsInputContract, textFieldContract, toastContract, toasterContract, toggleContract, toggleGroupContract, toolbarContract, tooltipContract, tourContract, treeViewContract, withEngine, withEngine as withEngine$1 } from "@rind-ui/core";
|
|
5
5
|
import { parseQrPath } from "@rind-ui/core/qr";
|
|
6
6
|
import { colorAreaContract, colorChannelFieldContract, colorFieldContract, colorSliderContract, colorSwatchContract, colorSwatchPickerContract, pickSwatch } from "@rind-ui/core/internal";
|
|
7
7
|
//#region src/accordion-invariants.ts
|
|
@@ -276,15 +276,6 @@ function getAlert(target, anchor = {}, options) {
|
|
|
276
276
|
return createDriverWith(alertContract, within ?? target, [title === void 0 ? {} : { title }], options);
|
|
277
277
|
}
|
|
278
278
|
//#endregion
|
|
279
|
-
//#region src/components/alert-dialog.ts
|
|
280
|
-
/**
|
|
281
|
-
* A driver for the Alert Dialog named `name`, located through its trigger (`trigger`,
|
|
282
|
-
* default `name`: a closed dialog has no content to find). It is always modal.
|
|
283
|
-
*/
|
|
284
|
-
function getAlertDialog(target, anchor, options) {
|
|
285
|
-
return createDriverWith(alertDialogContract, target, [anchor], options);
|
|
286
|
-
}
|
|
287
|
-
//#endregion
|
|
288
279
|
//#region src/components/avatar.ts
|
|
289
280
|
/**
|
|
290
281
|
* A driver for an Avatar: the one named `name` (role `img`), or, for a decorative avatar,
|
|
@@ -338,6 +329,12 @@ function getCheckboxGroup(target, anchor, options) {
|
|
|
338
329
|
return createDriverWith(checkboxGroupContract, target, [anchor], options);
|
|
339
330
|
}
|
|
340
331
|
//#endregion
|
|
332
|
+
//#region src/components/code-block.ts
|
|
333
|
+
/** A driver for the Code Block titled `title`, or the only one in `target`. */
|
|
334
|
+
function getCodeBlock(target, anchor, options) {
|
|
335
|
+
return createDriverWith(codeBlockContract, target, anchor ? [anchor] : [], options);
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
341
338
|
//#region src/components/collapsible.ts
|
|
342
339
|
/** A driver for the Collapsible whose trigger is named `name`. */
|
|
343
340
|
function getCollapsible(target, anchor, options) {
|
|
@@ -426,9 +423,9 @@ function getColorPicker(target, anchor, options) {
|
|
|
426
423
|
}
|
|
427
424
|
//#endregion
|
|
428
425
|
//#region src/components/combobox.ts
|
|
429
|
-
/** A driver for the Combobox named `name`: type, compose, open, choose, clear, queries. */
|
|
430
426
|
function getCombobox(target, anchor, options) {
|
|
431
|
-
|
|
427
|
+
const { inline, ...rest } = options ?? {};
|
|
428
|
+
return inline ? createDriverWith(inlineComboboxContract, target, [anchor], rest) : createDriverWith(comboboxContract, target, [anchor], rest);
|
|
432
429
|
}
|
|
433
430
|
//#endregion
|
|
434
431
|
//#region src/components/context-menu.ts
|
|
@@ -441,14 +438,22 @@ function getContextMenu(target, anchor, options) {
|
|
|
441
438
|
return createDriverWith(modal === false ? nonModalContextMenuContract : contextMenuContract, target, [locate], options);
|
|
442
439
|
}
|
|
443
440
|
//#endregion
|
|
441
|
+
//#region src/components/date-field.ts
|
|
442
|
+
function getDateField(target, anchor, options) {
|
|
443
|
+
const { selectionMode, ...locate } = anchor;
|
|
444
|
+
return selectionMode === "range" ? createDriverWith(dateRangeFieldContract, target, [locate], options) : createDriverWith(dateFieldContract, target, [locate], options);
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
444
447
|
//#region src/components/dialog.ts
|
|
445
448
|
/**
|
|
446
449
|
* A driver for the Dialog named `name`, located through its trigger (`trigger`, default
|
|
447
|
-
* `name`: a closed dialog has no content to find). `modal: false` for a non-modal dialog
|
|
450
|
+
* `name`: a closed dialog has no content to find). `modal: false` for a non-modal dialog;
|
|
451
|
+
* `role: "alertdialog"` for a confirmation (an outside press leaves it open; `cancel()` and
|
|
452
|
+
* `confirm(name?)` press its buttons).
|
|
448
453
|
*/
|
|
449
454
|
function getDialog(target, anchor, options) {
|
|
450
|
-
const { modal, ...locate } = anchor;
|
|
451
|
-
return createDriverWith(modal === false ? nonModalDialogContract : dialogContract, target, [locate], options);
|
|
455
|
+
const { modal, role, ...locate } = anchor;
|
|
456
|
+
return createDriverWith(role === "alertdialog" ? alertDialogRoleContract : modal === false ? nonModalDialogContract : dialogContract, target, [locate], options);
|
|
452
457
|
}
|
|
453
458
|
//#endregion
|
|
454
459
|
//#region src/components/drawer.ts
|
|
@@ -485,6 +490,12 @@ function getForm(target, anchor, options) {
|
|
|
485
490
|
return createDriverWith(formContract, target, [anchor], options);
|
|
486
491
|
}
|
|
487
492
|
//#endregion
|
|
493
|
+
//#region src/components/grid-list.ts
|
|
494
|
+
/** A driver for the Grid List named `name`: act, check, controls, choose, typeahead, queries. */
|
|
495
|
+
function getGridList(target, anchor, options) {
|
|
496
|
+
return createDriverWith(gridListContract, target, [anchor], options);
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
488
499
|
//#region src/components/heading.ts
|
|
489
500
|
/** A driver for the heading named `name`: `level()`. */
|
|
490
501
|
function getHeading(target, anchor, options) {
|
|
@@ -536,12 +547,30 @@ function getMenu(target, anchor, options) {
|
|
|
536
547
|
return createDriverWith(modal === false ? nonModalMenuContract : menuContract, target, [locate], options);
|
|
537
548
|
}
|
|
538
549
|
//#endregion
|
|
550
|
+
//#region src/components/menubar.ts
|
|
551
|
+
/**
|
|
552
|
+
* A driver for the Menubar named `name`; `menu(item)` drives the menu of the bar item named
|
|
553
|
+
* `item` with the Menu driver's actions and queries. `modal: false` for a non-modal bar.
|
|
554
|
+
*/
|
|
555
|
+
function getMenubar(target, anchor, options) {
|
|
556
|
+
const { modal, ...locate } = anchor;
|
|
557
|
+
const bar = createDriverWith(menubarContract, target, [locate], options);
|
|
558
|
+
const menus = modal === false ? nonModalMenubarMenuContract : menubarMenuContract;
|
|
559
|
+
return Object.assign(bar, { menu: (item) => createDriverWith(menus, target, [{ name: item }], options) });
|
|
560
|
+
}
|
|
561
|
+
//#endregion
|
|
539
562
|
//#region src/components/meter.ts
|
|
540
563
|
/** A driver for the Meter named `name` (role `meter`). */
|
|
541
564
|
function getMeter(target, anchor, options) {
|
|
542
565
|
return createDriverWith(meterContract, target, [anchor], options);
|
|
543
566
|
}
|
|
544
567
|
//#endregion
|
|
568
|
+
//#region src/components/navigation-menu.ts
|
|
569
|
+
/** A driver for the Navigation Menu landmark named `name` ("Main" by default). */
|
|
570
|
+
function getNavigationMenu(target, anchor = { name: "Main" }, options) {
|
|
571
|
+
return createDriverWith(navigationMenuContract, target, [anchor], options);
|
|
572
|
+
}
|
|
573
|
+
//#endregion
|
|
545
574
|
//#region src/components/number-input.ts
|
|
546
575
|
/** A driver for the Number Input named `name` (`role: "textbox"` under the iOS quirk). */
|
|
547
576
|
function getNumberInput(target, anchor, options) {
|
|
@@ -579,6 +608,12 @@ function getProgress(target, anchor, options) {
|
|
|
579
608
|
return createDriverWith(progressContract, target, [anchor], options);
|
|
580
609
|
}
|
|
581
610
|
//#endregion
|
|
611
|
+
//#region src/components/prompt-input.ts
|
|
612
|
+
/** A driver for the Prompt Input whose Textarea is named `name`: type, submit, stop, attach, recall, queries. */
|
|
613
|
+
function getPromptInput(target, anchor, options) {
|
|
614
|
+
return createDriverWith(promptInputContract, target, [anchor], options);
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
582
617
|
//#region src/qr/decode.ts
|
|
583
618
|
var QrDecodeError = class extends Error {
|
|
584
619
|
name = "QrDecodeError";
|
|
@@ -2480,6 +2515,12 @@ function getRadioGroup(target, anchor, options) {
|
|
|
2480
2515
|
return createDriverWith(radioGroupContract, target, [anchor], options);
|
|
2481
2516
|
}
|
|
2482
2517
|
//#endregion
|
|
2518
|
+
//#region src/components/rating.ts
|
|
2519
|
+
/** A driver for the Rating whose accessible name (its Label) is `name`. */
|
|
2520
|
+
function getRating(target, anchor, options) {
|
|
2521
|
+
return createDriverWith(ratingContract, target, [anchor], options);
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2483
2524
|
//#region src/components/scroll-area.ts
|
|
2484
2525
|
/**
|
|
2485
2526
|
* A driver for a Scroll Area: the one whose Viewport is the region named `name`, or the one
|
|
@@ -2527,6 +2568,12 @@ function getSlider(target, anchor, options) {
|
|
|
2527
2568
|
return createDriverWith(sliderContract, target, [anchor], options);
|
|
2528
2569
|
}
|
|
2529
2570
|
//#endregion
|
|
2571
|
+
//#region src/components/splitter.ts
|
|
2572
|
+
/** A driver for the Splitter one of whose handles is named `name`. */
|
|
2573
|
+
function getSplitter(target, anchor, options) {
|
|
2574
|
+
return createDriverWith(splitterContract, target, [anchor], options);
|
|
2575
|
+
}
|
|
2576
|
+
//#endregion
|
|
2530
2577
|
//#region src/components/switch.ts
|
|
2531
2578
|
/** A driver for the Switch named `name`. */
|
|
2532
2579
|
function getSwitch(target, anchor, options) {
|
|
@@ -2539,6 +2586,12 @@ function getTabs(target, anchor, options) {
|
|
|
2539
2586
|
return createDriverWith(tabsContract, target, [anchor], options);
|
|
2540
2587
|
}
|
|
2541
2588
|
//#endregion
|
|
2589
|
+
//#region src/components/tag-group.ts
|
|
2590
|
+
/** A driver for the Tag Group named `name`: remove, act, choose, typeahead, queries. */
|
|
2591
|
+
function getTagGroup(target, anchor, options) {
|
|
2592
|
+
return createDriverWith(tagGroupContract, target, [anchor], options);
|
|
2593
|
+
}
|
|
2594
|
+
//#endregion
|
|
2542
2595
|
//#region src/components/tags-input.ts
|
|
2543
2596
|
/** A driver for the Tags Input named `name`: type, addTag, paste, editTag, removeTag, queries. */
|
|
2544
2597
|
function getTagsInput(target, anchor, options) {
|
|
@@ -2600,6 +2653,15 @@ function getTour(target, anchor, options) {
|
|
|
2600
2653
|
return createDriverWith(modal === true ? modalTourContract : tourContract, target, [locate], options);
|
|
2601
2654
|
}
|
|
2602
2655
|
//#endregion
|
|
2656
|
+
//#region src/components/tree-view.ts
|
|
2657
|
+
/**
|
|
2658
|
+
* A driver for the Tree View named `name`: expand, collapse, toggle, check, act, expand
|
|
2659
|
+
* siblings and all; items by accessible name or by a name path (`["src", "index.ts"]`).
|
|
2660
|
+
*/
|
|
2661
|
+
function getTreeView(target, anchor, options) {
|
|
2662
|
+
return createDriverWith(treeViewContract, target, [anchor], options);
|
|
2663
|
+
}
|
|
2664
|
+
//#endregion
|
|
2603
2665
|
//#region src/date-clock.ts
|
|
2604
2666
|
/** A clock frozen at `instant` (ISO, or epoch ms) in `timeZone` (default UTC). */
|
|
2605
2667
|
function fixedDateClock(instant, timeZone = "UTC") {
|
|
@@ -2610,6 +2672,64 @@ function fixedDateClock(instant, timeZone = "UTC") {
|
|
|
2610
2672
|
};
|
|
2611
2673
|
}
|
|
2612
2674
|
//#endregion
|
|
2675
|
+
//#region src/date-field-invariants.ts
|
|
2676
|
+
const ROOT$1 = "[data-scope=\"date-field\"][data-part=\"root\"]";
|
|
2677
|
+
const TABBABLE$1 = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]";
|
|
2678
|
+
/**
|
|
2679
|
+
* `changes` reads how often the page's `onValueChange` ran, `expectedChanges` the oracle's
|
|
2680
|
+
* (pass a counting `onValueChange` in the oracle's props).
|
|
2681
|
+
*/
|
|
2682
|
+
function dateFieldStepInvariants(options = {}) {
|
|
2683
|
+
return { invariants: [{
|
|
2684
|
+
name: "date-field-tab-stops-are-segments",
|
|
2685
|
+
check: async () => {
|
|
2686
|
+
const doc = globalThis.document;
|
|
2687
|
+
if (!doc) return void 0;
|
|
2688
|
+
for (const root of Array.from(doc.querySelectorAll(ROOT$1))) {
|
|
2689
|
+
const extra = Array.from(root.querySelectorAll(TABBABLE$1)).filter((el) => el.tabIndex >= 0 && !el.disabled).filter((el) => !el.hasAttribute("data-editable") && !["trigger", "clear-trigger"].includes(el.getAttribute("data-part") ?? ""));
|
|
2690
|
+
if (extra.length > 0) return `tab stops besides the segments: ${extra.map((el) => el.getAttribute("data-part") ?? el.tagName).join(", ")}`;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
}, {
|
|
2694
|
+
name: "date-field-change-count",
|
|
2695
|
+
check: async () => {
|
|
2696
|
+
if (!options.changes || !options.expectedChanges) return void 0;
|
|
2697
|
+
const [have, want] = [options.changes(), options.expectedChanges()];
|
|
2698
|
+
return have === want ? void 0 : `onValueChange ran ${have} times, the oracle ${want}`;
|
|
2699
|
+
}
|
|
2700
|
+
}] };
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* The range Date Field's change count (spec "Range Mode — Pair Invariants"): `onValueChange`
|
|
2704
|
+
* runs exactly as often as the derived value changed, read as the pair of hidden inputs
|
|
2705
|
+
* changing between steps. Call `reset()` in the model's setup.
|
|
2706
|
+
*/
|
|
2707
|
+
function dateRangeStepInvariants(options) {
|
|
2708
|
+
let last = "";
|
|
2709
|
+
let expected = 0;
|
|
2710
|
+
const pair = () => {
|
|
2711
|
+
const hidden = globalThis.document?.querySelectorAll("[data-scope=\"date-field\"][data-part=\"hidden-input\"]");
|
|
2712
|
+
return Array.from(hidden ?? [], (h) => h.value).join("|");
|
|
2713
|
+
};
|
|
2714
|
+
return {
|
|
2715
|
+
/** After the render: the pair it starts with is not a change. */
|
|
2716
|
+
reset: () => {
|
|
2717
|
+
last = pair();
|
|
2718
|
+
expected = 0;
|
|
2719
|
+
},
|
|
2720
|
+
invariants: [{
|
|
2721
|
+
name: "date-range-change-count",
|
|
2722
|
+
check: async () => {
|
|
2723
|
+
const now = pair();
|
|
2724
|
+
if (now !== last) expected++;
|
|
2725
|
+
last = now;
|
|
2726
|
+
const have = options.changes();
|
|
2727
|
+
return have === expected ? void 0 : `onValueChange ran ${have} times, the derived value changed ${expected} times`;
|
|
2728
|
+
}
|
|
2729
|
+
}]
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
//#endregion
|
|
2613
2733
|
//#region src/delay-group.ts
|
|
2614
2734
|
/** A delay group without timers: warm while a member is open or after `setWarm(true)`. */
|
|
2615
2735
|
function fakeDelayGroup() {
|
|
@@ -2677,6 +2797,36 @@ function fakeHoverIntent() {
|
|
|
2677
2797
|
};
|
|
2678
2798
|
}
|
|
2679
2799
|
//#endregion
|
|
2800
|
+
//#region src/fake-clipboard.ts
|
|
2801
|
+
function fakeClipboard(options = {}) {
|
|
2802
|
+
let mode = options.mode ?? "succeed";
|
|
2803
|
+
const log = [];
|
|
2804
|
+
const copied = [];
|
|
2805
|
+
const settle = (text, m) => {
|
|
2806
|
+
if (m === "succeed") {
|
|
2807
|
+
copied.push(text);
|
|
2808
|
+
return Promise.resolve();
|
|
2809
|
+
}
|
|
2810
|
+
return Promise.reject(/* @__PURE__ */ new Error(m === "absent" ? "No clipboard" : "Write rejected"));
|
|
2811
|
+
};
|
|
2812
|
+
return {
|
|
2813
|
+
log,
|
|
2814
|
+
copied,
|
|
2815
|
+
set: (next) => {
|
|
2816
|
+
mode = next;
|
|
2817
|
+
},
|
|
2818
|
+
writeText(text) {
|
|
2819
|
+
log.push(text);
|
|
2820
|
+
const m = mode;
|
|
2821
|
+
const { scheduler } = options;
|
|
2822
|
+
if (!scheduler) return settle(text, m);
|
|
2823
|
+
return new Promise((resolve, reject) => {
|
|
2824
|
+
scheduler.setTimeout(() => settle(text, m).then(resolve, reject), options.latency ?? 10);
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
//#endregion
|
|
2680
2830
|
//#region src/fake-visibility.ts
|
|
2681
2831
|
function fakeVisibility(initiallyHidden = false) {
|
|
2682
2832
|
let hidden = initiallyHidden;
|
|
@@ -2771,10 +2921,13 @@ function toGraph(machine) {
|
|
|
2771
2921
|
for (const [delay, t] of Object.entries(sd.after ?? {})) add(state, `after:${delay}`, t);
|
|
2772
2922
|
for (const [key, ctl] of Object.entries(def.values ?? {})) for (const target of Object.keys(ctl.states ?? {})) if (target !== state) add(state, `$sync:${key}`, target);
|
|
2773
2923
|
}
|
|
2774
|
-
for (const [prop,
|
|
2775
|
-
|
|
2776
|
-
event
|
|
2777
|
-
|
|
2924
|
+
for (const [prop, entry] of Object.entries(def.onProps ?? {})) {
|
|
2925
|
+
const event = typeof entry === "string" ? entry : entry.event;
|
|
2926
|
+
for (const edge of edges.filter((e) => e.event === event)) edges.push({
|
|
2927
|
+
...edge,
|
|
2928
|
+
event: `$props:${prop}`
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2778
2931
|
return {
|
|
2779
2932
|
id: def.id,
|
|
2780
2933
|
initial: def.initial,
|
|
@@ -3256,6 +3409,7 @@ const traitInvariants = {
|
|
|
3256
3409
|
const stops = list.filter((el) => el.attrs["tabindex"] === "0").length;
|
|
3257
3410
|
const container = f.after.parts.some((p) => p.part !== itemPart(f) && p.attrs["tabindex"] === "0");
|
|
3258
3411
|
const out = list.length > 0 && stops !== 1 && !(stops === 0 && container) ? [`${stops} items have tabindex="0"; expected exactly 1`] : [];
|
|
3412
|
+
for (const el of list) if (el.focusableInside) out.push(`${el.describe} contains a focusable descendant; the roving tab stop is the cell`);
|
|
3259
3413
|
if (f.before?.focus.inInstance && f.after.focus.onBody) out.push("focus fell to <body> after the step (the focused item was removed?)");
|
|
3260
3414
|
return [...out, ...highlightChecks(f)];
|
|
3261
3415
|
},
|
|
@@ -3295,7 +3449,11 @@ const traitInvariants = {
|
|
|
3295
3449
|
const value = f.values["value"];
|
|
3296
3450
|
if (value !== void 0 && value !== "all" && list.every((el) => itemValue(el) !== void 0)) {
|
|
3297
3451
|
const rendered = new Set(list.map((el) => itemValue(el)));
|
|
3298
|
-
const
|
|
3452
|
+
const range = value !== null && typeof value === "object" && "start" in value && "end" in value ? {
|
|
3453
|
+
lo: String(value.start),
|
|
3454
|
+
hi: String(value.end)
|
|
3455
|
+
} : null;
|
|
3456
|
+
const want = range ? new Set(list.filter((el) => !isTrue(el.attrs["aria-disabled"])).map((el) => itemValue(el) ?? "").filter((v) => v >= range.lo.slice(0, v.length) && v <= range.hi.slice(0, v.length))) : new Set((Array.isArray(value) ? value : [value]).map(String).filter((v) => rendered.has(v)));
|
|
3299
3457
|
const have = new Set(selected.map((el) => itemValue(el) ?? ""));
|
|
3300
3458
|
if (want.size !== have.size || [...want].some((v) => !have.has(v))) out.push(`selected items [${[...have].join(", ")}] differ from the machine's value [${[...want].join(", ")}]`);
|
|
3301
3459
|
}
|
|
@@ -3541,7 +3699,10 @@ function expectations(contract, state, view) {
|
|
|
3541
3699
|
/** The event type the oracle processes for an edge (`$props:x` → the declared event). */
|
|
3542
3700
|
function stepEvent(machine, edge) {
|
|
3543
3701
|
if (edge.event.startsWith("$sync:")) return "$sync";
|
|
3544
|
-
if (edge.event.startsWith("$props:"))
|
|
3702
|
+
if (edge.event.startsWith("$props:")) {
|
|
3703
|
+
const entry = machine.def.onProps?.[edge.event.slice(7)];
|
|
3704
|
+
return entry === void 0 ? edge.event : typeof entry === "string" ? entry : entry.event;
|
|
3705
|
+
}
|
|
3545
3706
|
return edge.event;
|
|
3546
3707
|
}
|
|
3547
3708
|
/** Whether the oracle's step log shows that this edge was taken. */
|
|
@@ -3587,6 +3748,11 @@ const oracleEnv = {
|
|
|
3587
3748
|
track: () => ({ stop: () => {} }),
|
|
3588
3749
|
reposition: () => {}
|
|
3589
3750
|
},
|
|
3751
|
+
hoverIntent: {
|
|
3752
|
+
isInTransit: () => false,
|
|
3753
|
+
track: () => () => {},
|
|
3754
|
+
triggerProps: () => ({})
|
|
3755
|
+
},
|
|
3590
3756
|
menuTree: {
|
|
3591
3757
|
register: () => () => {},
|
|
3592
3758
|
openChild: () => {},
|
|
@@ -4702,4 +4868,30 @@ function liveAnnouncements(log) {
|
|
|
4702
4868
|
});
|
|
4703
4869
|
}
|
|
4704
4870
|
//#endregion
|
|
4705
|
-
|
|
4871
|
+
//#region src/warning-guard.ts
|
|
4872
|
+
const KEY = Symbol.for("rind-ui.warning-guard");
|
|
4873
|
+
function state() {
|
|
4874
|
+
const g = globalThis;
|
|
4875
|
+
g[KEY] ??= {
|
|
4876
|
+
seen: [],
|
|
4877
|
+
expected: [],
|
|
4878
|
+
allowed: []
|
|
4879
|
+
};
|
|
4880
|
+
return g[KEY];
|
|
4881
|
+
}
|
|
4882
|
+
/**
|
|
4883
|
+
* Declares that the current test logs a `[rind-ui]` warning or error matching `pattern`:
|
|
4884
|
+
* the guard does not fail the test for it, and fails it if no such message was logged.
|
|
4885
|
+
*/
|
|
4886
|
+
function expectRindWarning(pattern) {
|
|
4887
|
+
state().expected.push(pattern);
|
|
4888
|
+
}
|
|
4889
|
+
/**
|
|
4890
|
+
* Lets the current test log a `[rind-ui]` message matching `pattern` without requiring it: for
|
|
4891
|
+
* a file whose shared fixture logs it in some tests (call it in `beforeEach`).
|
|
4892
|
+
*/
|
|
4893
|
+
function allowRindWarning(pattern) {
|
|
4894
|
+
state().allowed.push(pattern);
|
|
4895
|
+
}
|
|
4896
|
+
//#endregion
|
|
4897
|
+
export { QrDecodeError, accordionStepInvariants, allowRindWarning, checkGeneric, checkboxStepInvariants, correctBlock, createDriver, createDriverWith, currentRun, dateFieldStepInvariants, dateRangeStepInvariants, decodeQr, domEnv, englishLeaks, expectRindWarning, fakeClipboard, fakeDelayGroup, fakeHoverIntent, fakePositioning, fakeRouter, fakeVisibility, fixedDateClock, formStepInvariants, genericInvariants, getAccordion, getAlert, getAvatar, getBadge, getBreadcrumbs, getButton, getCalendar, getCheckbox, getCheckboxGroup, getCodeBlock, getCollapsible, getColorPicker, getCombobox, getContextMenu, getDateField, getDialog, getDrawer, getField, getFieldset, getForm, getGridList, getHeading, getHoverCard, getImage, getLabel, getLink, getListbox, getMenu, getMenubar, getMeter, getNavigationMenu, getNumberInput, getPagination, getPinInput, getPopover, getProgress, getPromptInput, getQrCode, getRadioGroup, getRating, getScrollArea, getSegmentedControl, getSelect, getSeparator, getSkeleton, getSlider, getSplitter, getSwitch, getTabs, getTagGroup, getTagsInput, getTextField, getToast, getToaster, getToggle, getToggleGroup, getToolbar, getTooltip, getTour, getTreeView, installAnnouncementLog, interceptNativeNavigation, layoutInvariant, liveAnnouncements, machinePaths, missingAriaLines, missingStateStories, navigationLog, numberInputStepInvariants, parseQrPath, paths, platforms, playwrightEnv, pseudo, pseudoMessages, qrCodeDecodingContract, recordingAnnouncer, runAction, sliderStepInvariants, spokenLog, switchStepInvariants, testMachine, textFieldKeyStepInvariants, textFieldStepInvariants, toGraph, traitInvariants, uncovered, virtualClock, withEngine };
|