@adia-ai/web-components 0.6.33 → 0.6.35
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/CHANGELOG.md +64 -0
- package/color/index.js +1 -1
- package/components/accordion/accordion-item.yaml +2 -2
- package/components/accordion/accordion.css +2 -2
- package/components/accordion/accordion.js +1 -1
- package/components/action-list/action-item.yaml +2 -2
- package/components/action-list/action-list.css +2 -2
- package/components/action-list/action-list.js +1 -1
- package/components/agent-artifact/{class.js → agent-artifact.class.js} +1 -1
- package/components/agent-artifact/agent-artifact.css +31 -31
- package/components/agent-artifact/agent-artifact.js +1 -1
- package/components/agent-feedback-bar/agent-feedback-bar.css +10 -10
- package/components/agent-feedback-bar/agent-feedback-bar.js +1 -1
- package/components/agent-questions/agent-questions.css +57 -57
- package/components/agent-questions/agent-questions.js +1 -1
- package/components/agent-reasoning/agent-reasoning.css +62 -62
- package/components/agent-reasoning/agent-reasoning.js +1 -1
- package/components/agent-suggestions/agent-suggestions.css +4 -4
- package/components/agent-suggestions/agent-suggestions.js +1 -1
- package/components/agent-trace/agent-trace.css +53 -53
- package/components/alert/alert.a2ui.json +64 -1
- package/components/alert/{class.js → alert.class.js} +189 -2
- package/components/alert/alert.css +119 -41
- package/components/alert/alert.d.ts +14 -0
- package/components/alert/alert.js +1 -1
- package/components/alert/alert.test.js +184 -0
- package/components/alert/alert.yaml +114 -1
- package/components/avatar/avatar-group.yaml +2 -2
- package/components/avatar/avatar.css +27 -27
- package/components/avatar/avatar.js +1 -1
- package/components/badge/badge.css +27 -27
- package/components/badge/badge.js +1 -1
- package/components/block/block.css +16 -16
- package/components/block/block.js +1 -1
- package/components/breadcrumb/breadcrumb.css +23 -23
- package/components/breadcrumb/breadcrumb.js +1 -1
- package/components/button/button.css +101 -91
- package/components/button/button.js +1 -1
- package/components/calendar-grid/calendar-grid.a2ui.json +146 -0
- package/components/calendar-grid/calendar-grid.class.js +326 -0
- package/components/calendar-grid/calendar-grid.css +246 -0
- package/components/calendar-grid/calendar-grid.d.ts +41 -0
- package/components/calendar-grid/calendar-grid.js +17 -0
- package/components/calendar-grid/calendar-grid.yaml +136 -0
- package/components/calendar-picker/calendar-picker.css +139 -139
- package/components/calendar-picker/calendar-picker.js +1 -1
- package/components/canvas/canvas.css +12 -12
- package/components/card/card.css +83 -83
- package/components/card/card.js +1 -1
- package/components/chart/chart.css +224 -224
- package/components/chart/chart.js +1 -1
- package/components/chart-legend/chart-legend.css +26 -26
- package/components/chart-legend/chart-legend.js +1 -1
- package/components/chat-thread/chat-input.a2ui.json +1 -1
- package/components/chat-thread/chat-input.js +6 -1
- package/components/chat-thread/chat-input.yaml +4 -1
- package/components/chat-thread/chat-thread.js +1 -1
- package/components/check/check.css +40 -40
- package/components/check/check.js +1 -1
- package/components/code/code.css +125 -125
- package/components/code/code.js +1 -1
- package/components/col/col.css +15 -15
- package/components/col/col.js +1 -1
- package/components/color-input/color-input.js +1 -1
- package/components/color-picker/color-picker.css +55 -55
- package/components/color-picker/color-picker.js +1 -1
- package/components/combobox/combobox.a2ui.json +363 -0
- package/components/combobox/combobox.class.js +861 -0
- package/components/combobox/combobox.css +244 -0
- package/components/combobox/combobox.d.ts +113 -0
- package/components/combobox/combobox.examples.md +59 -0
- package/components/combobox/combobox.js +17 -0
- package/components/combobox/combobox.test.js +181 -0
- package/components/combobox/combobox.yaml +369 -0
- package/components/command/command.css +90 -90
- package/components/command/command.js +1 -1
- package/components/date-range-picker/date-range-picker.a2ui.json +300 -0
- package/components/date-range-picker/date-range-picker.class.js +791 -0
- package/components/date-range-picker/date-range-picker.css +224 -0
- package/components/date-range-picker/date-range-picker.d.ts +82 -0
- package/components/date-range-picker/date-range-picker.examples.md +37 -0
- package/components/date-range-picker/date-range-picker.js +17 -0
- package/components/date-range-picker/date-range-picker.test.js +387 -0
- package/components/date-range-picker/date-range-picker.yaml +285 -0
- package/components/datetime-picker/datetime-picker.a2ui.json +334 -0
- package/components/datetime-picker/datetime-picker.class.js +706 -0
- package/components/datetime-picker/datetime-picker.css +150 -0
- package/components/datetime-picker/datetime-picker.d.ts +86 -0
- package/components/datetime-picker/datetime-picker.examples.md +46 -0
- package/components/datetime-picker/datetime-picker.js +17 -0
- package/components/datetime-picker/datetime-picker.test.js +454 -0
- package/components/datetime-picker/datetime-picker.yaml +332 -0
- package/components/demo-toggle/demo-toggle.css +27 -27
- package/components/demo-toggle/demo-toggle.js +1 -1
- package/components/description-list/description-list.css +18 -18
- package/components/description-list/description-list.js +1 -1
- package/components/divider/divider.css +24 -24
- package/components/divider/divider.js +1 -1
- package/components/drawer/drawer.js +1 -1
- package/components/embed/embed.css +6 -6
- package/components/embed/embed.js +1 -1
- package/components/empty-state/empty-state.css +27 -27
- package/components/empty-state/empty-state.js +1 -1
- package/components/feed/feed.css +12 -12
- package/components/feed/feed.js +1 -1
- package/components/field/field.css +28 -28
- package/components/field/field.js +1 -1
- package/components/field/field.test.js +1 -1
- package/components/fields/fields.css +5 -5
- package/components/fields/fields.js +1 -1
- package/components/grid/grid.css +5 -5
- package/components/grid/grid.js +1 -1
- package/components/heatmap/heatmap.css +63 -63
- package/components/heatmap/heatmap.js +1 -1
- package/components/icon/icon.css +12 -12
- package/components/icon/icon.js +1 -1
- package/components/image/image.css +14 -14
- package/components/image/image.js +1 -1
- package/components/index.js +11 -0
- package/components/inline-message/inline-message.a2ui.json +143 -0
- package/components/inline-message/inline-message.class.js +169 -0
- package/components/inline-message/inline-message.css +75 -0
- package/components/inline-message/inline-message.d.ts +31 -0
- package/components/inline-message/inline-message.examples.md +19 -0
- package/components/inline-message/inline-message.js +17 -0
- package/components/inline-message/inline-message.test.js +203 -0
- package/components/inline-message/inline-message.yaml +205 -0
- package/components/input/input.css +67 -67
- package/components/input/input.js +1 -1
- package/components/input/input.yaml +5 -4
- package/components/inspector/inspector.css +6 -6
- package/components/inspector/inspector.js +1 -1
- package/components/integration-card/integration-card.a2ui.json +268 -0
- package/components/integration-card/integration-card.class.js +410 -0
- package/components/integration-card/integration-card.css +169 -0
- package/components/integration-card/integration-card.d.ts +63 -0
- package/components/integration-card/integration-card.examples.md +41 -0
- package/components/integration-card/integration-card.js +17 -0
- package/components/integration-card/integration-card.test.js +306 -0
- package/components/integration-card/integration-card.yaml +280 -0
- package/components/kbd/kbd.css +32 -32
- package/components/kbd/kbd.js +1 -1
- package/components/link/link.css +12 -12
- package/components/link/link.js +1 -1
- package/components/list/list-item.yaml +2 -2
- package/components/list/list.css +8 -8
- package/components/list/list.js +1 -1
- package/components/list-window/list-window.a2ui.json +277 -0
- package/components/list-window/list-window.class.js +688 -0
- package/components/list-window/list-window.css +124 -0
- package/components/list-window/list-window.d.ts +84 -0
- package/components/list-window/list-window.examples.md +73 -0
- package/components/list-window/list-window.js +17 -0
- package/components/list-window/list-window.test.js +303 -0
- package/components/list-window/list-window.yaml +270 -0
- package/components/loading-overlay/loading-overlay.a2ui.json +176 -0
- package/components/loading-overlay/loading-overlay.class.js +203 -0
- package/components/loading-overlay/loading-overlay.css +81 -0
- package/components/loading-overlay/loading-overlay.d.ts +24 -0
- package/components/loading-overlay/loading-overlay.examples.md +50 -0
- package/components/loading-overlay/loading-overlay.js +17 -0
- package/components/loading-overlay/loading-overlay.test.js +257 -0
- package/components/loading-overlay/loading-overlay.yaml +260 -0
- package/components/menu/menu-divider.yaml +1 -1
- package/components/menu/menu-item.yaml +1 -1
- package/components/menu/menu.a2ui.json +3 -0
- package/components/menu/menu.css +8 -8
- package/components/menu/menu.js +1 -1
- package/components/menu/menu.yaml +7 -0
- package/components/modal/{class.js → modal.class.js} +12 -1
- package/components/modal/modal.css +54 -44
- package/components/modal/modal.js +1 -1
- package/components/nav/nav.css +40 -40
- package/components/nav/nav.js +1 -1
- package/components/nav-group/nav-group.css +52 -52
- package/components/nav-group/nav-group.js +1 -1
- package/components/nav-item/nav-item.css +44 -44
- package/components/nav-item/nav-item.js +1 -1
- package/components/noodles/noodles.css +31 -31
- package/components/noodles/noodles.js +1 -1
- package/components/option-card/option-card.css +69 -69
- package/components/option-card/option-card.js +1 -1
- package/components/otp-input/otp-input.css +30 -30
- package/components/otp-input/otp-input.js +1 -1
- package/components/page/page.css +18 -18
- package/components/page/page.js +1 -1
- package/components/pagination/pagination.css +61 -61
- package/components/pagination/pagination.js +1 -1
- package/components/pane/pane.css +57 -57
- package/components/pane/pane.js +1 -1
- package/components/pipeline-status/pipeline-status.css +65 -65
- package/components/pipeline-status/pipeline-status.js +1 -1
- package/components/popover/popover.a2ui.json +8 -1
- package/components/popover/popover.css +17 -17
- package/components/popover/popover.js +1 -1
- package/components/popover/popover.yaml +14 -1
- package/components/progress/progress.css +23 -23
- package/components/progress/progress.js +1 -1
- package/components/progress-row/progress-row.css +17 -17
- package/components/progress-row/progress-row.js +1 -1
- package/components/radio/radio.css +39 -39
- package/components/radio/radio.js +1 -1
- package/components/range/range.css +55 -55
- package/components/range/range.js +1 -1
- package/components/rating/rating.css +28 -28
- package/components/rating/rating.js +1 -1
- package/components/richtext/richtext.css +133 -133
- package/components/richtext/richtext.js +1 -1
- package/components/row/row.css +19 -19
- package/components/row/row.js +1 -1
- package/components/search/search.css +5 -5
- package/components/search/search.js +1 -1
- package/components/segment/segment.css +24 -24
- package/components/segment/segment.js +1 -1
- package/components/segmented/segmented.css +25 -25
- package/components/segmented/segmented.js +1 -1
- package/components/select/select.a2ui.json +58 -4
- package/components/select/{class.js → select.class.js} +415 -6
- package/components/select/select.css +242 -84
- package/components/select/select.d.ts +31 -1
- package/components/select/select.js +1 -1
- package/components/select/select.test.js +202 -0
- package/components/select/select.yaml +126 -5
- package/components/skeleton/skeleton.css +14 -14
- package/components/skeleton/skeleton.js +1 -1
- package/components/slider/slider.css +46 -46
- package/components/slider/slider.js +1 -1
- package/components/spinner/spinner.a2ui.json +198 -0
- package/components/spinner/spinner.class.js +99 -0
- package/components/spinner/spinner.css +221 -0
- package/components/spinner/spinner.d.ts +26 -0
- package/components/spinner/spinner.examples.md +26 -0
- package/components/spinner/spinner.js +17 -0
- package/components/spinner/spinner.test.js +272 -0
- package/components/spinner/spinner.yaml +238 -0
- package/components/stack/stack.css +11 -11
- package/components/stack/stack.js +1 -1
- package/components/stat/stat.css +25 -25
- package/components/step-progress/step-progress.css +20 -20
- package/components/step-progress/step-progress.js +1 -1
- package/components/stepper/stepper-item.yaml +1 -1
- package/components/stepper/stepper.css +29 -29
- package/components/stepper/stepper.js +1 -1
- package/components/stream/stream.css +12 -12
- package/components/stream/stream.js +1 -1
- package/components/swatch/swatch.css +68 -68
- package/components/swatch/swatch.js +1 -1
- package/components/swiper/swiper.css +57 -57
- package/components/swiper/swiper.js +1 -1
- package/components/switch/switch.css +52 -52
- package/components/switch/switch.js +1 -1
- package/components/table/table.css +163 -163
- package/components/table/table.js +1 -1
- package/components/table-toolbar/{class.js → table-toolbar.class.js} +1 -1
- package/components/table-toolbar/table-toolbar.css +32 -32
- package/components/table-toolbar/table-toolbar.js +1 -1
- package/components/tabs/tab.yaml +2 -2
- package/components/tabs/tabs.css +51 -51
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.css +48 -48
- package/components/tag/tag.js +1 -1
- package/components/tags-input/tags-input.a2ui.json +337 -0
- package/components/tags-input/tags-input.class.js +776 -0
- package/components/tags-input/tags-input.css +201 -0
- package/components/tags-input/tags-input.d.ts +120 -0
- package/components/tags-input/tags-input.examples.md +92 -0
- package/components/tags-input/tags-input.js +17 -0
- package/components/tags-input/tags-input.test.js +368 -0
- package/components/tags-input/tags-input.yaml +367 -0
- package/components/text/text.css +44 -44
- package/components/text/text.js +1 -1
- package/components/textarea/textarea.a2ui.json +1 -1
- package/components/textarea/textarea.css +46 -46
- package/components/textarea/textarea.js +1 -1
- package/components/textarea/textarea.yaml +11 -8
- package/components/time-picker/time-picker.a2ui.json +267 -0
- package/components/time-picker/time-picker.class.js +693 -0
- package/components/time-picker/time-picker.css +122 -0
- package/components/time-picker/time-picker.d.ts +75 -0
- package/components/time-picker/time-picker.examples.md +35 -0
- package/components/time-picker/time-picker.js +17 -0
- package/components/time-picker/time-picker.test.js +287 -0
- package/components/time-picker/time-picker.yaml +256 -0
- package/components/timeline/timeline-item.yaml +2 -2
- package/components/timeline/{class.js → timeline.class.js} +1 -1
- package/components/timeline/timeline.css +50 -50
- package/components/timeline/timeline.js +1 -1
- package/components/toast/toast.css +58 -58
- package/components/toast/toast.js +1 -1
- package/components/toggle-group/toggle-group.css +6 -6
- package/components/toggle-group/toggle-group.js +1 -1
- package/components/toggle-group/toggle-option.yaml +1 -1
- package/components/toggle-scheme/toggle-scheme.css +2 -2
- package/components/toggle-scheme/toggle-scheme.js +1 -1
- package/components/toolbar/toolbar-group.yaml +1 -1
- package/components/toolbar/toolbar.css +17 -17
- package/components/toolbar/toolbar.js +1 -1
- package/components/tooltip/tooltip.css +2 -2
- package/components/tooltip/tooltip.js +1 -1
- package/components/tree/tree-item.yaml +1 -1
- package/components/tree/tree.css +37 -37
- package/components/tree/tree.js +1 -1
- package/components/upload/upload.css +49 -49
- package/components/upload/upload.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +146 -87
- package/package.json +3 -3
- package/styles/components.css +11 -0
- /package/components/accordion/{class.js → accordion.class.js} +0 -0
- /package/components/action-list/{class.js → action-list.class.js} +0 -0
- /package/components/agent-feedback-bar/{class.js → agent-feedback-bar.class.js} +0 -0
- /package/components/agent-questions/{class.js → agent-questions.class.js} +0 -0
- /package/components/agent-reasoning/{class.js → agent-reasoning.class.js} +0 -0
- /package/components/agent-suggestions/{class.js → agent-suggestions.class.js} +0 -0
- /package/components/avatar/{class.js → avatar.class.js} +0 -0
- /package/components/badge/{class.js → badge.class.js} +0 -0
- /package/components/block/{class.js → block.class.js} +0 -0
- /package/components/breadcrumb/{class.js → breadcrumb.class.js} +0 -0
- /package/components/button/{class.js → button.class.js} +0 -0
- /package/components/calendar-picker/{class.js → calendar-picker.class.js} +0 -0
- /package/components/card/{class.js → card.class.js} +0 -0
- /package/components/chart/{class.js → chart.class.js} +0 -0
- /package/components/chart-legend/{class.js → chart-legend.class.js} +0 -0
- /package/components/chat-thread/{class.js → chat-thread.class.js} +0 -0
- /package/components/check/{class.js → check.class.js} +0 -0
- /package/components/code/{class.js → code.class.js} +0 -0
- /package/components/col/{class.js → col.class.js} +0 -0
- /package/components/color-input/{class.js → color-input.class.js} +0 -0
- /package/components/color-picker/{class.js → color-picker.class.js} +0 -0
- /package/components/command/{class.js → command.class.js} +0 -0
- /package/components/demo-toggle/{class.js → demo-toggle.class.js} +0 -0
- /package/components/description-list/{class.js → description-list.class.js} +0 -0
- /package/components/divider/{class.js → divider.class.js} +0 -0
- /package/components/drawer/{class.js → drawer.class.js} +0 -0
- /package/components/embed/{class.js → embed.class.js} +0 -0
- /package/components/empty-state/{class.js → empty-state.class.js} +0 -0
- /package/components/feed/{class.js → feed.class.js} +0 -0
- /package/components/field/{class.js → field.class.js} +0 -0
- /package/components/fields/{class.js → fields.class.js} +0 -0
- /package/components/grid/{class.js → grid.class.js} +0 -0
- /package/components/heatmap/{class.js → heatmap.class.js} +0 -0
- /package/components/icon/{class.js → icon.class.js} +0 -0
- /package/components/image/{class.js → image.class.js} +0 -0
- /package/components/input/{class.js → input.class.js} +0 -0
- /package/components/inspector/{class.js → inspector.class.js} +0 -0
- /package/components/kbd/{class.js → kbd.class.js} +0 -0
- /package/components/link/{class.js → link.class.js} +0 -0
- /package/components/list/{class.js → list.class.js} +0 -0
- /package/components/menu/{class.js → menu.class.js} +0 -0
- /package/components/nav/{class.js → nav.class.js} +0 -0
- /package/components/nav-group/{class.js → nav-group.class.js} +0 -0
- /package/components/nav-item/{class.js → nav-item.class.js} +0 -0
- /package/components/noodles/{class.js → noodles.class.js} +0 -0
- /package/components/option-card/{class.js → option-card.class.js} +0 -0
- /package/components/otp-input/{class.js → otp-input.class.js} +0 -0
- /package/components/page/{class.js → page.class.js} +0 -0
- /package/components/pagination/{class.js → pagination.class.js} +0 -0
- /package/components/pane/{class.js → pane.class.js} +0 -0
- /package/components/pipeline-status/{class.js → pipeline-status.class.js} +0 -0
- /package/components/popover/{class.js → popover.class.js} +0 -0
- /package/components/progress/{class.js → progress.class.js} +0 -0
- /package/components/progress-row/{class.js → progress-row.class.js} +0 -0
- /package/components/radio/{class.js → radio.class.js} +0 -0
- /package/components/range/{class.js → range.class.js} +0 -0
- /package/components/rating/{class.js → rating.class.js} +0 -0
- /package/components/richtext/{class.js → richtext.class.js} +0 -0
- /package/components/row/{class.js → row.class.js} +0 -0
- /package/components/search/{class.js → search.class.js} +0 -0
- /package/components/segment/{class.js → segment.class.js} +0 -0
- /package/components/segmented/{class.js → segmented.class.js} +0 -0
- /package/components/skeleton/{class.js → skeleton.class.js} +0 -0
- /package/components/slider/{class.js → slider.class.js} +0 -0
- /package/components/stack/{class.js → stack.class.js} +0 -0
- /package/components/step-progress/{class.js → step-progress.class.js} +0 -0
- /package/components/stepper/{class.js → stepper.class.js} +0 -0
- /package/components/stream/{class.js → stream.class.js} +0 -0
- /package/components/swatch/{class.js → swatch.class.js} +0 -0
- /package/components/swiper/{class.js → swiper.class.js} +0 -0
- /package/components/switch/{class.js → switch.class.js} +0 -0
- /package/components/table/{class.js → table.class.js} +0 -0
- /package/components/tabs/{class.js → tabs.class.js} +0 -0
- /package/components/tag/{class.js → tag.class.js} +0 -0
- /package/components/text/{class.js → text.class.js} +0 -0
- /package/components/textarea/{class.js → textarea.class.js} +0 -0
- /package/components/toast/{class.js → toast.class.js} +0 -0
- /package/components/toggle-group/{class.js → toggle-group.class.js} +0 -0
- /package/components/toggle-scheme/{class.js → toggle-scheme.class.js} +0 -0
- /package/components/toolbar/{class.js → toolbar.class.js} +0 -0
- /package/components/tooltip/{class.js → tooltip.class.js} +0 -0
- /package/components/tree/{class.js → tree.class.js} +0 -0
- /package/components/upload/{class.js → upload.class.js} +0 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* datetime-picker-ui — unit tests covering the SPEC-038 contract.
|
|
3
|
+
*
|
|
4
|
+
* Composition: <calendar-picker-ui> (date pane) + <time-picker-ui>
|
|
5
|
+
* (time pane) inside a single <popover>. The host emits an ISO 8601
|
|
6
|
+
* datetime string on commit.
|
|
7
|
+
*
|
|
8
|
+
* Run under happy-dom (per vitest.config.js). showPopover/hidePopover
|
|
9
|
+
* are stubbed to no-ops by `packages/web-components/test-setup.js`, so
|
|
10
|
+
* popover state is tracked via the `open` reflected attribute and the
|
|
11
|
+
* `<popover>` div's presence, not via `:popover-open` selector matching.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
15
|
+
import '../../core/element.js';
|
|
16
|
+
import '../button/button.js';
|
|
17
|
+
import '../popover/popover.js';
|
|
18
|
+
import '../calendar-picker/calendar-picker.js';
|
|
19
|
+
import '../time-picker/time-picker.js';
|
|
20
|
+
import '../divider/divider.js';
|
|
21
|
+
import './datetime-picker.js';
|
|
22
|
+
|
|
23
|
+
const tick = () => new Promise((r) => queueMicrotask(r));
|
|
24
|
+
|
|
25
|
+
function mount(html) {
|
|
26
|
+
const wrap = document.createElement('div');
|
|
27
|
+
wrap.innerHTML = html.trim();
|
|
28
|
+
document.body.appendChild(wrap);
|
|
29
|
+
return wrap.firstElementChild;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe('datetime-picker-ui — structure + defaults', () => {
|
|
33
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
34
|
+
|
|
35
|
+
it('registers the custom element', () => {
|
|
36
|
+
expect(customElements.get('datetime-picker-ui')).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('stamps a default <button-ui slot="trigger"> when no trigger is authored', async () => {
|
|
40
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
41
|
+
await tick();
|
|
42
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
43
|
+
expect(trigger).not.toBeNull();
|
|
44
|
+
expect(trigger.localName).toBe('button-ui');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('stamps a popover container with role=dialog', async () => {
|
|
48
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
49
|
+
await tick();
|
|
50
|
+
const popover = el.querySelector(':scope > [slot="popover"]');
|
|
51
|
+
expect(popover).not.toBeNull();
|
|
52
|
+
expect(popover.getAttribute('role')).toBe('dialog');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('stamps a single <calendar-grid-ui> as the date pane inside the popover', async () => {
|
|
56
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
57
|
+
await tick();
|
|
58
|
+
const popover = el.querySelector(':scope > [slot="popover"]');
|
|
59
|
+
const cal = popover.querySelector(':scope > calendar-grid-ui[data-cal-pane]');
|
|
60
|
+
expect(cal).not.toBeNull();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('stamps a single <time-picker-ui> as the time pane inside the popover', async () => {
|
|
64
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
65
|
+
await tick();
|
|
66
|
+
const popover = el.querySelector(':scope > [slot="popover"]');
|
|
67
|
+
const time = popover.querySelector(':scope > time-picker-ui[data-time-pane]');
|
|
68
|
+
expect(time).not.toBeNull();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('stamps a vertical <divider-ui> between the panes', async () => {
|
|
72
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
73
|
+
await tick();
|
|
74
|
+
const popover = el.querySelector(':scope > [slot="popover"]');
|
|
75
|
+
const div = popover.querySelector(':scope > divider-ui[data-pane-divider]');
|
|
76
|
+
expect(div).not.toBeNull();
|
|
77
|
+
expect(div.hasAttribute('vertical')).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('host carries role=combobox + aria-haspopup=dialog + aria-expanded=false', async () => {
|
|
81
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
82
|
+
await tick();
|
|
83
|
+
expect(el.getAttribute('role')).toBe('combobox');
|
|
84
|
+
expect(el.getAttribute('aria-haspopup')).toBe('dialog');
|
|
85
|
+
expect(el.getAttribute('aria-expanded')).toBe('false');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('renders the placeholder in the trigger when value is empty', async () => {
|
|
89
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
90
|
+
await tick();
|
|
91
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
92
|
+
expect(trigger.getAttribute('text')).toBe('Select date and time');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('uses a custom placeholder when supplied', async () => {
|
|
96
|
+
const el = mount('<datetime-picker-ui placeholder="Pick a moment"></datetime-picker-ui>');
|
|
97
|
+
await tick();
|
|
98
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
99
|
+
expect(trigger.getAttribute('text')).toBe('Pick a moment');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('datetime-picker-ui — value reflection', () => {
|
|
104
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
105
|
+
|
|
106
|
+
it('parses ISO datetime value into date + time', async () => {
|
|
107
|
+
const el = mount('<datetime-picker-ui value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
108
|
+
await tick();
|
|
109
|
+
expect(el.datetimeValue).toEqual({ date: '2026-05-24', time: '14:30' });
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('reflects value into the calendar pane (date portion)', async () => {
|
|
113
|
+
const el = mount('<datetime-picker-ui value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
114
|
+
await tick();
|
|
115
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
116
|
+
expect(cal.value).toBe('2026-05-24');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('reflects value into the time pane (time portion)', async () => {
|
|
120
|
+
const el = mount('<datetime-picker-ui value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
121
|
+
await tick();
|
|
122
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
123
|
+
expect(time.value).toBe('14:30');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('renders formatted datetime in the trigger when value is set', async () => {
|
|
127
|
+
const el = mount('<datetime-picker-ui value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
128
|
+
await tick();
|
|
129
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
130
|
+
expect(trigger.getAttribute('text')).toContain('May 24, 2026');
|
|
131
|
+
expect(trigger.getAttribute('text')).toContain('14:30');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('format="long" renders the long-form month', async () => {
|
|
135
|
+
const el = mount('<datetime-picker-ui format="long" value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
136
|
+
await tick();
|
|
137
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
138
|
+
expect(trigger.getAttribute('text')).toContain('May 24, 2026');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('format="iso" renders the raw ISO date portion', async () => {
|
|
142
|
+
const el = mount('<datetime-picker-ui format="iso" value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
143
|
+
await tick();
|
|
144
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
145
|
+
expect(trigger.getAttribute('text')).toContain('2026-05-24');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('reflects [min] onto the calendar pane (date portion)', async () => {
|
|
149
|
+
const el = mount('<datetime-picker-ui min="2026-01-01T00:00"></datetime-picker-ui>');
|
|
150
|
+
await tick();
|
|
151
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
152
|
+
expect(cal.getAttribute('min')).toBe('2026-01-01');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('reflects [max] onto the calendar pane (date portion)', async () => {
|
|
156
|
+
const el = mount('<datetime-picker-ui max="2026-12-31T23:59"></datetime-picker-ui>');
|
|
157
|
+
await tick();
|
|
158
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
159
|
+
expect(cal.getAttribute('max')).toBe('2026-12-31');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('reflects [precision] onto the time pane', async () => {
|
|
163
|
+
const el = mount('<datetime-picker-ui precision="second"></datetime-picker-ui>');
|
|
164
|
+
await tick();
|
|
165
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
166
|
+
expect(time.getAttribute('precision')).toBe('second');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('precision="second" stamps a seconds segment in the time pane', async () => {
|
|
170
|
+
const el = mount('<datetime-picker-ui precision="second" value="2026-05-24T14:30:45"></datetime-picker-ui>');
|
|
171
|
+
await tick();
|
|
172
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
173
|
+
expect(time.querySelector('[data-segment="second"]')).not.toBeNull();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('hour-cycle="h12" stamps an AM/PM segment in the time pane', async () => {
|
|
177
|
+
const el = mount('<datetime-picker-ui hour-cycle="h12" value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
178
|
+
await tick();
|
|
179
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
180
|
+
expect(time.querySelector('[data-segment="meridiem"]')).not.toBeNull();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('hour-cycle="h23" hides the AM/PM segment in the time pane', async () => {
|
|
184
|
+
const el = mount('<datetime-picker-ui hour-cycle="h23" value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
185
|
+
await tick();
|
|
186
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
187
|
+
expect(time.querySelector('[data-segment="meridiem"]')).toBeNull();
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('reflects [step] onto the time pane', async () => {
|
|
191
|
+
const el = mount('<datetime-picker-ui step="900"></datetime-picker-ui>');
|
|
192
|
+
await tick();
|
|
193
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
194
|
+
expect(time.getAttribute('step')).toBe('900');
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
describe('datetime-picker-ui — open / close behavior', () => {
|
|
199
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
200
|
+
|
|
201
|
+
it('opens on trigger click + emits `open` event', async () => {
|
|
202
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
203
|
+
await tick();
|
|
204
|
+
let openDetail = null;
|
|
205
|
+
el.addEventListener('open', (e) => { openDetail = e.detail; });
|
|
206
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
207
|
+
trigger.click();
|
|
208
|
+
await tick();
|
|
209
|
+
expect(el.open).toBe(true);
|
|
210
|
+
expect(el.hasAttribute('open')).toBe(true);
|
|
211
|
+
expect(el.getAttribute('aria-expanded')).toBe('true');
|
|
212
|
+
expect(openDetail?.trigger).toBe('click');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('closes on second trigger click + emits `close`', async () => {
|
|
216
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
217
|
+
await tick();
|
|
218
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
219
|
+
let closeDetail = null;
|
|
220
|
+
el.addEventListener('close', (e) => { closeDetail = e.detail; });
|
|
221
|
+
trigger.click();
|
|
222
|
+
await tick();
|
|
223
|
+
trigger.click();
|
|
224
|
+
await tick();
|
|
225
|
+
expect(el.open).toBe(false);
|
|
226
|
+
expect(closeDetail).not.toBeNull();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('Escape closes the popover + emits close with reason "escape"', async () => {
|
|
230
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
231
|
+
await tick();
|
|
232
|
+
el.open = true;
|
|
233
|
+
await tick();
|
|
234
|
+
let reason = null;
|
|
235
|
+
el.addEventListener('close', (e) => { reason = e.detail?.reason; });
|
|
236
|
+
const popover = el.querySelector(':scope > [slot="popover"]');
|
|
237
|
+
const ev = new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true });
|
|
238
|
+
popover.dispatchEvent(ev);
|
|
239
|
+
await tick();
|
|
240
|
+
expect(el.open).toBe(false);
|
|
241
|
+
expect(reason).toBe('escape');
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it('Enter on the trigger opens with trigger=keyboard', async () => {
|
|
245
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
246
|
+
await tick();
|
|
247
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
248
|
+
let openDetail = null;
|
|
249
|
+
el.addEventListener('open', (e) => { openDetail = e.detail; });
|
|
250
|
+
trigger.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true, cancelable: true }));
|
|
251
|
+
await tick();
|
|
252
|
+
expect(el.open).toBe(true);
|
|
253
|
+
expect(openDetail?.trigger).toBe('keyboard');
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('[disabled] blocks the trigger from opening', async () => {
|
|
257
|
+
const el = mount('<datetime-picker-ui disabled></datetime-picker-ui>');
|
|
258
|
+
await tick();
|
|
259
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
260
|
+
trigger.click();
|
|
261
|
+
await tick();
|
|
262
|
+
expect(el.open).toBe(false);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('[readonly] blocks the popover from opening', async () => {
|
|
266
|
+
const el = mount('<datetime-picker-ui readonly></datetime-picker-ui>');
|
|
267
|
+
await tick();
|
|
268
|
+
const trigger = el.querySelector(':scope > [slot="trigger"]');
|
|
269
|
+
trigger.click();
|
|
270
|
+
await tick();
|
|
271
|
+
expect(el.open).toBe(false);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('openPopover() opens programmatically with trigger=programmatic', async () => {
|
|
275
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
276
|
+
await tick();
|
|
277
|
+
let openDetail = null;
|
|
278
|
+
el.addEventListener('open', (e) => { openDetail = e.detail; });
|
|
279
|
+
el.openPopover();
|
|
280
|
+
await tick();
|
|
281
|
+
expect(el.open).toBe(true);
|
|
282
|
+
expect(openDetail?.trigger).toBe('programmatic');
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
describe('datetime-picker-ui — selection + commit', () => {
|
|
287
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
288
|
+
|
|
289
|
+
it('emits `input` (partial state) when only the date is picked', async () => {
|
|
290
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
291
|
+
await tick();
|
|
292
|
+
let inputDetail = null;
|
|
293
|
+
let changeFired = false;
|
|
294
|
+
el.addEventListener('input', (e) => { inputDetail = e.detail; });
|
|
295
|
+
el.addEventListener('change', () => { changeFired = true; });
|
|
296
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
297
|
+
cal.value = '2026-03-15';
|
|
298
|
+
cal.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '2026-03-15' } }));
|
|
299
|
+
await tick();
|
|
300
|
+
expect(inputDetail).not.toBeNull();
|
|
301
|
+
expect(inputDetail.value).toContain('2026-03-15');
|
|
302
|
+
expect(changeFired).toBe(false);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('commits `change` when both panes have selections', async () => {
|
|
306
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
307
|
+
await tick();
|
|
308
|
+
let detail = null;
|
|
309
|
+
el.addEventListener('change', (e) => { detail = e.detail; });
|
|
310
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
311
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
312
|
+
cal.value = '2026-03-01';
|
|
313
|
+
cal.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '2026-03-01' } }));
|
|
314
|
+
await tick();
|
|
315
|
+
time.value = '14:30';
|
|
316
|
+
time.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '14:30', segment: 'minute' } }));
|
|
317
|
+
await tick();
|
|
318
|
+
expect(detail).not.toBeNull();
|
|
319
|
+
expect(detail.value).toBe('2026-03-01T14:30');
|
|
320
|
+
expect(el.value).toBe('2026-03-01T14:30');
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it('time-pane change with existing date in value commits without re-picking date', async () => {
|
|
324
|
+
const el = mount('<datetime-picker-ui value="2026-03-01T09:00"></datetime-picker-ui>');
|
|
325
|
+
await tick();
|
|
326
|
+
let detail = null;
|
|
327
|
+
el.addEventListener('change', (e) => { detail = e.detail; });
|
|
328
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
329
|
+
time.value = '14:30';
|
|
330
|
+
time.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '14:30', segment: 'hour' } }));
|
|
331
|
+
await tick();
|
|
332
|
+
expect(detail.value).toBe('2026-03-01T14:30');
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('out-of-range commit fires `invalid`, not `change`', async () => {
|
|
336
|
+
const el = mount('<datetime-picker-ui min="2026-06-01T00:00" max="2026-06-30T23:59"></datetime-picker-ui>');
|
|
337
|
+
await tick();
|
|
338
|
+
let invalidDetail = null;
|
|
339
|
+
let changeFired = false;
|
|
340
|
+
el.addEventListener('invalid', (e) => { invalidDetail = e.detail; });
|
|
341
|
+
el.addEventListener('change', () => { changeFired = true; });
|
|
342
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
343
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
344
|
+
cal.value = '2026-05-01';
|
|
345
|
+
cal.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '2026-05-01' } }));
|
|
346
|
+
await tick();
|
|
347
|
+
time.value = '12:00';
|
|
348
|
+
time.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '12:00', segment: 'hour' } }));
|
|
349
|
+
await tick();
|
|
350
|
+
expect(invalidDetail).not.toBeNull();
|
|
351
|
+
expect(invalidDetail.reason).toBe('below-min');
|
|
352
|
+
expect(changeFired).toBe(false);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('precision="second" emits HH:mm:ss-formatted value on commit', async () => {
|
|
356
|
+
const el = mount('<datetime-picker-ui precision="second" step="1"></datetime-picker-ui>');
|
|
357
|
+
await tick();
|
|
358
|
+
let detail = null;
|
|
359
|
+
el.addEventListener('change', (e) => { detail = e.detail; });
|
|
360
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
361
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
362
|
+
cal.value = '2026-03-01';
|
|
363
|
+
cal.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '2026-03-01' } }));
|
|
364
|
+
await tick();
|
|
365
|
+
time.value = '14:30:45';
|
|
366
|
+
time.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '14:30:45', segment: 'second' } }));
|
|
367
|
+
await tick();
|
|
368
|
+
expect(detail.value).toBe('2026-03-01T14:30:45');
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('clear() resets the value', async () => {
|
|
372
|
+
const el = mount('<datetime-picker-ui value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
373
|
+
await tick();
|
|
374
|
+
el.clear();
|
|
375
|
+
await tick();
|
|
376
|
+
expect(el.value).toBe('');
|
|
377
|
+
expect(el.datetimeValue).toBeNull();
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
it('change event carries source field', async () => {
|
|
381
|
+
const el = mount('<datetime-picker-ui></datetime-picker-ui>');
|
|
382
|
+
await tick();
|
|
383
|
+
let detail = null;
|
|
384
|
+
el.addEventListener('change', (e) => { detail = e.detail; });
|
|
385
|
+
const cal = el.querySelector('calendar-grid-ui[data-cal-pane]');
|
|
386
|
+
const time = el.querySelector('time-picker-ui[data-time-pane]');
|
|
387
|
+
cal.value = '2026-03-01';
|
|
388
|
+
cal.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '2026-03-01' } }));
|
|
389
|
+
await tick();
|
|
390
|
+
time.value = '14:30';
|
|
391
|
+
time.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: '14:30', segment: 'hour' } }));
|
|
392
|
+
await tick();
|
|
393
|
+
expect(detail.source).toBe('click');
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
describe('datetime-picker-ui — form participation', () => {
|
|
398
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
399
|
+
|
|
400
|
+
it('is form-associated', () => {
|
|
401
|
+
expect(customElements.get('datetime-picker-ui').formAssociated).toBe(true);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
it('exposes ElementInternals via the host', async () => {
|
|
405
|
+
const el = mount('<datetime-picker-ui name="appointment"></datetime-picker-ui>');
|
|
406
|
+
await tick();
|
|
407
|
+
expect(el.internals).toBeDefined();
|
|
408
|
+
expect(typeof el.internals.setFormValue).toBe('function');
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('syncValue writes the ISO datetime to the form', async () => {
|
|
412
|
+
const el = mount('<datetime-picker-ui name="appointment" value="2026-05-24T14:30"></datetime-picker-ui>');
|
|
413
|
+
await tick();
|
|
414
|
+
expect(() => el.syncValue('2026-05-24T14:30')).not.toThrow();
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
it('invalid datetime string does not throw under syncValue', async () => {
|
|
418
|
+
const el = mount('<datetime-picker-ui name="appointment"></datetime-picker-ui>');
|
|
419
|
+
await tick();
|
|
420
|
+
expect(() => el.syncValue('not-a-datetime')).not.toThrow();
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
describe('datetime-picker-ui — slots', () => {
|
|
425
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
426
|
+
|
|
427
|
+
it('consumer-supplied [slot="trigger"] is preserved', async () => {
|
|
428
|
+
const el = mount(`
|
|
429
|
+
<datetime-picker-ui>
|
|
430
|
+
<button-ui slot="trigger" variant="primary" text="Pick"></button-ui>
|
|
431
|
+
</datetime-picker-ui>
|
|
432
|
+
`);
|
|
433
|
+
await tick();
|
|
434
|
+
const triggers = el.querySelectorAll(':scope > [slot="trigger"]');
|
|
435
|
+
expect(triggers.length).toBe(1);
|
|
436
|
+
expect(triggers[0].getAttribute('variant')).toBe('primary');
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('consumer-supplied [slot="footer"] is lifted into the popover', async () => {
|
|
440
|
+
const el = mount(`
|
|
441
|
+
<datetime-picker-ui>
|
|
442
|
+
<div slot="footer">
|
|
443
|
+
<button-ui data-action="cancel" text="Cancel"></button-ui>
|
|
444
|
+
<button-ui data-action="apply" variant="primary" text="Apply"></button-ui>
|
|
445
|
+
</div>
|
|
446
|
+
</datetime-picker-ui>
|
|
447
|
+
`);
|
|
448
|
+
await tick();
|
|
449
|
+
const popover = el.querySelector(':scope > [slot="popover"]');
|
|
450
|
+
const footer = popover.querySelector(':scope > [slot="footer"]');
|
|
451
|
+
expect(footer).not.toBeNull();
|
|
452
|
+
expect(footer.children.length).toBe(2);
|
|
453
|
+
});
|
|
454
|
+
});
|