@rind-ui/testing 0.3.0 → 0.5.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-BcAjuBjR.d.mts} +4 -0
- package/dist/{compose-BpR_PG11.mjs → compose-m76ER6GL.mjs} +1 -1
- package/dist/{dom-Ur_VPlTe.d.mts → dom-BLTLsBAu.d.mts} +1 -2
- package/dist/{dom-Bnnr_fg-.mjs → dom-D9Da5Fku.mjs} +147 -5
- package/dist/dom.d.mts +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/index.d.mts +5221 -1093
- package/dist/index.mjs +306 -27
- package/dist/inpage.iife.js +1 -7
- package/dist/{playwright-By15MZsN.d.mts → playwright-CnXZVExy.d.mts} +1 -1
- package/dist/{playwright-C3Ue38p3.mjs → playwright-D79Husn_.mjs} +93 -16
- 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-D9Da5Fku.mjs";
|
|
3
|
+
import { n as playwrightEnv, r as watchPageErrors, t as isPage } from "./playwright-D79Husn_.mjs";
|
|
4
|
+
import { accordionContract, alertContract, alertDialogRoleContract, avatarContract, badgeContract, breadcrumbsContract, buttonContract, calendarContract, checkboxContract, checkboxGroupContract, clipboardContract, codeBlockContract, collapsibleContract, colorPickerContract, comboboxContract, contextMenuContract, createService, dateFieldContract, dateRangeFieldContract, dialogContract, drawerContract, fieldContract, fieldsetContract, fileUploadContract, formContract, gridListContract, headingContract, hoverCardContract, imageContract, imageCropperContract, imageViewerContract, inlineComboboxContract, kbdContract, labelContract, linkContract, listboxContract, marqueeContract, menuContract, menubarContract, menubarMenuContract, messageThreadContract, meterContract, modalPopoverContract, modalTourContract, navigationMenuContract, nonModalContextMenuContract, nonModalDialogContract, nonModalDrawerContract, nonModalMenuContract, nonModalMenubarMenuContract, numberInputContract, paginationContract, pinInputContract, platforms, platforms as platforms$1, popoverContract, progressContract, promptInputContract, qrCodeContractWith, quirkActive, radioGroupContract, ratingContract, reasoningContract, scrollAreaContract, segmentedControlContract, selectContract, separatorContract, separatorContractFor, skeletonContract, sliderContract, sortableContract, splitterContract, stepperContract, streamingMessageContract, switchContract, tableContract, tableOfContentsContract, tabsContract, tagGroupContract, tagsInputContract, textFieldContract, timelineContract, 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,18 @@ function getCheckboxGroup(target, anchor, options) {
|
|
|
338
329
|
return createDriverWith(checkboxGroupContract, target, [anchor], options);
|
|
339
330
|
}
|
|
340
331
|
//#endregion
|
|
332
|
+
//#region src/components/clipboard.ts
|
|
333
|
+
/** A driver for the Clipboard labelled `label`, or the only one in `target`. */
|
|
334
|
+
function getClipboard(target, anchor, options) {
|
|
335
|
+
return createDriverWith(clipboardContract, target, anchor ? [anchor] : [], options);
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/components/code-block.ts
|
|
339
|
+
/** A driver for the Code Block titled `title`, or the only one in `target`. */
|
|
340
|
+
function getCodeBlock(target, anchor, options) {
|
|
341
|
+
return createDriverWith(codeBlockContract, target, anchor ? [anchor] : [], options);
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
341
344
|
//#region src/components/collapsible.ts
|
|
342
345
|
/** A driver for the Collapsible whose trigger is named `name`. */
|
|
343
346
|
function getCollapsible(target, anchor, options) {
|
|
@@ -426,9 +429,9 @@ function getColorPicker(target, anchor, options) {
|
|
|
426
429
|
}
|
|
427
430
|
//#endregion
|
|
428
431
|
//#region src/components/combobox.ts
|
|
429
|
-
/** A driver for the Combobox named `name`: type, compose, open, choose, clear, queries. */
|
|
430
432
|
function getCombobox(target, anchor, options) {
|
|
431
|
-
|
|
433
|
+
const { inline, ...rest } = options ?? {};
|
|
434
|
+
return inline ? createDriverWith(inlineComboboxContract, target, [anchor], rest) : createDriverWith(comboboxContract, target, [anchor], rest);
|
|
432
435
|
}
|
|
433
436
|
//#endregion
|
|
434
437
|
//#region src/components/context-menu.ts
|
|
@@ -441,14 +444,22 @@ function getContextMenu(target, anchor, options) {
|
|
|
441
444
|
return createDriverWith(modal === false ? nonModalContextMenuContract : contextMenuContract, target, [locate], options);
|
|
442
445
|
}
|
|
443
446
|
//#endregion
|
|
447
|
+
//#region src/components/date-field.ts
|
|
448
|
+
function getDateField(target, anchor, options) {
|
|
449
|
+
const { selectionMode, ...locate } = anchor;
|
|
450
|
+
return selectionMode === "range" ? createDriverWith(dateRangeFieldContract, target, [locate], options) : createDriverWith(dateFieldContract, target, [locate], options);
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
444
453
|
//#region src/components/dialog.ts
|
|
445
454
|
/**
|
|
446
455
|
* 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
|
|
456
|
+
* `name`: a closed dialog has no content to find). `modal: false` for a non-modal dialog;
|
|
457
|
+
* `role: "alertdialog"` for a confirmation (an outside press leaves it open; `cancel()` and
|
|
458
|
+
* `confirm(name?)` press its buttons).
|
|
448
459
|
*/
|
|
449
460
|
function getDialog(target, anchor, options) {
|
|
450
|
-
const { modal, ...locate } = anchor;
|
|
451
|
-
return createDriverWith(modal === false ? nonModalDialogContract : dialogContract, target, [locate], options);
|
|
461
|
+
const { modal, role, ...locate } = anchor;
|
|
462
|
+
return createDriverWith(role === "alertdialog" ? alertDialogRoleContract : modal === false ? nonModalDialogContract : dialogContract, target, [locate], options);
|
|
452
463
|
}
|
|
453
464
|
//#endregion
|
|
454
465
|
//#region src/components/drawer.ts
|
|
@@ -479,12 +490,24 @@ function getFieldset(target, anchor, options) {
|
|
|
479
490
|
return createDriverWith(fieldsetContract, target, [anchor], options);
|
|
480
491
|
}
|
|
481
492
|
//#endregion
|
|
493
|
+
//#region src/components/file-upload.ts
|
|
494
|
+
/** A driver for the File Upload whose Trigger is named `name`, or the only one in `target`. */
|
|
495
|
+
function getFileUpload(target, anchor, options) {
|
|
496
|
+
return createDriverWith(fileUploadContract, target, anchor ? [anchor] : [], options);
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
482
499
|
//#region src/components/form.ts
|
|
483
500
|
/** A driver for the Form named `name`: `submit`, `reset`, `validate`, and its queries. */
|
|
484
501
|
function getForm(target, anchor, options) {
|
|
485
502
|
return createDriverWith(formContract, target, [anchor], options);
|
|
486
503
|
}
|
|
487
504
|
//#endregion
|
|
505
|
+
//#region src/components/grid-list.ts
|
|
506
|
+
/** A driver for the Grid List named `name`: act, check, controls, choose, typeahead, queries. */
|
|
507
|
+
function getGridList(target, anchor, options) {
|
|
508
|
+
return createDriverWith(gridListContract, target, [anchor], options);
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
488
511
|
//#region src/components/heading.ts
|
|
489
512
|
/** A driver for the heading named `name`: `level()`. */
|
|
490
513
|
function getHeading(target, anchor, options) {
|
|
@@ -508,6 +531,24 @@ function getImage(target, anchor = {}, options) {
|
|
|
508
531
|
return createDriverWith(imageContract, within ?? target, [name === void 0 ? {} : { name }], options);
|
|
509
532
|
}
|
|
510
533
|
//#endregion
|
|
534
|
+
//#region src/components/image-cropper.ts
|
|
535
|
+
/** A driver for the Image Cropper named `name`, or the only one in `target`. */
|
|
536
|
+
function getImageCropper(target, anchor, options) {
|
|
537
|
+
return createDriverWith(imageCropperContract, target, anchor ? [anchor] : [], options);
|
|
538
|
+
}
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region src/components/image-viewer.ts
|
|
541
|
+
/** A driver for the Image Viewer named `name` (its image's alt), or the only one in `target`. */
|
|
542
|
+
function getImageViewer(target, anchor, options) {
|
|
543
|
+
return createDriverWith(imageViewerContract, target, anchor ? [anchor] : [], options);
|
|
544
|
+
}
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/components/kbd.ts
|
|
547
|
+
/** A driver for the Kbd whose text matches `text`, or the only one in `target`. */
|
|
548
|
+
function getKbd(target, anchor = {}, options) {
|
|
549
|
+
return createDriverWith(kbdContract, target, [anchor], options);
|
|
550
|
+
}
|
|
551
|
+
//#endregion
|
|
511
552
|
//#region src/components/label.ts
|
|
512
553
|
/** A driver for the Label with exactly this text: `click`, `doubleClick` and queries. */
|
|
513
554
|
function getLabel(target, anchor, options) {
|
|
@@ -526,6 +567,12 @@ function getListbox(target, anchor, options) {
|
|
|
526
567
|
return createDriverWith(listboxContract, target, [anchor], options);
|
|
527
568
|
}
|
|
528
569
|
//#endregion
|
|
570
|
+
//#region src/components/marquee.ts
|
|
571
|
+
/** A driver for the Marquee named `name` (role `region` unless given), or the only one. */
|
|
572
|
+
function getMarquee(target, anchor, options) {
|
|
573
|
+
return createDriverWith(marqueeContract, target, anchor ? [anchor] : [], options);
|
|
574
|
+
}
|
|
575
|
+
//#endregion
|
|
529
576
|
//#region src/components/menu.ts
|
|
530
577
|
/**
|
|
531
578
|
* A driver for the Menu opened by the trigger named `name` (a closed menu has no content
|
|
@@ -536,12 +583,36 @@ function getMenu(target, anchor, options) {
|
|
|
536
583
|
return createDriverWith(modal === false ? nonModalMenuContract : menuContract, target, [locate], options);
|
|
537
584
|
}
|
|
538
585
|
//#endregion
|
|
586
|
+
//#region src/components/menubar.ts
|
|
587
|
+
/**
|
|
588
|
+
* A driver for the Menubar named `name`; `menu(item)` drives the menu of the bar item named
|
|
589
|
+
* `item` with the Menu driver's actions and queries. `modal: false` for a non-modal bar.
|
|
590
|
+
*/
|
|
591
|
+
function getMenubar(target, anchor, options) {
|
|
592
|
+
const { modal, ...locate } = anchor;
|
|
593
|
+
const bar = createDriverWith(menubarContract, target, [locate], options);
|
|
594
|
+
const menus = modal === false ? nonModalMenubarMenuContract : menubarMenuContract;
|
|
595
|
+
return Object.assign(bar, { menu: (item) => createDriverWith(menus, target, [{ name: item }], options) });
|
|
596
|
+
}
|
|
597
|
+
//#endregion
|
|
598
|
+
//#region src/components/message-thread.ts
|
|
599
|
+
/** A driver for the Message Thread whose feed is named `name`, or the only one in `target`. */
|
|
600
|
+
function getMessageThread(target, anchor, options) {
|
|
601
|
+
return createDriverWith(messageThreadContract, target, anchor ? [anchor] : [], options);
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
539
604
|
//#region src/components/meter.ts
|
|
540
605
|
/** A driver for the Meter named `name` (role `meter`). */
|
|
541
606
|
function getMeter(target, anchor, options) {
|
|
542
607
|
return createDriverWith(meterContract, target, [anchor], options);
|
|
543
608
|
}
|
|
544
609
|
//#endregion
|
|
610
|
+
//#region src/components/navigation-menu.ts
|
|
611
|
+
/** A driver for the Navigation Menu landmark named `name` ("Main" by default). */
|
|
612
|
+
function getNavigationMenu(target, anchor = { name: "Main" }, options) {
|
|
613
|
+
return createDriverWith(navigationMenuContract, target, [anchor], options);
|
|
614
|
+
}
|
|
615
|
+
//#endregion
|
|
545
616
|
//#region src/components/number-input.ts
|
|
546
617
|
/** A driver for the Number Input named `name` (`role: "textbox"` under the iOS quirk). */
|
|
547
618
|
function getNumberInput(target, anchor, options) {
|
|
@@ -579,6 +650,12 @@ function getProgress(target, anchor, options) {
|
|
|
579
650
|
return createDriverWith(progressContract, target, [anchor], options);
|
|
580
651
|
}
|
|
581
652
|
//#endregion
|
|
653
|
+
//#region src/components/prompt-input.ts
|
|
654
|
+
/** A driver for the Prompt Input whose Textarea is named `name`: type, submit, stop, attach, recall, queries. */
|
|
655
|
+
function getPromptInput(target, anchor, options) {
|
|
656
|
+
return createDriverWith(promptInputContract, target, [anchor], options);
|
|
657
|
+
}
|
|
658
|
+
//#endregion
|
|
582
659
|
//#region src/qr/decode.ts
|
|
583
660
|
var QrDecodeError = class extends Error {
|
|
584
661
|
name = "QrDecodeError";
|
|
@@ -2480,6 +2557,18 @@ function getRadioGroup(target, anchor, options) {
|
|
|
2480
2557
|
return createDriverWith(radioGroupContract, target, [anchor], options);
|
|
2481
2558
|
}
|
|
2482
2559
|
//#endregion
|
|
2560
|
+
//#region src/components/rating.ts
|
|
2561
|
+
/** A driver for the Rating whose accessible name (its Label) is `name`. */
|
|
2562
|
+
function getRating(target, anchor, options) {
|
|
2563
|
+
return createDriverWith(ratingContract, target, [anchor], options);
|
|
2564
|
+
}
|
|
2565
|
+
//#endregion
|
|
2566
|
+
//#region src/components/reasoning.ts
|
|
2567
|
+
/** A driver for the Reasoning whose Trigger is named `name`, or the only one in `target`. */
|
|
2568
|
+
function getReasoning(target, anchor, options) {
|
|
2569
|
+
return createDriverWith(reasoningContract, target, anchor ? [anchor] : [], options);
|
|
2570
|
+
}
|
|
2571
|
+
//#endregion
|
|
2483
2572
|
//#region src/components/scroll-area.ts
|
|
2484
2573
|
/**
|
|
2485
2574
|
* A driver for a Scroll Area: the one whose Viewport is the region named `name`, or the one
|
|
@@ -2527,18 +2616,60 @@ function getSlider(target, anchor, options) {
|
|
|
2527
2616
|
return createDriverWith(sliderContract, target, [anchor], options);
|
|
2528
2617
|
}
|
|
2529
2618
|
//#endregion
|
|
2619
|
+
//#region src/components/sortable.ts
|
|
2620
|
+
/** A driver for the Sortable list named `name`, or the only one in `target`. */
|
|
2621
|
+
function getSortable(target, anchor, options) {
|
|
2622
|
+
return createDriverWith(sortableContract, target, anchor ? [anchor] : [], options);
|
|
2623
|
+
}
|
|
2624
|
+
//#endregion
|
|
2625
|
+
//#region src/components/splitter.ts
|
|
2626
|
+
/** A driver for the Splitter one of whose handles is named `name`. */
|
|
2627
|
+
function getSplitter(target, anchor, options) {
|
|
2628
|
+
return createDriverWith(splitterContract, target, [anchor], options);
|
|
2629
|
+
}
|
|
2630
|
+
//#endregion
|
|
2631
|
+
//#region src/components/stepper.ts
|
|
2632
|
+
/** A driver for the Stepper named `name`, or the only one in `target`. */
|
|
2633
|
+
function getStepper(target, anchor, options) {
|
|
2634
|
+
return createDriverWith(stepperContract, target, anchor ? [anchor] : [], options);
|
|
2635
|
+
}
|
|
2636
|
+
//#endregion
|
|
2637
|
+
//#region src/components/streaming-message.ts
|
|
2638
|
+
/** A driver for the Streaming Message named `name` (role `article` unless given), or the only one. */
|
|
2639
|
+
function getStreamingMessage(target, anchor, options) {
|
|
2640
|
+
return createDriverWith(streamingMessageContract, target, anchor ? [anchor] : [], options);
|
|
2641
|
+
}
|
|
2642
|
+
//#endregion
|
|
2530
2643
|
//#region src/components/switch.ts
|
|
2531
2644
|
/** A driver for the Switch named `name`. */
|
|
2532
2645
|
function getSwitch(target, anchor, options) {
|
|
2533
2646
|
return createDriverWith(switchContract, target, [anchor], options);
|
|
2534
2647
|
}
|
|
2535
2648
|
//#endregion
|
|
2649
|
+
//#region src/components/table.ts
|
|
2650
|
+
/** A driver for the Table named `name`, or the only one in `target`. */
|
|
2651
|
+
function getTable(target, anchor, options) {
|
|
2652
|
+
return createDriverWith(tableContract, target, anchor ? [anchor] : [], options);
|
|
2653
|
+
}
|
|
2654
|
+
//#endregion
|
|
2655
|
+
//#region src/components/table-of-contents.ts
|
|
2656
|
+
/** A driver for the Table of Contents named `name`, or the only one in `target`. */
|
|
2657
|
+
function getTableOfContents(target, anchor, options) {
|
|
2658
|
+
return createDriverWith(tableOfContentsContract, target, anchor ? [anchor] : [], options);
|
|
2659
|
+
}
|
|
2660
|
+
//#endregion
|
|
2536
2661
|
//#region src/components/tabs.ts
|
|
2537
2662
|
/** A driver for the Tabs (tab list) named `name`. */
|
|
2538
2663
|
function getTabs(target, anchor, options) {
|
|
2539
2664
|
return createDriverWith(tabsContract, target, [anchor], options);
|
|
2540
2665
|
}
|
|
2541
2666
|
//#endregion
|
|
2667
|
+
//#region src/components/tag-group.ts
|
|
2668
|
+
/** A driver for the Tag Group named `name`: remove, act, choose, typeahead, queries. */
|
|
2669
|
+
function getTagGroup(target, anchor, options) {
|
|
2670
|
+
return createDriverWith(tagGroupContract, target, [anchor], options);
|
|
2671
|
+
}
|
|
2672
|
+
//#endregion
|
|
2542
2673
|
//#region src/components/tags-input.ts
|
|
2543
2674
|
/** A driver for the Tags Input named `name`: type, addTag, paste, editTag, removeTag, queries. */
|
|
2544
2675
|
function getTagsInput(target, anchor, options) {
|
|
@@ -2551,6 +2682,12 @@ function getTextField(target, anchor, options) {
|
|
|
2551
2682
|
return createDriverWith(textFieldContract, target, [anchor], options);
|
|
2552
2683
|
}
|
|
2553
2684
|
//#endregion
|
|
2685
|
+
//#region src/components/timeline.ts
|
|
2686
|
+
/** A driver for the Timeline named `name`, or the only one in `target`. */
|
|
2687
|
+
function getTimeline(target, anchor = {}, options) {
|
|
2688
|
+
return createDriverWith(timelineContract, target, [anchor], options);
|
|
2689
|
+
}
|
|
2690
|
+
//#endregion
|
|
2554
2691
|
//#region src/components/toast.ts
|
|
2555
2692
|
/** A driver for the toaster region named `name` ("Notifications (F6)"): enter, leave, queries. */
|
|
2556
2693
|
function getToaster(target, anchor, options) {
|
|
@@ -2600,6 +2737,15 @@ function getTour(target, anchor, options) {
|
|
|
2600
2737
|
return createDriverWith(modal === true ? modalTourContract : tourContract, target, [locate], options);
|
|
2601
2738
|
}
|
|
2602
2739
|
//#endregion
|
|
2740
|
+
//#region src/components/tree-view.ts
|
|
2741
|
+
/**
|
|
2742
|
+
* A driver for the Tree View named `name`: expand, collapse, toggle, check, act, expand
|
|
2743
|
+
* siblings and all; items by accessible name or by a name path (`["src", "index.ts"]`).
|
|
2744
|
+
*/
|
|
2745
|
+
function getTreeView(target, anchor, options) {
|
|
2746
|
+
return createDriverWith(treeViewContract, target, [anchor], options);
|
|
2747
|
+
}
|
|
2748
|
+
//#endregion
|
|
2603
2749
|
//#region src/date-clock.ts
|
|
2604
2750
|
/** A clock frozen at `instant` (ISO, or epoch ms) in `timeZone` (default UTC). */
|
|
2605
2751
|
function fixedDateClock(instant, timeZone = "UTC") {
|
|
@@ -2610,6 +2756,64 @@ function fixedDateClock(instant, timeZone = "UTC") {
|
|
|
2610
2756
|
};
|
|
2611
2757
|
}
|
|
2612
2758
|
//#endregion
|
|
2759
|
+
//#region src/date-field-invariants.ts
|
|
2760
|
+
const ROOT$1 = "[data-scope=\"date-field\"][data-part=\"root\"]";
|
|
2761
|
+
const TABBABLE$1 = "a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]";
|
|
2762
|
+
/**
|
|
2763
|
+
* `changes` reads how often the page's `onValueChange` ran, `expectedChanges` the oracle's
|
|
2764
|
+
* (pass a counting `onValueChange` in the oracle's props).
|
|
2765
|
+
*/
|
|
2766
|
+
function dateFieldStepInvariants(options = {}) {
|
|
2767
|
+
return { invariants: [{
|
|
2768
|
+
name: "date-field-tab-stops-are-segments",
|
|
2769
|
+
check: async () => {
|
|
2770
|
+
const doc = globalThis.document;
|
|
2771
|
+
if (!doc) return void 0;
|
|
2772
|
+
for (const root of Array.from(doc.querySelectorAll(ROOT$1))) {
|
|
2773
|
+
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") ?? ""));
|
|
2774
|
+
if (extra.length > 0) return `tab stops besides the segments: ${extra.map((el) => el.getAttribute("data-part") ?? el.tagName).join(", ")}`;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
}, {
|
|
2778
|
+
name: "date-field-change-count",
|
|
2779
|
+
check: async () => {
|
|
2780
|
+
if (!options.changes || !options.expectedChanges) return void 0;
|
|
2781
|
+
const [have, want] = [options.changes(), options.expectedChanges()];
|
|
2782
|
+
return have === want ? void 0 : `onValueChange ran ${have} times, the oracle ${want}`;
|
|
2783
|
+
}
|
|
2784
|
+
}] };
|
|
2785
|
+
}
|
|
2786
|
+
/**
|
|
2787
|
+
* The range Date Field's change count (spec "Range Mode — Pair Invariants"): `onValueChange`
|
|
2788
|
+
* runs exactly as often as the derived value changed, read as the pair of hidden inputs
|
|
2789
|
+
* changing between steps. Call `reset()` in the model's setup.
|
|
2790
|
+
*/
|
|
2791
|
+
function dateRangeStepInvariants(options) {
|
|
2792
|
+
let last = "";
|
|
2793
|
+
let expected = 0;
|
|
2794
|
+
const pair = () => {
|
|
2795
|
+
const hidden = globalThis.document?.querySelectorAll("[data-scope=\"date-field\"][data-part=\"hidden-input\"]");
|
|
2796
|
+
return Array.from(hidden ?? [], (h) => h.value).join("|");
|
|
2797
|
+
};
|
|
2798
|
+
return {
|
|
2799
|
+
/** After the render: the pair it starts with is not a change. */
|
|
2800
|
+
reset: () => {
|
|
2801
|
+
last = pair();
|
|
2802
|
+
expected = 0;
|
|
2803
|
+
},
|
|
2804
|
+
invariants: [{
|
|
2805
|
+
name: "date-range-change-count",
|
|
2806
|
+
check: async () => {
|
|
2807
|
+
const now = pair();
|
|
2808
|
+
if (now !== last) expected++;
|
|
2809
|
+
last = now;
|
|
2810
|
+
const have = options.changes();
|
|
2811
|
+
return have === expected ? void 0 : `onValueChange ran ${have} times, the derived value changed ${expected} times`;
|
|
2812
|
+
}
|
|
2813
|
+
}]
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
//#endregion
|
|
2613
2817
|
//#region src/delay-group.ts
|
|
2614
2818
|
/** A delay group without timers: warm while a member is open or after `setWarm(true)`. */
|
|
2615
2819
|
function fakeDelayGroup() {
|
|
@@ -2677,6 +2881,36 @@ function fakeHoverIntent() {
|
|
|
2677
2881
|
};
|
|
2678
2882
|
}
|
|
2679
2883
|
//#endregion
|
|
2884
|
+
//#region src/fake-clipboard.ts
|
|
2885
|
+
function fakeClipboard(options = {}) {
|
|
2886
|
+
let mode = options.mode ?? "succeed";
|
|
2887
|
+
const log = [];
|
|
2888
|
+
const copied = [];
|
|
2889
|
+
const settle = (text, m) => {
|
|
2890
|
+
if (m === "succeed") {
|
|
2891
|
+
copied.push(text);
|
|
2892
|
+
return Promise.resolve();
|
|
2893
|
+
}
|
|
2894
|
+
return Promise.reject(/* @__PURE__ */ new Error(m === "absent" ? "No clipboard" : "Write rejected"));
|
|
2895
|
+
};
|
|
2896
|
+
return {
|
|
2897
|
+
log,
|
|
2898
|
+
copied,
|
|
2899
|
+
set: (next) => {
|
|
2900
|
+
mode = next;
|
|
2901
|
+
},
|
|
2902
|
+
writeText(text) {
|
|
2903
|
+
log.push(text);
|
|
2904
|
+
const m = mode;
|
|
2905
|
+
const { scheduler } = options;
|
|
2906
|
+
if (!scheduler) return settle(text, m);
|
|
2907
|
+
return new Promise((resolve, reject) => {
|
|
2908
|
+
scheduler.setTimeout(() => settle(text, m).then(resolve, reject), options.latency ?? 10);
|
|
2909
|
+
});
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
//#endregion
|
|
2680
2914
|
//#region src/fake-visibility.ts
|
|
2681
2915
|
function fakeVisibility(initiallyHidden = false) {
|
|
2682
2916
|
let hidden = initiallyHidden;
|
|
@@ -2771,10 +3005,13 @@ function toGraph(machine) {
|
|
|
2771
3005
|
for (const [delay, t] of Object.entries(sd.after ?? {})) add(state, `after:${delay}`, t);
|
|
2772
3006
|
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
3007
|
}
|
|
2774
|
-
for (const [prop,
|
|
2775
|
-
|
|
2776
|
-
event
|
|
2777
|
-
|
|
3008
|
+
for (const [prop, entry] of Object.entries(def.onProps ?? {})) {
|
|
3009
|
+
const event = typeof entry === "string" ? entry : entry.event;
|
|
3010
|
+
for (const edge of edges.filter((e) => e.event === event)) edges.push({
|
|
3011
|
+
...edge,
|
|
3012
|
+
event: `$props:${prop}`
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
2778
3015
|
return {
|
|
2779
3016
|
id: def.id,
|
|
2780
3017
|
initial: def.initial,
|
|
@@ -2966,7 +3203,8 @@ const hiddenFocus = (f) => {
|
|
|
2966
3203
|
if (focused?.inInert) out.push(`focus is on ${focused.describe}, inside inert`);
|
|
2967
3204
|
for (const el of f.after.elements) {
|
|
2968
3205
|
const formInput = el.attrs["data-scope"] !== void 0 && el.attrs["data-part"] === "hidden-input" && el.attrs["tabindex"] === "-1";
|
|
2969
|
-
|
|
3206
|
+
const copy = el.inCopy && el.attrs["tabindex"] === "-1";
|
|
3207
|
+
if (el.focusable && el.inAriaHidden && !el.hidden && !formInput && !copy) out.push(`${el.describe} is focusable inside aria-hidden`);
|
|
2970
3208
|
}
|
|
2971
3209
|
return out;
|
|
2972
3210
|
};
|
|
@@ -3256,6 +3494,7 @@ const traitInvariants = {
|
|
|
3256
3494
|
const stops = list.filter((el) => el.attrs["tabindex"] === "0").length;
|
|
3257
3495
|
const container = f.after.parts.some((p) => p.part !== itemPart(f) && p.attrs["tabindex"] === "0");
|
|
3258
3496
|
const out = list.length > 0 && stops !== 1 && !(stops === 0 && container) ? [`${stops} items have tabindex="0"; expected exactly 1`] : [];
|
|
3497
|
+
for (const el of list) if (el.focusableInside) out.push(`${el.describe} contains a focusable descendant; the roving tab stop is the cell`);
|
|
3259
3498
|
if (f.before?.focus.inInstance && f.after.focus.onBody) out.push("focus fell to <body> after the step (the focused item was removed?)");
|
|
3260
3499
|
return [...out, ...highlightChecks(f)];
|
|
3261
3500
|
},
|
|
@@ -3295,7 +3534,11 @@ const traitInvariants = {
|
|
|
3295
3534
|
const value = f.values["value"];
|
|
3296
3535
|
if (value !== void 0 && value !== "all" && list.every((el) => itemValue(el) !== void 0)) {
|
|
3297
3536
|
const rendered = new Set(list.map((el) => itemValue(el)));
|
|
3298
|
-
const
|
|
3537
|
+
const range = value !== null && typeof value === "object" && "start" in value && "end" in value ? {
|
|
3538
|
+
lo: String(value.start),
|
|
3539
|
+
hi: String(value.end)
|
|
3540
|
+
} : null;
|
|
3541
|
+
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
3542
|
const have = new Set(selected.map((el) => itemValue(el) ?? ""));
|
|
3300
3543
|
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
3544
|
}
|
|
@@ -3541,7 +3784,10 @@ function expectations(contract, state, view) {
|
|
|
3541
3784
|
/** The event type the oracle processes for an edge (`$props:x` → the declared event). */
|
|
3542
3785
|
function stepEvent(machine, edge) {
|
|
3543
3786
|
if (edge.event.startsWith("$sync:")) return "$sync";
|
|
3544
|
-
if (edge.event.startsWith("$props:"))
|
|
3787
|
+
if (edge.event.startsWith("$props:")) {
|
|
3788
|
+
const entry = machine.def.onProps?.[edge.event.slice(7)];
|
|
3789
|
+
return entry === void 0 ? edge.event : typeof entry === "string" ? entry : entry.event;
|
|
3790
|
+
}
|
|
3545
3791
|
return edge.event;
|
|
3546
3792
|
}
|
|
3547
3793
|
/** Whether the oracle's step log shows that this edge was taken. */
|
|
@@ -3587,6 +3833,11 @@ const oracleEnv = {
|
|
|
3587
3833
|
track: () => ({ stop: () => {} }),
|
|
3588
3834
|
reposition: () => {}
|
|
3589
3835
|
},
|
|
3836
|
+
hoverIntent: {
|
|
3837
|
+
isInTransit: () => false,
|
|
3838
|
+
track: () => () => {},
|
|
3839
|
+
triggerProps: () => ({})
|
|
3840
|
+
},
|
|
3590
3841
|
menuTree: {
|
|
3591
3842
|
register: () => () => {},
|
|
3592
3843
|
openChild: () => {},
|
|
@@ -4109,7 +4360,8 @@ async function runPath(contract, graph, { path, notTaken }, ctx, options, args,
|
|
|
4109
4360
|
modality,
|
|
4110
4361
|
stepModality,
|
|
4111
4362
|
props: oracle.props,
|
|
4112
|
-
values: oracle.service.view().values
|
|
4363
|
+
values: oracle.service.view().values,
|
|
4364
|
+
context: oracle.service.getSnapshot().context
|
|
4113
4365
|
}).catch((e) => e instanceof Error ? e.message : String(e));
|
|
4114
4366
|
if (typeof result === "string" && result !== "") problems.push(`${inv.name}: ${result}`);
|
|
4115
4367
|
}
|
|
@@ -4640,6 +4892,7 @@ function virtualClock() {
|
|
|
4640
4892
|
let fired = 0;
|
|
4641
4893
|
const timers = /* @__PURE__ */ new Map();
|
|
4642
4894
|
return {
|
|
4895
|
+
clock: { now: () => now },
|
|
4643
4896
|
scheduler: {
|
|
4644
4897
|
setTimeout: (callback, ms) => {
|
|
4645
4898
|
const id = ++seq;
|
|
@@ -4702,4 +4955,30 @@ function liveAnnouncements(log) {
|
|
|
4702
4955
|
});
|
|
4703
4956
|
}
|
|
4704
4957
|
//#endregion
|
|
4705
|
-
|
|
4958
|
+
//#region src/warning-guard.ts
|
|
4959
|
+
const KEY = Symbol.for("rind-ui.warning-guard");
|
|
4960
|
+
function state() {
|
|
4961
|
+
const g = globalThis;
|
|
4962
|
+
g[KEY] ??= {
|
|
4963
|
+
seen: [],
|
|
4964
|
+
expected: [],
|
|
4965
|
+
allowed: []
|
|
4966
|
+
};
|
|
4967
|
+
return g[KEY];
|
|
4968
|
+
}
|
|
4969
|
+
/**
|
|
4970
|
+
* Declares that the current test logs a `[rind-ui]` warning or error matching `pattern`:
|
|
4971
|
+
* the guard does not fail the test for it, and fails it if no such message was logged.
|
|
4972
|
+
*/
|
|
4973
|
+
function expectRindWarning(pattern) {
|
|
4974
|
+
state().expected.push(pattern);
|
|
4975
|
+
}
|
|
4976
|
+
/**
|
|
4977
|
+
* Lets the current test log a `[rind-ui]` message matching `pattern` without requiring it: for
|
|
4978
|
+
* a file whose shared fixture logs it in some tests (call it in `beforeEach`).
|
|
4979
|
+
*/
|
|
4980
|
+
function allowRindWarning(pattern) {
|
|
4981
|
+
state().allowed.push(pattern);
|
|
4982
|
+
}
|
|
4983
|
+
//#endregion
|
|
4984
|
+
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, getClipboard, getCodeBlock, getCollapsible, getColorPicker, getCombobox, getContextMenu, getDateField, getDialog, getDrawer, getField, getFieldset, getFileUpload, getForm, getGridList, getHeading, getHoverCard, getImage, getImageCropper, getImageViewer, getKbd, getLabel, getLink, getListbox, getMarquee, getMenu, getMenubar, getMessageThread, getMeter, getNavigationMenu, getNumberInput, getPagination, getPinInput, getPopover, getProgress, getPromptInput, getQrCode, getRadioGroup, getRating, getReasoning, getScrollArea, getSegmentedControl, getSelect, getSeparator, getSkeleton, getSlider, getSortable, getSplitter, getStepper, getStreamingMessage, getSwitch, getTable, getTableOfContents, getTabs, getTagGroup, getTagsInput, getTextField, getTimeline, 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 };
|