buefy 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +242 -0
- package/dist/buefy.css +15895 -0
- package/dist/buefy.d.ts +11706 -0
- package/dist/buefy.esm.js +21082 -0
- package/dist/buefy.esm.min.js +2 -0
- package/dist/buefy.js +21227 -0
- package/dist/buefy.min.css +1 -0
- package/dist/buefy.min.js +2 -0
- package/dist/cjs/Autocomplete-BMmOsPiK.js +864 -0
- package/dist/cjs/Button-Cq7yqI8p.js +118 -0
- package/dist/cjs/CheckRadioMixin-CDu0SN3g.js +58 -0
- package/dist/cjs/Checkbox-GPzAMQqM.js +85 -0
- package/dist/cjs/CompatFallthroughMixin-hhK0Gkhr.js +48 -0
- package/dist/cjs/Datepicker-B-9ReBe6.js +2120 -0
- package/dist/cjs/Dropdown-DtpKU9qf.js +470 -0
- package/dist/cjs/DropdownItem-IMOKyRGV.js +110 -0
- package/dist/cjs/Field-19ZCJFF8.js +405 -0
- package/dist/cjs/FormElementMixin-DavX4iOv.js +170 -0
- package/dist/cjs/Icon-lsDKE2wQ.js +184 -0
- package/dist/cjs/Image-CocPwU3n.js +356 -0
- package/dist/cjs/InjectedChildMixin-CUKn09dB.js +150 -0
- package/dist/cjs/Input-BcloGeZ3.js +350 -0
- package/dist/cjs/Loading-GqqqjipO.js +145 -0
- package/dist/cjs/MessageMixin-bGuuzfev.js +136 -0
- package/dist/cjs/Modal-CYpSQe2Q.js +315 -0
- package/dist/cjs/NoticeMixin--3RjH43z.js +163 -0
- package/dist/cjs/Pagination-D1MVdiLp.js +547 -0
- package/dist/cjs/Progress-DT9Qc8Id.js +177 -0
- package/dist/cjs/Select-DayPKwCY.js +147 -0
- package/dist/cjs/SlotComponent-BruGdRW3.js +41 -0
- package/dist/cjs/TabbedChildMixin-B3JUUwcf.js +211 -0
- package/dist/cjs/Tag-BprnwJJ1.js +167 -0
- package/dist/cjs/Timepicker-CDZ3V-2J.js +283 -0
- package/dist/cjs/TimepickerMixin-C9WVvcUL.js +666 -0
- package/dist/cjs/Tooltip-Cgighv0j.js +393 -0
- package/dist/cjs/_plugin-vue_export-helper-Die8u8yB.js +11 -0
- package/dist/cjs/autocomplete.js +23 -0
- package/dist/cjs/breadcrumb.js +107 -0
- package/dist/cjs/button.js +20 -0
- package/dist/cjs/carousel.js +825 -0
- package/dist/cjs/checkbox.js +88 -0
- package/dist/cjs/clockpicker.js +668 -0
- package/dist/cjs/collapse.js +99 -0
- package/dist/cjs/colorpicker.js +25 -0
- package/dist/cjs/config-DR826Ki2.js +103 -0
- package/dist/cjs/config.js +18 -0
- package/dist/cjs/datepicker.js +28 -0
- package/dist/cjs/datetimepicker.js +483 -0
- package/dist/cjs/dialog.js +506 -0
- package/dist/cjs/dropdown.js +23 -0
- package/dist/cjs/field.js +19 -0
- package/dist/cjs/helpers.js +276 -0
- package/dist/cjs/icon.js +19 -0
- package/dist/cjs/image.js +19 -0
- package/dist/cjs/index-DiQy3SCb.js +1942 -0
- package/dist/cjs/index.js +274 -0
- package/dist/cjs/input.js +22 -0
- package/dist/cjs/loading.js +87 -0
- package/dist/cjs/menu.js +340 -0
- package/dist/cjs/message.js +119 -0
- package/dist/cjs/modal.js +103 -0
- package/dist/cjs/navbar.js +572 -0
- package/dist/cjs/notification.js +281 -0
- package/dist/cjs/numberinput.js +386 -0
- package/dist/cjs/pagination.js +22 -0
- package/dist/cjs/plugins-DbyYGVpp.js +16 -0
- package/dist/cjs/progress.js +91 -0
- package/dist/cjs/radio.js +137 -0
- package/dist/cjs/rate.js +197 -0
- package/dist/cjs/select.js +22 -0
- package/dist/cjs/sidebar.js +309 -0
- package/dist/cjs/skeleton.js +78 -0
- package/dist/cjs/slider.js +699 -0
- package/dist/cjs/snackbar.js +224 -0
- package/dist/cjs/ssr-DVRFTu_P.js +8 -0
- package/dist/cjs/steps.js +347 -0
- package/dist/cjs/switch.js +161 -0
- package/dist/cjs/table.js +2391 -0
- package/dist/cjs/tabs.js +258 -0
- package/dist/cjs/tag.js +44 -0
- package/dist/cjs/taginput.js +425 -0
- package/dist/cjs/timepicker.js +29 -0
- package/dist/cjs/toast.js +162 -0
- package/dist/cjs/tooltip.js +19 -0
- package/dist/cjs/trapFocus-BlX6xykt.js +53 -0
- package/dist/cjs/upload.js +195 -0
- package/dist/components/autocomplete/index.js +1647 -0
- package/dist/components/autocomplete/index.min.js +2 -0
- package/dist/components/breadcrumb/index.js +173 -0
- package/dist/components/breadcrumb/index.min.js +2 -0
- package/dist/components/button/index.js +334 -0
- package/dist/components/button/index.min.js +2 -0
- package/dist/components/carousel/index.js +1534 -0
- package/dist/components/carousel/index.min.js +2 -0
- package/dist/components/checkbox/index.js +236 -0
- package/dist/components/checkbox/index.min.js +2 -0
- package/dist/components/clockpicker/index.js +2636 -0
- package/dist/components/clockpicker/index.min.js +2 -0
- package/dist/components/collapse/index.js +111 -0
- package/dist/components/collapse/index.min.js +2 -0
- package/dist/components/colorpicker/index.js +4251 -0
- package/dist/components/colorpicker/index.min.js +2 -0
- package/dist/components/datepicker/index.js +4110 -0
- package/dist/components/datepicker/index.min.js +2 -0
- package/dist/components/datetimepicker/index.js +5479 -0
- package/dist/components/datetimepicker/index.min.js +2 -0
- package/dist/components/dialog/index.js +1202 -0
- package/dist/components/dialog/index.min.js +2 -0
- package/dist/components/dropdown/index.js +680 -0
- package/dist/components/dropdown/index.min.js +2 -0
- package/dist/components/field/index.js +439 -0
- package/dist/components/field/index.min.js +2 -0
- package/dist/components/icon/index.js +212 -0
- package/dist/components/icon/index.min.js +2 -0
- package/dist/components/image/index.js +396 -0
- package/dist/components/image/index.min.js +2 -0
- package/dist/components/input/index.js +764 -0
- package/dist/components/input/index.min.js +2 -0
- package/dist/components/loading/index.js +280 -0
- package/dist/components/loading/index.min.js +2 -0
- package/dist/components/menu/index.js +586 -0
- package/dist/components/menu/index.min.js +2 -0
- package/dist/components/message/index.js +611 -0
- package/dist/components/message/index.min.js +2 -0
- package/dist/components/modal/index.js +516 -0
- package/dist/components/modal/index.min.js +2 -0
- package/dist/components/navbar/index.js +634 -0
- package/dist/components/navbar/index.min.js +2 -0
- package/dist/components/notification/index.js +976 -0
- package/dist/components/notification/index.min.js +2 -0
- package/dist/components/numberinput/index.js +1128 -0
- package/dist/components/numberinput/index.min.js +2 -0
- package/dist/components/pagination/index.js +764 -0
- package/dist/components/pagination/index.min.js +2 -0
- package/dist/components/progress/index.js +280 -0
- package/dist/components/progress/index.min.js +2 -0
- package/dist/components/radio/index.js +208 -0
- package/dist/components/radio/index.min.js +2 -0
- package/dist/components/rate/index.js +391 -0
- package/dist/components/rate/index.min.js +2 -0
- package/dist/components/select/index.js +560 -0
- package/dist/components/select/index.min.js +2 -0
- package/dist/components/sidebar/index.js +337 -0
- package/dist/components/sidebar/index.min.js +2 -0
- package/dist/components/skeleton/index.js +87 -0
- package/dist/components/skeleton/index.min.js +2 -0
- package/dist/components/slider/index.js +1171 -0
- package/dist/components/slider/index.min.js +2 -0
- package/dist/components/snackbar/index.js +439 -0
- package/dist/components/snackbar/index.min.js +2 -0
- package/dist/components/steps/index.js +925 -0
- package/dist/components/steps/index.min.js +2 -0
- package/dist/components/switch/index.js +182 -0
- package/dist/components/switch/index.min.js +2 -0
- package/dist/components/table/index.js +4208 -0
- package/dist/components/table/index.min.js +2 -0
- package/dist/components/tabs/index.js +837 -0
- package/dist/components/tabs/index.min.js +2 -0
- package/dist/components/tag/index.js +396 -0
- package/dist/components/tag/index.min.js +2 -0
- package/dist/components/taginput/index.js +2209 -0
- package/dist/components/taginput/index.min.js +2 -0
- package/dist/components/timepicker/index.js +2906 -0
- package/dist/components/timepicker/index.min.js +2 -0
- package/dist/components/toast/index.js +377 -0
- package/dist/components/toast/index.min.js +2 -0
- package/dist/components/tooltip/index.js +445 -0
- package/dist/components/tooltip/index.min.js +2 -0
- package/dist/components/upload/index.js +426 -0
- package/dist/components/upload/index.min.js +2 -0
- package/dist/esm/Autocomplete-CjbTh9D8.js +862 -0
- package/dist/esm/Button-DyUYShTZ.js +116 -0
- package/dist/esm/CheckRadioMixin-DSD_rjC8.js +56 -0
- package/dist/esm/Checkbox-KUMz0sfA.js +83 -0
- package/dist/esm/CompatFallthroughMixin-C8LPuwDr.js +46 -0
- package/dist/esm/Datepicker-Bl8Wfdkn.js +2118 -0
- package/dist/esm/Dropdown-CGTYVyoL.js +467 -0
- package/dist/esm/DropdownItem-Cn3nM0A3.js +108 -0
- package/dist/esm/Field-B7bX_uUg.js +403 -0
- package/dist/esm/FormElementMixin-Dd_wkBN5.js +168 -0
- package/dist/esm/Icon-DPyGDeRK.js +182 -0
- package/dist/esm/Image-DhX-4hlV.js +354 -0
- package/dist/esm/InjectedChildMixin-D2K-FwuO.js +145 -0
- package/dist/esm/Input-C4L520az.js +348 -0
- package/dist/esm/Loading-tuQoo6TU.js +143 -0
- package/dist/esm/MessageMixin-CQ7LIdvq.js +134 -0
- package/dist/esm/Modal-tfvyhxw_.js +313 -0
- package/dist/esm/NoticeMixin-ByNlva3T.js +161 -0
- package/dist/esm/Pagination-B-LAJQay.js +543 -0
- package/dist/esm/Progress-BPGTVZgr.js +174 -0
- package/dist/esm/Select-bl4qUzij.js +145 -0
- package/dist/esm/SlotComponent-BwNpVnfH.js +39 -0
- package/dist/esm/TabbedChildMixin-C4i6WP9j.js +208 -0
- package/dist/esm/Tag-jS5Bcj6N.js +165 -0
- package/dist/esm/Timepicker-DnkqnOBT.js +281 -0
- package/dist/esm/TimepickerMixin-Bikh6_Fg.js +664 -0
- package/dist/esm/Tooltip-CtDSXAqa.js +391 -0
- package/dist/esm/_plugin-vue_export-helper-OJRSZE6i.js +9 -0
- package/dist/esm/autocomplete.js +18 -0
- package/dist/esm/breadcrumb.js +101 -0
- package/dist/esm/button.js +15 -0
- package/dist/esm/carousel.js +818 -0
- package/dist/esm/checkbox.js +82 -0
- package/dist/esm/clockpicker.js +663 -0
- package/dist/esm/collapse.js +94 -0
- package/dist/esm/colorpicker.js +16 -0
- package/dist/esm/config-CKuo-p6e.js +100 -0
- package/dist/esm/config.js +14 -0
- package/dist/esm/datepicker.js +23 -0
- package/dist/esm/datetimepicker.js +478 -0
- package/dist/esm/dialog.js +500 -0
- package/dist/esm/dropdown.js +17 -0
- package/dist/esm/field.js +14 -0
- package/dist/esm/helpers.js +247 -0
- package/dist/esm/icon.js +14 -0
- package/dist/esm/image.js +14 -0
- package/dist/esm/index-CQegEsxK.js +1938 -0
- package/dist/esm/index.js +164 -0
- package/dist/esm/input.js +17 -0
- package/dist/esm/loading.js +81 -0
- package/dist/esm/menu.js +333 -0
- package/dist/esm/message.js +114 -0
- package/dist/esm/modal.js +97 -0
- package/dist/esm/navbar.js +565 -0
- package/dist/esm/notification.js +275 -0
- package/dist/esm/numberinput.js +381 -0
- package/dist/esm/pagination.js +16 -0
- package/dist/esm/plugins-B172kuKE.js +13 -0
- package/dist/esm/progress.js +85 -0
- package/dist/esm/radio.js +131 -0
- package/dist/esm/rate.js +192 -0
- package/dist/esm/select.js +17 -0
- package/dist/esm/sidebar.js +304 -0
- package/dist/esm/skeleton.js +73 -0
- package/dist/esm/slider.js +693 -0
- package/dist/esm/snackbar.js +218 -0
- package/dist/esm/ssr-C7yEpGLm.js +5 -0
- package/dist/esm/steps.js +341 -0
- package/dist/esm/switch.js +156 -0
- package/dist/esm/table.js +2385 -0
- package/dist/esm/tabs.js +252 -0
- package/dist/esm/tag.js +38 -0
- package/dist/esm/taginput.js +420 -0
- package/dist/esm/timepicker.js +24 -0
- package/dist/esm/toast.js +156 -0
- package/dist/esm/tooltip.js +14 -0
- package/dist/esm/trapFocus-KHP_kCNE.js +51 -0
- package/dist/esm/upload.js +190 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +73 -6
- package/src/components/autocomplete/Autocomplete.spec.ts +783 -0
- package/src/components/autocomplete/Autocomplete.vue +966 -0
- package/src/components/autocomplete/__snapshots__/Autocomplete.spec.ts.snap +21 -0
- package/src/components/autocomplete/index.ts +16 -0
- package/src/components/breadcrumb/Breadcrumb.spec.ts +65 -0
- package/src/components/breadcrumb/Breadcrumb.vue +42 -0
- package/src/components/breadcrumb/BreadcrumbItem.spec.ts +74 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +34 -0
- package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.ts.snap +7 -0
- package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.ts.snap +3 -0
- package/src/components/breadcrumb/index.ts +19 -0
- package/src/components/button/Button.spec.ts +117 -0
- package/src/components/button/Button.vue +112 -0
- package/src/components/button/__snapshots__/Button.spec.ts.snap +9 -0
- package/src/components/button/index.ts +16 -0
- package/src/components/carousel/Carousel.spec.ts +304 -0
- package/src/components/carousel/Carousel.vue +389 -0
- package/src/components/carousel/CarouselItem.spec.ts +105 -0
- package/src/components/carousel/CarouselItem.vue +38 -0
- package/src/components/carousel/CarouselList.spec.ts +172 -0
- package/src/components/carousel/CarouselList.vue +364 -0
- package/src/components/carousel/__snapshots__/Carousel.spec.ts.snap +19 -0
- package/src/components/carousel/__snapshots__/CarouselItem.spec.ts.snap +7 -0
- package/src/components/carousel/__snapshots__/CarouselList.spec.ts.snap +36 -0
- package/src/components/carousel/index.ts +23 -0
- package/src/components/carousel/types.ts +17 -0
- package/src/components/checkbox/Checkbox.spec.ts +40 -0
- package/src/components/checkbox/Checkbox.vue +63 -0
- package/src/components/checkbox/CheckboxButton.spec.ts +46 -0
- package/src/components/checkbox/CheckboxButton.vue +59 -0
- package/src/components/checkbox/__snapshots__/Checkbox.spec.ts.snap +9 -0
- package/src/components/checkbox/__snapshots__/CheckboxButton.spec.ts.snap +3 -0
- package/src/components/checkbox/index.ts +20 -0
- package/src/components/clockpicker/Clockpicker.spec.ts +161 -0
- package/src/components/clockpicker/Clockpicker.vue +311 -0
- package/src/components/clockpicker/ClockpickerFace.spec.ts +99 -0
- package/src/components/clockpicker/ClockpickerFace.vue +272 -0
- package/src/components/clockpicker/__snapshots__/Clockpicker.spec.ts.snap +36 -0
- package/src/components/clockpicker/__snapshots__/ClockpickerFace.spec.ts.snap +9 -0
- package/src/components/clockpicker/index.ts +16 -0
- package/src/components/collapse/Collapse.spec.ts +106 -0
- package/src/components/collapse/Collapse.vue +98 -0
- package/src/components/collapse/__snapshots__/Collapse.spec.ts.snap +10 -0
- package/src/components/collapse/index.ts +16 -0
- package/src/components/colorpicker/Colorpicker.spec.ts +22 -0
- package/src/components/colorpicker/Colorpicker.vue +416 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.spec.ts +17 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.vue +205 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.ts +23 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +380 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.ts +23 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +456 -0
- package/src/components/colorpicker/__snapshots__/Colorpicker.spec.ts.snap +77 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerAlphaSlider.spec.ts.snap +9 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationSquare.spec.ts.snap +12 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationTriangle.spec.ts.snap +36 -0
- package/src/components/colorpicker/index.ts +16 -0
- package/src/components/datepicker/Datepicker.spec.ts +482 -0
- package/src/components/datepicker/Datepicker.vue +908 -0
- package/src/components/datepicker/DatepickerMonth.spec.ts +346 -0
- package/src/components/datepicker/DatepickerMonth.vue +444 -0
- package/src/components/datepicker/DatepickerTable.spec.ts +290 -0
- package/src/components/datepicker/DatepickerTable.vue +398 -0
- package/src/components/datepicker/DatepickerTableRow.spec.ts +300 -0
- package/src/components/datepicker/DatepickerTableRow.vue +416 -0
- package/src/components/datepicker/__snapshots__/Datepicker.spec.ts.snap +54 -0
- package/src/components/datepicker/__snapshots__/DatepickerMonth.spec.ts.snap +33 -0
- package/src/components/datepicker/__snapshots__/DatepickerTable.spec.ts.snap +16 -0
- package/src/components/datepicker/__snapshots__/DatepickerTableRow.spec.ts.snap +23 -0
- package/src/components/datepicker/index.ts +17 -0
- package/src/components/datepicker/types.ts +41 -0
- package/src/components/datetimepicker/Datetimepicker.spec.ts +132 -0
- package/src/components/datetimepicker/Datetimepicker.vue +491 -0
- package/src/components/datetimepicker/index.ts +16 -0
- package/src/components/dialog/Dialog.spec.ts +108 -0
- package/src/components/dialog/Dialog.vue +300 -0
- package/src/components/dialog/index.ts +169 -0
- package/src/components/dropdown/Dropdown.spec.ts +229 -0
- package/src/components/dropdown/Dropdown.vue +491 -0
- package/src/components/dropdown/DropdownItem.spec.ts +78 -0
- package/src/components/dropdown/DropdownItem.vue +112 -0
- package/src/components/dropdown/__snapshots__/Dropdown.spec.ts.snap +15 -0
- package/src/components/dropdown/__snapshots__/DropdownItem.spec.ts.snap +3 -0
- package/src/components/dropdown/index.ts +20 -0
- package/src/components/field/Field.spec.ts +324 -0
- package/src/components/field/Field.vue +316 -0
- package/src/components/field/FieldBody.spec.ts +96 -0
- package/src/components/field/FieldBody.vue +74 -0
- package/src/components/field/__snapshots__/Field.spec.ts.snap +8 -0
- package/src/components/field/__snapshots__/FieldBody.spec.ts.snap +3 -0
- package/src/components/field/index.ts +16 -0
- package/src/components/icon/Icon.spec.ts +142 -0
- package/src/components/icon/Icon.vue +120 -0
- package/src/components/icon/__snapshots__/Icon.spec.ts.snap +3 -0
- package/src/components/icon/index.ts +17 -0
- package/src/components/image/Image.spec.ts +218 -0
- package/src/components/image/Image.vue +358 -0
- package/src/components/image/__snapshots__/Image.spec.ts.snap +37 -0
- package/src/components/image/index.ts +16 -0
- package/src/components/index.ts +179 -0
- package/src/components/input/Input.spec.ts +396 -0
- package/src/components/input/Input.vue +335 -0
- package/src/components/input/__snapshots__/Input.spec.ts.snap +9 -0
- package/src/components/input/index.ts +17 -0
- package/src/components/loading/Loading.spec.ts +151 -0
- package/src/components/loading/Loading.vue +135 -0
- package/src/components/loading/__snapshots__/Loading.spec.ts.snap +10 -0
- package/src/components/loading/index.ts +91 -0
- package/src/components/menu/Menu.spec.ts +21 -0
- package/src/components/menu/Menu.vue +31 -0
- package/src/components/menu/MenuItem.spec.ts +92 -0
- package/src/components/menu/MenuItem.vue +168 -0
- package/src/components/menu/MenuItemContainerMixin.ts +72 -0
- package/src/components/menu/MenuList.spec.ts +35 -0
- package/src/components/menu/MenuList.vue +47 -0
- package/src/components/menu/__snapshots__/Menu.spec.ts.snap +3 -0
- package/src/components/menu/__snapshots__/MenuItem.spec.ts.snap +9 -0
- package/src/components/menu/__snapshots__/MenuList.spec.ts.snap +8 -0
- package/src/components/menu/index.ts +25 -0
- package/src/components/message/Message.spec.ts +30 -0
- package/src/components/message/Message.vue +73 -0
- package/src/components/message/__snapshots__/Message.spec.ts.snap +11 -0
- package/src/components/message/index.ts +15 -0
- package/src/components/modal/Modal.spec.ts +167 -0
- package/src/components/modal/Modal.vue +335 -0
- package/src/components/modal/__snapshots__/Modal.spec.ts.snap +10 -0
- package/src/components/modal/index.ts +107 -0
- package/src/components/navbar/NavBar.spec.ts +78 -0
- package/src/components/navbar/NavBarBurger.spec.ts +30 -0
- package/src/components/navbar/NavBarItem.spec.ts +92 -0
- package/src/components/navbar/Navbar.vue +274 -0
- package/src/components/navbar/NavbarBurger.vue +29 -0
- package/src/components/navbar/NavbarDropdown.spec.ts +84 -0
- package/src/components/navbar/NavbarDropdown.vue +115 -0
- package/src/components/navbar/NavbarItem.vue +97 -0
- package/src/components/navbar/__snapshots__/NavBar.spec.ts.snap +11 -0
- package/src/components/navbar/__snapshots__/NavBarBurger.spec.ts.snap +3 -0
- package/src/components/navbar/__snapshots__/NavBarItem.spec.ts.snap +3 -0
- package/src/components/navbar/__snapshots__/NavbarDropdown.spec.ts.snap +7 -0
- package/src/components/navbar/index.ts +22 -0
- package/src/components/notification/Notification.spec.ts +21 -0
- package/src/components/notification/Notification.vue +77 -0
- package/src/components/notification/NotificationNotice.vue +76 -0
- package/src/components/notification/__snapshots__/Notification.spec.ts.snap +10 -0
- package/src/components/notification/index.ts +121 -0
- package/src/components/numberinput/Numberinput.spec.ts +445 -0
- package/src/components/numberinput/Numberinput.vue +372 -0
- package/src/components/numberinput/index.ts +16 -0
- package/src/components/pagination/Pagination.spec.ts +94 -0
- package/src/components/pagination/Pagination.vue +434 -0
- package/src/components/pagination/PaginationButton.spec.ts +42 -0
- package/src/components/pagination/PaginationButton.vue +59 -0
- package/src/components/pagination/__snapshots__/Pagination.spec.ts.snap +22 -0
- package/src/components/pagination/__snapshots__/PaginationButton.spec.ts.snap +3 -0
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/types.ts +11 -0
- package/src/components/progress/Progress.spec.ts +81 -0
- package/src/components/progress/Progress.vue +168 -0
- package/src/components/progress/ProgressBar.spec.ts +45 -0
- package/src/components/progress/ProgressBar.vue +74 -0
- package/src/components/progress/__snapshots__/Progress.spec.ts.snap +7 -0
- package/src/components/progress/__snapshots__/ProgressBar.spec.ts.snap +7 -0
- package/src/components/progress/index.ts +18 -0
- package/src/components/radio/Radio.spec.ts +40 -0
- package/src/components/radio/Radio.vue +35 -0
- package/src/components/radio/RadioButton.spec.ts +40 -0
- package/src/components/radio/RadioButton.vue +69 -0
- package/src/components/radio/__snapshots__/Radio.spec.ts.snap +3 -0
- package/src/components/radio/__snapshots__/RadioButton.spec.ts.snap +3 -0
- package/src/components/radio/index.ts +18 -0
- package/src/components/rate/Rate.spec.ts +90 -0
- package/src/components/rate/Rate.vue +158 -0
- package/src/components/rate/index.ts +15 -0
- package/src/components/select/Select.spec.ts +74 -0
- package/src/components/select/Select.vue +118 -0
- package/src/components/select/__snapshots__/Select.spec.ts.snap +7 -0
- package/src/components/select/index.ts +16 -0
- package/src/components/sidebar/Sidebar.spec.ts +107 -0
- package/src/components/sidebar/Sidebar.vue +316 -0
- package/src/components/sidebar/__snapshots__/Sidebar.spec.ts.snap +25 -0
- package/src/components/sidebar/index.ts +16 -0
- package/src/components/skeleton/Skeleton.spec.ts +16 -0
- package/src/components/skeleton/Skeleton.vue +98 -0
- package/src/components/skeleton/__snapshots__/Skeleton.spec.ts.snap +7 -0
- package/src/components/skeleton/index.ts +18 -0
- package/src/components/slider/Slider.spec.ts +115 -0
- package/src/components/slider/Slider.vue +374 -0
- package/src/components/slider/SliderThumb.spec.ts +176 -0
- package/src/components/slider/SliderThumb.vue +251 -0
- package/src/components/slider/SliderTick.spec.ts +33 -0
- package/src/components/slider/SliderTick.vue +50 -0
- package/src/components/slider/__snapshots__/Slider.spec.ts.snap +12 -0
- package/src/components/slider/__snapshots__/SliderThumb.spec.ts.snap +16 -0
- package/src/components/slider/__snapshots__/SliderTick.spec.ts.snap +7 -0
- package/src/components/slider/index.ts +19 -0
- package/src/components/slider/types.ts +34 -0
- package/src/components/snackbar/Snackbar.spec.ts +35 -0
- package/src/components/snackbar/Snackbar.vue +88 -0
- package/src/components/snackbar/__snapshots__/Snackbar.spec.ts.snap +12 -0
- package/src/components/snackbar/index.ts +118 -0
- package/src/components/steps/StepItem.spec.ts +114 -0
- package/src/components/steps/StepItem.vue +26 -0
- package/src/components/steps/Steps.spec.ts +125 -0
- package/src/components/steps/Steps.vue +273 -0
- package/src/components/steps/__snapshots__/StepItem.spec.ts.snap +7 -0
- package/src/components/steps/__snapshots__/Steps.spec.ts.snap +40 -0
- package/src/components/steps/index.ts +19 -0
- package/src/components/switch/Switch.spec.ts +74 -0
- package/src/components/switch/Switch.vue +146 -0
- package/src/components/switch/__snapshots__/Switch.spec.ts.snap +3 -0
- package/src/components/switch/index.ts +16 -0
- package/src/components/table/Table.spec.ts +622 -0
- package/src/components/table/Table.vue +1770 -0
- package/src/components/table/TableColumn.spec.ts +85 -0
- package/src/components/table/TableColumn.vue +140 -0
- package/src/components/table/TableMobileSort.spec.ts +47 -0
- package/src/components/table/TableMobileSort.vue +236 -0
- package/src/components/table/TablePagination.vue +86 -0
- package/src/components/table/__snapshots__/Table.spec.ts.snap +24 -0
- package/src/components/table/__snapshots__/TableMobileSort.spec.ts.snap +12 -0
- package/src/components/table/index.ts +32 -0
- package/src/components/table/mockTableColumn.ts +110 -0
- package/src/components/table/types.ts +110 -0
- package/src/components/tabs/TabItem.spec.ts +203 -0
- package/src/components/tabs/TabItem.vue +19 -0
- package/src/components/tabs/Tabs.spec.ts +122 -0
- package/src/components/tabs/Tabs.vue +204 -0
- package/src/components/tabs/__snapshots__/TabItem.spec.ts.snap +7 -0
- package/src/components/tabs/__snapshots__/Tabs.spec.ts.snap +33 -0
- package/src/components/tabs/index.ts +19 -0
- package/src/components/tag/Tag.spec.ts +32 -0
- package/src/components/tag/Tag.vue +132 -0
- package/src/components/tag/Taglist.spec.ts +21 -0
- package/src/components/tag/Taglist.vue +16 -0
- package/src/components/tag/__snapshots__/Tag.spec.ts.snap +6 -0
- package/src/components/tag/__snapshots__/Taglist.spec.ts.snap +3 -0
- package/src/components/tag/index.ts +19 -0
- package/src/components/taginput/Taginput.spec.ts +132 -0
- package/src/components/taginput/Taginput.vue +415 -0
- package/src/components/taginput/__snapshots__/Taginput.spec.ts.snap +10 -0
- package/src/components/taginput/index.ts +16 -0
- package/src/components/timepicker/Timepicker.spec.ts +108 -0
- package/src/components/timepicker/Timepicker.vue +183 -0
- package/src/components/timepicker/__snapshots__/Timepicker.spec.ts.snap +41 -0
- package/src/components/timepicker/index.ts +17 -0
- package/src/components/toast/Toast.spec.ts +74 -0
- package/src/components/toast/Toast.vue +46 -0
- package/src/components/toast/__snapshots__/Toast.spec.ts.snap +10 -0
- package/src/components/toast/index.ts +120 -0
- package/src/components/tooltip/Tooltip.spec.ts +64 -0
- package/src/components/tooltip/Tooltip.vue +393 -0
- package/src/components/tooltip/__snapshots__/Tooltip.spec.ts.snap +12 -0
- package/src/components/tooltip/index.ts +16 -0
- package/src/components/upload/Upload.spec.ts +62 -0
- package/src/components/upload/Upload.vue +188 -0
- package/src/components/upload/__snapshots__/Upload.spec.ts.snap +3 -0
- package/src/components/upload/index.ts +15 -0
- package/src/directives/clickOutside.ts +113 -0
- package/src/directives/trapFocus.ts +61 -0
- package/src/index.ts +43 -0
- package/src/scss/buefy-build.scss +6 -0
- package/src/scss/buefy.scss +39 -0
- package/src/scss/components/_autocomplete.scss +39 -0
- package/src/scss/components/_carousel.scss +204 -0
- package/src/scss/components/_checkbox.scss +106 -0
- package/src/scss/components/_clockpicker.scss +283 -0
- package/src/scss/components/_collapse.scss +9 -0
- package/src/scss/components/_colorpicker.scss +283 -0
- package/src/scss/components/_datepicker.scss +220 -0
- package/src/scss/components/_dialog.scss +54 -0
- package/src/scss/components/_dropdown.scss +143 -0
- package/src/scss/components/_form.scss +309 -0
- package/src/scss/components/_icon.scss +16 -0
- package/src/scss/components/_image.scss +20 -0
- package/src/scss/components/_loading.scss +45 -0
- package/src/scss/components/_menu.scss +11 -0
- package/src/scss/components/_message.scss +16 -0
- package/src/scss/components/_modal.scss +37 -0
- package/src/scss/components/_navbar.scss +22 -0
- package/src/scss/components/_notices.scss +144 -0
- package/src/scss/components/_notification.scss +8 -0
- package/src/scss/components/_numberinput.scss +33 -0
- package/src/scss/components/_pagination.scss +63 -0
- package/src/scss/components/_progress.scss +105 -0
- package/src/scss/components/_radio.scss +123 -0
- package/src/scss/components/_rate.scss +72 -0
- package/src/scss/components/_select.scss +38 -0
- package/src/scss/components/_sidebar.scss +107 -0
- package/src/scss/components/_skeleton.scss +66 -0
- package/src/scss/components/_slider.scss +162 -0
- package/src/scss/components/_steps.scss +491 -0
- package/src/scss/components/_switch.scss +214 -0
- package/src/scss/components/_table.scss +322 -0
- package/src/scss/components/_tabs.scss +197 -0
- package/src/scss/components/_tag.scss +36 -0
- package/src/scss/components/_taginput.scss +73 -0
- package/src/scss/components/_timepicker.scss +73 -0
- package/src/scss/components/_tooltip.scss +192 -0
- package/src/scss/components/_upload.scss +62 -0
- package/src/scss/utils/_all.scss +4 -0
- package/src/scss/utils/_animations.scss +183 -0
- package/src/scss/utils/_functions.scss +49 -0
- package/src/scss/utils/_helpers.scss +6 -0
- package/src/scss/utils/_variables-ext.scss +2 -0
- package/src/scss/utils/_variables.scss +16 -0
- package/src/utils/CheckRadioMixin.spec.ts +28 -0
- package/src/utils/CheckRadioMixin.ts +61 -0
- package/src/utils/CompatFallthroughMixin.ts +34 -0
- package/src/utils/ConfigComponent.ts +12 -0
- package/src/utils/FormElementMixin.spec.ts +41 -0
- package/src/utils/FormElementMixin.ts +206 -0
- package/src/utils/InjectedChildMixin.ts +139 -0
- package/src/utils/MessageMixin.spec.ts +51 -0
- package/src/utils/MessageMixin.ts +138 -0
- package/src/utils/NoticeMixin.spec.ts +55 -0
- package/src/utils/NoticeMixin.ts +181 -0
- package/src/utils/ProvideInjectTypes.ts +20 -0
- package/src/utils/ProviderParentMixin.ts +105 -0
- package/src/utils/SlotComponent.spec.ts +55 -0
- package/src/utils/SlotComponent.ts +38 -0
- package/src/utils/TabbedChildMixin.ts +96 -0
- package/src/utils/TabbedMixin.ts +166 -0
- package/src/utils/TabbedTypes.ts +33 -0
- package/src/utils/TimepickerMixin.spec.ts +75 -0
- package/src/utils/TimepickerMixin.ts +767 -0
- package/src/utils/color.spec.ts +55 -0
- package/src/utils/color.ts +507 -0
- package/src/utils/config.spec.ts +11 -0
- package/src/utils/config.ts +619 -0
- package/src/utils/debounce.spec.ts +52 -0
- package/src/utils/debounce.ts +20 -0
- package/src/utils/helpers.spec.ts +257 -0
- package/src/utils/helpers.ts +527 -0
- package/src/utils/icons.ts +73 -0
- package/src/utils/plugins.ts +20 -0
- package/src/utils/ssr.ts +6 -0
- package/src/utils/vue-augmentation.ts +35 -0
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
import { mount, shallowMount } from '@vue/test-utils'
|
|
2
|
+
import type { DOMWrapper, VueWrapper } from '@vue/test-utils'
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import { nextTick } from 'vue'
|
|
5
|
+
import BAutocomplete from '@components/autocomplete/Autocomplete.vue'
|
|
6
|
+
|
|
7
|
+
const findStringsStartingWith = (array: string[], value: string) =>
|
|
8
|
+
array.filter((x) => x.startsWith(value))
|
|
9
|
+
|
|
10
|
+
const DATA_LIST = [
|
|
11
|
+
'Angular',
|
|
12
|
+
'Angular 2',
|
|
13
|
+
'Aurelia',
|
|
14
|
+
'Backbone',
|
|
15
|
+
'Ember',
|
|
16
|
+
'jQuery',
|
|
17
|
+
'Meteor',
|
|
18
|
+
'Node.js',
|
|
19
|
+
'Polymer',
|
|
20
|
+
'React',
|
|
21
|
+
'RxJS',
|
|
22
|
+
'Vue.js'
|
|
23
|
+
]
|
|
24
|
+
const dropdownMenu = '.dropdown-menu'
|
|
25
|
+
let wrapper: VueWrapper<InstanceType<typeof BAutocomplete>>
|
|
26
|
+
let $input: DOMWrapper<HTMLInputElement | HTMLTextAreaElement>
|
|
27
|
+
let $dropdown: DOMWrapper<Element>
|
|
28
|
+
const stubs = { 'b-icon': true }
|
|
29
|
+
|
|
30
|
+
describe('BAutocomplete', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
wrapper = mount(BAutocomplete, {
|
|
33
|
+
attachTo: document.body, // isVisible tests require attachTo
|
|
34
|
+
props: {
|
|
35
|
+
checkInfiniteScroll: true
|
|
36
|
+
},
|
|
37
|
+
global: {
|
|
38
|
+
stubs
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
$input = wrapper.find('input')
|
|
43
|
+
$dropdown = wrapper.find(dropdownMenu)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('renders and initializes correctly', () => {
|
|
47
|
+
expect(wrapper.vm).toBeTruthy()
|
|
48
|
+
expect(wrapper.vm.$options.name).toBe('BAutocomplete')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('render correctly', () => {
|
|
52
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('has an input type', () => {
|
|
56
|
+
expect(wrapper.find('.control .input[type=text]').exists()).toBeTruthy()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('has a dropdown menu hidden by default', () => {
|
|
60
|
+
expect(wrapper.find(dropdownMenu).exists()).toBeTruthy()
|
|
61
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('can apply a maximum height for the dropdown', async () => {
|
|
65
|
+
expect(wrapper.vm.contentStyle.maxHeight).toBeUndefined()
|
|
66
|
+
|
|
67
|
+
const maxHeight = 200
|
|
68
|
+
|
|
69
|
+
await wrapper.setProps({ maxHeight })
|
|
70
|
+
expect(wrapper.vm.contentStyle.maxHeight).toBe(`${maxHeight}px`)
|
|
71
|
+
await wrapper.setProps({ maxHeight: `${maxHeight}rem` })
|
|
72
|
+
expect(wrapper.vm.contentStyle.maxHeight).toBe(`${maxHeight}rem`)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('can select a value using v-model', async () => {
|
|
76
|
+
const modelValue = DATA_LIST[0]
|
|
77
|
+
await wrapper.setProps({ modelValue })
|
|
78
|
+
expect(wrapper.vm.newValue).toBe(modelValue)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('can emit input, focus and blur events', async () => {
|
|
82
|
+
const VALUE_TYPED = 'test'
|
|
83
|
+
await wrapper.setProps({ data: DATA_LIST })
|
|
84
|
+
|
|
85
|
+
await $input.trigger('focus')
|
|
86
|
+
expect(wrapper.emitted().focus).toBeTruthy()
|
|
87
|
+
await $input.setValue(VALUE_TYPED)
|
|
88
|
+
|
|
89
|
+
const valueEmitted = wrapper.emitted()['update:modelValue'][0]
|
|
90
|
+
expect(valueEmitted).toContainEqual(VALUE_TYPED)
|
|
91
|
+
|
|
92
|
+
await $input.trigger('blur')
|
|
93
|
+
expect(wrapper.emitted().blur).toBeTruthy()
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('can emit select-header by keyboard and click', async () => {
|
|
97
|
+
const VALUE_TYPED = 'test'
|
|
98
|
+
const wrapper = mount(BAutocomplete, {
|
|
99
|
+
props: {
|
|
100
|
+
checkInfiniteScroll: true,
|
|
101
|
+
selectableHeader: true,
|
|
102
|
+
selectableFooter: true
|
|
103
|
+
},
|
|
104
|
+
slots: {
|
|
105
|
+
header: '<h1>SLOT HEADER</h1>',
|
|
106
|
+
footer: '<h1>SLOT FOOTER</h1>'
|
|
107
|
+
},
|
|
108
|
+
global: {
|
|
109
|
+
stubs
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
const $input = wrapper.find('input')
|
|
113
|
+
|
|
114
|
+
await $input.trigger('focus')
|
|
115
|
+
await $input.setValue(VALUE_TYPED)
|
|
116
|
+
|
|
117
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
118
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
119
|
+
|
|
120
|
+
const $header = wrapper.find('.dropdown-item.dropdown-header')
|
|
121
|
+
await $header.trigger('click')
|
|
122
|
+
|
|
123
|
+
const emitted = wrapper.emitted()
|
|
124
|
+
|
|
125
|
+
expect(emitted['select-header']).toBeTruthy()
|
|
126
|
+
expect(emitted['select-header']).toHaveLength(2)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('can emit select-footer by keyboard and click', async () => {
|
|
130
|
+
const VALUE_TYPED = 'test'
|
|
131
|
+
const wrapper = mount(BAutocomplete, {
|
|
132
|
+
propsData: {
|
|
133
|
+
checkInfiniteScroll: true,
|
|
134
|
+
selectableHeader: true,
|
|
135
|
+
selectableFooter: true
|
|
136
|
+
},
|
|
137
|
+
slots: {
|
|
138
|
+
header: '<h1>SLOT HEADER</h1>',
|
|
139
|
+
footer: '<h1>SLOT FOOTER</h1>'
|
|
140
|
+
},
|
|
141
|
+
global: {
|
|
142
|
+
stubs
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
const $input = wrapper.find('input')
|
|
146
|
+
|
|
147
|
+
await $input.trigger('focus')
|
|
148
|
+
await $input.setValue(VALUE_TYPED)
|
|
149
|
+
|
|
150
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
151
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
152
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
153
|
+
await $input.trigger('blur')
|
|
154
|
+
|
|
155
|
+
const $footer = wrapper.find('.dropdown-item.dropdown-footer')
|
|
156
|
+
await $footer.trigger('click')
|
|
157
|
+
|
|
158
|
+
const emitted = wrapper.emitted()
|
|
159
|
+
|
|
160
|
+
expect(emitted['select-footer']).toBeTruthy()
|
|
161
|
+
expect(emitted['select-footer']).toHaveLength(2)
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
it('can autocomplete with keydown', async () => {
|
|
165
|
+
const VALUE_TYPED = 'Ang'
|
|
166
|
+
await wrapper.setProps({ data: DATA_LIST })
|
|
167
|
+
|
|
168
|
+
await $input.trigger('focus')
|
|
169
|
+
await $input.setValue(VALUE_TYPED)
|
|
170
|
+
|
|
171
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
172
|
+
|
|
173
|
+
const itemsInDropdowm = findStringsStartingWith(DATA_LIST, VALUE_TYPED)
|
|
174
|
+
|
|
175
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
176
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
177
|
+
|
|
178
|
+
expect($input.element.value).toBe(itemsInDropdowm[0])
|
|
179
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
180
|
+
|
|
181
|
+
await $input.trigger('focus')
|
|
182
|
+
await $input.setValue(VALUE_TYPED)
|
|
183
|
+
|
|
184
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
185
|
+
|
|
186
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
187
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
188
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
189
|
+
|
|
190
|
+
expect($input.element.value).toBe(itemsInDropdowm[1])
|
|
191
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
it('close dropdown on esc', async () => {
|
|
195
|
+
vi.useFakeTimers()
|
|
196
|
+
await wrapper.setProps({ data: DATA_LIST })
|
|
197
|
+
|
|
198
|
+
await wrapper.setData({ isActive: true })
|
|
199
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
200
|
+
|
|
201
|
+
await $input.trigger('keydown', { key: 'Escape' })
|
|
202
|
+
|
|
203
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
204
|
+
|
|
205
|
+
wrapper.vm.calcDropdownInViewportVertical = vi.fn(
|
|
206
|
+
() => wrapper.vm.calcDropdownInViewportVertical
|
|
207
|
+
)
|
|
208
|
+
vi.runAllTimers()
|
|
209
|
+
expect(wrapper.vm.calcDropdownInViewportVertical).toHaveBeenCalled()
|
|
210
|
+
vi.useRealTimers()
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
it('close dropdown on click outside', async () => {
|
|
214
|
+
await wrapper.setProps({ data: DATA_LIST })
|
|
215
|
+
|
|
216
|
+
await wrapper.setData({ isActive: true })
|
|
217
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
218
|
+
|
|
219
|
+
window.document.body.click()
|
|
220
|
+
await wrapper.vm.$nextTick()
|
|
221
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
222
|
+
vi.useRealTimers()
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
it('open dropdown on down key click', async () => {
|
|
226
|
+
wrapper.vm.setHovered = vi.fn(() => wrapper.vm.setHovered)
|
|
227
|
+
await wrapper.setProps({
|
|
228
|
+
data: DATA_LIST,
|
|
229
|
+
dropdownPosition: 'bottom'
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
233
|
+
|
|
234
|
+
await $input.trigger('focus')
|
|
235
|
+
await $input.trigger('keydown.down')
|
|
236
|
+
|
|
237
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
it('manages tab pressed as expected', async () => {
|
|
241
|
+
// hovered is null
|
|
242
|
+
await $input.trigger('keydown', { key: 'Tab' })
|
|
243
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
244
|
+
|
|
245
|
+
// The first element will be hovered
|
|
246
|
+
await wrapper.setProps({
|
|
247
|
+
openOnFocus: true,
|
|
248
|
+
keepFirst: true
|
|
249
|
+
})
|
|
250
|
+
await wrapper.setProps({
|
|
251
|
+
data: DATA_LIST
|
|
252
|
+
})
|
|
253
|
+
// Set props in 2 steps to trigger Watch with keepFirst true so the 1st element is hovered
|
|
254
|
+
|
|
255
|
+
await $input.trigger('focus')
|
|
256
|
+
|
|
257
|
+
await $input.trigger('keydown', { key: 'Tab' })
|
|
258
|
+
expect($input.element.value).toBe(DATA_LIST[0])
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
it('can be used with objects', async () => {
|
|
262
|
+
const data = [
|
|
263
|
+
{
|
|
264
|
+
id: 1,
|
|
265
|
+
name: 'Value 1'
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: 2,
|
|
269
|
+
name: 'Value 2'
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
await wrapper.setProps({
|
|
273
|
+
data,
|
|
274
|
+
field: 'name'
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
await wrapper.setData({ isActive: true })
|
|
278
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
279
|
+
|
|
280
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
281
|
+
expect(wrapper.vm.hovered).toBeNull()
|
|
282
|
+
|
|
283
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
284
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
285
|
+
expect($input.element.value).toBe(data[0].name)
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
it('clears the value if clearOnSelect is used', async () => {
|
|
289
|
+
await wrapper.setProps({
|
|
290
|
+
data: DATA_LIST,
|
|
291
|
+
clearOnSelect: true
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
await wrapper.setData({ isActive: true })
|
|
295
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
296
|
+
|
|
297
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
298
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
299
|
+
expect($input.element.value).toBe('')
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
it('supports custom formatter', async () => {
|
|
303
|
+
await wrapper.setProps({
|
|
304
|
+
data: DATA_LIST,
|
|
305
|
+
customFormatter: (val: string) => `${val} formatted`
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
await wrapper.setData({ isActive: true })
|
|
309
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
310
|
+
|
|
311
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
312
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
313
|
+
expect($input.element.value).toBe(`${DATA_LIST[0]} formatted`)
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
it('can openOnFocus and keepFirst', async () => {
|
|
317
|
+
await wrapper.setProps({
|
|
318
|
+
openOnFocus: true,
|
|
319
|
+
keepFirst: true
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
expect($dropdown.isVisible()).toBeFalsy()
|
|
323
|
+
|
|
324
|
+
await $input.trigger('focus')
|
|
325
|
+
expect(wrapper.vm.hovered).toBeNull()
|
|
326
|
+
|
|
327
|
+
await wrapper.setProps({
|
|
328
|
+
data: DATA_LIST
|
|
329
|
+
}) // Set props in 2 steps to trigger the Watch for data having keepFirst true
|
|
330
|
+
|
|
331
|
+
await $input.trigger('focus')
|
|
332
|
+
|
|
333
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
334
|
+
|
|
335
|
+
expect(wrapper.vm.hovered).toBe(DATA_LIST[0])
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
it('clear button does not exist when the search input is empty', async () => {
|
|
339
|
+
await wrapper.setData({ newValue: '' })
|
|
340
|
+
await wrapper.setProps({ clearable: true })
|
|
341
|
+
const subject = wrapper.find('b-icon-stub').exists()
|
|
342
|
+
|
|
343
|
+
expect(subject).toBeFalsy()
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
it('clear button exists when the search input is not empty and clearable property is true', async () => {
|
|
347
|
+
await wrapper.setData({ newValue: 'Jquery' })
|
|
348
|
+
await wrapper.setProps({ clearable: true })
|
|
349
|
+
const subject = wrapper.find('b-icon-stub').exists()
|
|
350
|
+
|
|
351
|
+
expect(subject).toBeTruthy()
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
it('clears search input text when clear button gets clicked', async () => {
|
|
355
|
+
await wrapper.setData({ newValue: 'Jquery' })
|
|
356
|
+
await wrapper.setProps({ clearable: true })
|
|
357
|
+
wrapper.find('b-icon-stub').trigger('click')
|
|
358
|
+
const subject = wrapper.vm.newValue
|
|
359
|
+
|
|
360
|
+
expect(subject).toEqual('')
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
it('clear button does not appear when clearable property is not set to true', async () => {
|
|
364
|
+
await wrapper.setData({ newValue: 'Jquery' })
|
|
365
|
+
const subject = wrapper.find('b-icon-stub').exists()
|
|
366
|
+
|
|
367
|
+
expect(subject).toBeFalsy()
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
it('can have a custom clickable right icon', async () => {
|
|
371
|
+
await wrapper.setProps({
|
|
372
|
+
iconRight: 'delete',
|
|
373
|
+
iconRightClickable: true
|
|
374
|
+
})
|
|
375
|
+
const icon = wrapper.find('b-icon-stub')
|
|
376
|
+
expect(icon.exists()).toBeTruthy()
|
|
377
|
+
|
|
378
|
+
await icon.trigger('click')
|
|
379
|
+
expect(wrapper.emitted()['icon-right-click']).toBeTruthy()
|
|
380
|
+
})
|
|
381
|
+
|
|
382
|
+
it('cleans up event listeners on unmount', () => {
|
|
383
|
+
document.removeEventListener = vi.fn()
|
|
384
|
+
window.removeEventListener = vi.fn()
|
|
385
|
+
|
|
386
|
+
wrapper.unmount()
|
|
387
|
+
|
|
388
|
+
expect(document.removeEventListener).toBeCalledWith('click', expect.any(Function))
|
|
389
|
+
expect(window.removeEventListener).toBeCalledWith('resize', expect.any(Function))
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
it('emit active with payload true', async () => {
|
|
393
|
+
await wrapper.setProps({
|
|
394
|
+
data: DATA_LIST,
|
|
395
|
+
openOnFocus: true,
|
|
396
|
+
keepFirst: true
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
await $input.trigger('focus')
|
|
400
|
+
|
|
401
|
+
const { active } = wrapper.emitted()
|
|
402
|
+
|
|
403
|
+
expect(active).toBeTruthy()
|
|
404
|
+
expect(active[0]).toEqual([true])
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
it('updates ariaAutocomplete with keepFirst', async () => {
|
|
408
|
+
await wrapper.setProps({ keepFirst: true })
|
|
409
|
+
expect(wrapper.vm.ariaAutocomplete).toBe('both')
|
|
410
|
+
await wrapper.setProps({ keepFirst: false })
|
|
411
|
+
expect(wrapper.vm.ariaAutocomplete).toBe('list')
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
it('clears selection when value changes from 0', async () => {
|
|
415
|
+
await wrapper.setProps({ data: [0, 1] })
|
|
416
|
+
wrapper.vm.setSelected(0)
|
|
417
|
+
await wrapper.vm.$nextTick()
|
|
418
|
+
await wrapper.setData({ newValue: '1' })
|
|
419
|
+
expect(wrapper.vm.selected).toBeNull()
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
it('opens dropdown when value is 0', async () => {
|
|
423
|
+
await wrapper.setProps({ data: ['0', '1'] })
|
|
424
|
+
await wrapper.setData({ hasFocus: true })
|
|
425
|
+
await $input.setValue('0')
|
|
426
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
it('updates model when clearOnSelect is used', async () => {
|
|
430
|
+
await wrapper.setProps({ data: DATA_LIST, clearOnSelect: true })
|
|
431
|
+
await wrapper.setData({ isActive: true })
|
|
432
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
433
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
434
|
+
const emitted = wrapper.emitted()['update:modelValue']
|
|
435
|
+
expect(emitted[emitted.length - 1]).toEqual([''])
|
|
436
|
+
})
|
|
437
|
+
|
|
438
|
+
it('updates whiteList when data changes', async () => {
|
|
439
|
+
await wrapper.setProps({ data: ['a'] })
|
|
440
|
+
const len = wrapper.vm.whiteList.length
|
|
441
|
+
await wrapper.setProps({ data: ['a', 'b'] })
|
|
442
|
+
await wrapper.vm.$nextTick()
|
|
443
|
+
expect(wrapper.vm.whiteList.length).toBeGreaterThan(len)
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
describe('fallthrough attributes', () => {
|
|
447
|
+
const attrs = {
|
|
448
|
+
class: 'fallthrough-class',
|
|
449
|
+
style: 'font-size: 2rem;',
|
|
450
|
+
id: 'fallthrough-id'
|
|
451
|
+
}
|
|
452
|
+
it('binds class/style/id to root if compatFallthrough true', async () => {
|
|
453
|
+
const wrapper = shallowMount(BAutocomplete, { attrs })
|
|
454
|
+
|
|
455
|
+
const root = wrapper.find('div.autocomplete.control')
|
|
456
|
+
expect(root.classes(attrs.class)).toBe(true)
|
|
457
|
+
expect(root.attributes('style')).toBe(attrs.style)
|
|
458
|
+
expect(root.attributes('id')).toBe(attrs.id)
|
|
459
|
+
|
|
460
|
+
const input = wrapper.findComponent({ ref: 'input' })
|
|
461
|
+
expect(input.classes(attrs.class)).toBe(false)
|
|
462
|
+
expect(input.attributes('style')).toBeUndefined()
|
|
463
|
+
expect(input.attributes('id')).toBeUndefined()
|
|
464
|
+
})
|
|
465
|
+
it('binds class/style/id to input if compatFallthrough false', async () => {
|
|
466
|
+
const wrapper = shallowMount(BAutocomplete, {
|
|
467
|
+
attrs,
|
|
468
|
+
props: { compatFallthrough: false }
|
|
469
|
+
})
|
|
470
|
+
|
|
471
|
+
const input = wrapper.findComponent({ ref: 'input' })
|
|
472
|
+
expect(input.classes(attrs.class)).toBe(true)
|
|
473
|
+
expect(input.attributes('style')).toBe(attrs.style)
|
|
474
|
+
expect(input.attributes('id')).toBe(attrs.id)
|
|
475
|
+
|
|
476
|
+
const root = wrapper.find('div.autocomplete.control')
|
|
477
|
+
expect(root.classes(attrs.class)).toBe(false)
|
|
478
|
+
expect(root.attributes('style')).toBeUndefined()
|
|
479
|
+
expect(root.attributes('id')).toBeUndefined()
|
|
480
|
+
})
|
|
481
|
+
})
|
|
482
|
+
|
|
483
|
+
// Test for bug #4098: Arrow key selection doesn't work with computed data
|
|
484
|
+
it('should handle arrow key navigation with computed data containing objects', async () => {
|
|
485
|
+
// This test reproduces the bug where arrow key navigation fails with computed data
|
|
486
|
+
// that contains objects, due to proxy comparison issues
|
|
487
|
+
|
|
488
|
+
const DATA_OBJECTS = [
|
|
489
|
+
{ id: 1, name: 'Angular' },
|
|
490
|
+
{ id: 2, name: 'React' },
|
|
491
|
+
{ id: 3, name: 'Vue.js' }
|
|
492
|
+
]
|
|
493
|
+
|
|
494
|
+
// Simulate computed data by creating a new array reference each time
|
|
495
|
+
// This mimics how Vue's reactivity system creates new proxy objects
|
|
496
|
+
const createComputedData = () => {
|
|
497
|
+
return DATA_OBJECTS.map((item) => ({ ...item }))
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// Set initial data
|
|
501
|
+
await wrapper.setProps({
|
|
502
|
+
data: createComputedData(),
|
|
503
|
+
field: 'name',
|
|
504
|
+
openOnFocus: true
|
|
505
|
+
})
|
|
506
|
+
|
|
507
|
+
// Focus and open dropdown
|
|
508
|
+
await $input.trigger('focus')
|
|
509
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
510
|
+
|
|
511
|
+
// Update data to simulate computed property changes (creates new object references)
|
|
512
|
+
// This is where the bug manifests - the hovered item reference becomes stale
|
|
513
|
+
await wrapper.setProps({ data: createComputedData() })
|
|
514
|
+
|
|
515
|
+
// Try to navigate with arrow keys
|
|
516
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
517
|
+
|
|
518
|
+
// The first item should be hovered after pressing Down
|
|
519
|
+
expect(wrapper.vm.hovered).not.toBeNull()
|
|
520
|
+
expect(wrapper.vm.hovered?.name).toBe('Angular')
|
|
521
|
+
|
|
522
|
+
// Navigate to second item
|
|
523
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
524
|
+
|
|
525
|
+
// This should move to the second item, but due to the bug it might not work
|
|
526
|
+
expect(wrapper.vm.hovered?.name).toBe('React')
|
|
527
|
+
|
|
528
|
+
// Select the hovered item
|
|
529
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
530
|
+
expect($input.element.value).toBe('React')
|
|
531
|
+
})
|
|
532
|
+
|
|
533
|
+
it('should handle arrow key navigation consistently after data updates', async () => {
|
|
534
|
+
// Additional test to verify the fix works with multiple data updates
|
|
535
|
+
const DATA_OBJECTS = [
|
|
536
|
+
{ id: 1, name: 'Angular', category: 'framework' },
|
|
537
|
+
{ id: 2, name: 'React', category: 'library' },
|
|
538
|
+
{ id: 3, name: 'Vue.js', category: 'framework' }
|
|
539
|
+
]
|
|
540
|
+
|
|
541
|
+
await wrapper.setProps({
|
|
542
|
+
data: DATA_OBJECTS,
|
|
543
|
+
field: 'name',
|
|
544
|
+
openOnFocus: true
|
|
545
|
+
})
|
|
546
|
+
|
|
547
|
+
await $input.trigger('focus')
|
|
548
|
+
expect($dropdown.isVisible()).toBeTruthy()
|
|
549
|
+
|
|
550
|
+
// Navigate to second item
|
|
551
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
552
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
553
|
+
|
|
554
|
+
expect(wrapper.vm.hovered?.name).toBe('React')
|
|
555
|
+
|
|
556
|
+
// Update data (simulating computed property change)
|
|
557
|
+
const updatedData = DATA_OBJECTS.map((item) => ({ ...item, updated: true }))
|
|
558
|
+
await wrapper.setProps({ data: updatedData })
|
|
559
|
+
|
|
560
|
+
// Navigation should still work after data update
|
|
561
|
+
await $input.trigger('keydown', { key: 'Down' })
|
|
562
|
+
expect(wrapper.vm.hovered?.name).toBe('Vue.js')
|
|
563
|
+
|
|
564
|
+
await $input.trigger('keydown', { key: 'Enter' })
|
|
565
|
+
expect($input.element.value).toBe('Vue.js')
|
|
566
|
+
})
|
|
567
|
+
|
|
568
|
+
it('handles appendToBody prop changes', async () => {
|
|
569
|
+
const data = ['Angular', 'Vue.js', 'React']
|
|
570
|
+
const wrapper = mount(BAutocomplete, {
|
|
571
|
+
props: { data, appendToBody: false },
|
|
572
|
+
attachTo: document.body
|
|
573
|
+
})
|
|
574
|
+
await wrapper.setProps({ appendToBody: true })
|
|
575
|
+
const input = wrapper.find('input')
|
|
576
|
+
await input.trigger('focus')
|
|
577
|
+
wrapper.vm.newValue = 'Vue'
|
|
578
|
+
await wrapper.vm.$nextTick()
|
|
579
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
580
|
+
wrapper.unmount()
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
it('handles appendToBody switching back and forth', async () => {
|
|
584
|
+
const data = ['Angular', 'Vue.js', 'React']
|
|
585
|
+
const wrapper = mount(BAutocomplete, {
|
|
586
|
+
props: {
|
|
587
|
+
data,
|
|
588
|
+
appendToBody: false,
|
|
589
|
+
openOnFocus: true
|
|
590
|
+
},
|
|
591
|
+
attachTo: document.body
|
|
592
|
+
})
|
|
593
|
+
const input = wrapper.find('input')
|
|
594
|
+
await input.trigger('focus')
|
|
595
|
+
await wrapper.setProps({ appendToBody: true })
|
|
596
|
+
wrapper.vm.newValue = 'Vue'
|
|
597
|
+
await wrapper.vm.$nextTick()
|
|
598
|
+
expect(wrapper.vm.$data._bodyEl).toBeDefined()
|
|
599
|
+
await wrapper.setProps({ appendToBody: false })
|
|
600
|
+
expect(wrapper.vm.$data._bodyEl).toBeUndefined()
|
|
601
|
+
expect(wrapper.vm.isActive).toBe(true)
|
|
602
|
+
wrapper.unmount()
|
|
603
|
+
})
|
|
604
|
+
|
|
605
|
+
it('navigates correctly with infinite scroll)', async () => {
|
|
606
|
+
interface MovieData {
|
|
607
|
+
title: string;
|
|
608
|
+
poster_path: string;
|
|
609
|
+
release_date: string;
|
|
610
|
+
vote_average: number
|
|
611
|
+
}
|
|
612
|
+
const firstPageResults: MovieData[] = [
|
|
613
|
+
{
|
|
614
|
+
title: 'Spider-Man',
|
|
615
|
+
poster_path: 'path1.jpg',
|
|
616
|
+
release_date: '2002-05-03',
|
|
617
|
+
vote_average: 7.3
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
title: 'Spider-Man 2',
|
|
621
|
+
poster_path: 'path2.jpg',
|
|
622
|
+
release_date: '2004-06-30',
|
|
623
|
+
vote_average: 7.3
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
title: 'Spider-Man 3',
|
|
627
|
+
poster_path: 'path3.jpg',
|
|
628
|
+
release_date: '2007-05-04',
|
|
629
|
+
vote_average: 6.2
|
|
630
|
+
}
|
|
631
|
+
]
|
|
632
|
+
const secondPageResults: MovieData[] = [
|
|
633
|
+
{
|
|
634
|
+
title: 'The Amazing Spider-Man',
|
|
635
|
+
poster_path: 'path4.jpg',
|
|
636
|
+
release_date: '2012-07-03',
|
|
637
|
+
vote_average: 6.9
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
title: 'The Amazing Spider-Man 2',
|
|
641
|
+
poster_path: 'path5.jpg',
|
|
642
|
+
release_date: '2014-05-02',
|
|
643
|
+
vote_average: 6.6
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
title: 'Spider-Man: Homecoming',
|
|
647
|
+
poster_path: 'path6.jpg',
|
|
648
|
+
release_date: '2017-07-07',
|
|
649
|
+
vote_average: 7.4
|
|
650
|
+
}
|
|
651
|
+
]
|
|
652
|
+
const wrapper = mount(BAutocomplete, {
|
|
653
|
+
attachTo: document.body,
|
|
654
|
+
props: {
|
|
655
|
+
data: [],
|
|
656
|
+
field: 'title',
|
|
657
|
+
checkInfiniteScroll: true,
|
|
658
|
+
loading: false
|
|
659
|
+
}
|
|
660
|
+
})
|
|
661
|
+
try {
|
|
662
|
+
const input = wrapper.find('input')
|
|
663
|
+
wrapper.vm.isActive = true
|
|
664
|
+
await nextTick()
|
|
665
|
+
await wrapper.setProps({ data: firstPageResults })
|
|
666
|
+
await nextTick()
|
|
667
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
668
|
+
expect(wrapper.vm.hovered.title).toBe('Spider-Man')
|
|
669
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
670
|
+
expect(wrapper.vm.hovered.title).toBe('Spider-Man 2')
|
|
671
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
672
|
+
expect(wrapper.vm.hovered.title).toBe('Spider-Man 3')
|
|
673
|
+
const combinedResults = [...firstPageResults, ...secondPageResults]
|
|
674
|
+
await wrapper.setProps({ data: combinedResults })
|
|
675
|
+
await nextTick()
|
|
676
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
677
|
+
expect(wrapper.vm.hovered.title).toBe('The Amazing Spider-Man')
|
|
678
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
679
|
+
expect(wrapper.vm.hovered.title).toBe('The Amazing Spider-Man 2')
|
|
680
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
681
|
+
expect(wrapper.vm.hovered.title).toBe('Spider-Man: Homecoming')
|
|
682
|
+
} finally { wrapper.unmount() }
|
|
683
|
+
})
|
|
684
|
+
|
|
685
|
+
it('handles rapid async data updates', async () => {
|
|
686
|
+
const wrapper = mount(BAutocomplete, {
|
|
687
|
+
attachTo: document.body,
|
|
688
|
+
props: {
|
|
689
|
+
data: [],
|
|
690
|
+
field: 'title',
|
|
691
|
+
checkInfiniteScroll: true
|
|
692
|
+
}
|
|
693
|
+
})
|
|
694
|
+
try {
|
|
695
|
+
const input = wrapper.find('input')
|
|
696
|
+
wrapper.vm.isActive = true
|
|
697
|
+
await nextTick()
|
|
698
|
+
const updates = [
|
|
699
|
+
[{ title: 'Movie A' }],
|
|
700
|
+
[{ title: 'Movie A' }, { title: 'Movie B' }],
|
|
701
|
+
[{ title: 'Movie A' }, { title: 'Movie B' }, { title: 'Movie C' }],
|
|
702
|
+
[{ title: 'Movie A' },
|
|
703
|
+
{ title: 'Movie B' },
|
|
704
|
+
{ title: 'Movie C' },
|
|
705
|
+
{ title: 'Movie D' }]
|
|
706
|
+
]
|
|
707
|
+
for (const update of updates) {
|
|
708
|
+
await wrapper.setProps({ data: update })
|
|
709
|
+
await nextTick()
|
|
710
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
711
|
+
}
|
|
712
|
+
expect(wrapper.vm.hovered.title).toBe('Movie D')
|
|
713
|
+
} finally { wrapper.unmount() }
|
|
714
|
+
})
|
|
715
|
+
|
|
716
|
+
it('handles navigation at boundary with loading state', async () => {
|
|
717
|
+
const wrapper = mount(BAutocomplete, {
|
|
718
|
+
attachTo: document.body,
|
|
719
|
+
props: {
|
|
720
|
+
data: [{ title: 'Result 1' }, { title: 'Result 2' }, { title: 'Result 3' }],
|
|
721
|
+
field: 'title',
|
|
722
|
+
checkInfiniteScroll: true,
|
|
723
|
+
loading: false
|
|
724
|
+
}
|
|
725
|
+
})
|
|
726
|
+
try {
|
|
727
|
+
const input = wrapper.find('input')
|
|
728
|
+
wrapper.vm.isActive = true
|
|
729
|
+
await nextTick()
|
|
730
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
731
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
732
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
733
|
+
expect(wrapper.vm.hovered.title).toBe('Result 3')
|
|
734
|
+
await wrapper.setProps({ loading: true })
|
|
735
|
+
await nextTick()
|
|
736
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
737
|
+
expect(wrapper.vm.hovered.title).toBe('Result 3')
|
|
738
|
+
await wrapper.setProps({
|
|
739
|
+
loading: false,
|
|
740
|
+
data: [{ title: 'Result 1' },
|
|
741
|
+
{ title: 'Result 2' },
|
|
742
|
+
{ title: 'Result 3' },
|
|
743
|
+
{ title: 'Result 4' },
|
|
744
|
+
{ title: 'Result 5' }]
|
|
745
|
+
})
|
|
746
|
+
await nextTick()
|
|
747
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
748
|
+
expect(wrapper.vm.hovered.title).toBe('Result 4')
|
|
749
|
+
} finally { wrapper.unmount() }
|
|
750
|
+
})
|
|
751
|
+
|
|
752
|
+
it('handles duplicate getValue results (reference and value fallback)', async () => {
|
|
753
|
+
const wrapper = mount(BAutocomplete, {
|
|
754
|
+
attachTo: document.body,
|
|
755
|
+
props: {
|
|
756
|
+
data: [
|
|
757
|
+
{ name: 'John', role: 'Developer', id: 1 },
|
|
758
|
+
{ name: 'John', role: 'Designer', id: 2 },
|
|
759
|
+
{ name: 'John', role: 'Manager', id: 3 }
|
|
760
|
+
],
|
|
761
|
+
field: 'name',
|
|
762
|
+
checkInfiniteScroll: true
|
|
763
|
+
}
|
|
764
|
+
})
|
|
765
|
+
try {
|
|
766
|
+
const input = wrapper.find('input')
|
|
767
|
+
wrapper.vm.isActive = true
|
|
768
|
+
await nextTick()
|
|
769
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
770
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
771
|
+
expect(wrapper.vm.hovered.role).toBe('Designer')
|
|
772
|
+
const originalData = wrapper.vm.data
|
|
773
|
+
const moreJohns = [
|
|
774
|
+
{ name: 'John', role: 'Tester', id: 4 },
|
|
775
|
+
{ name: 'John', role: 'Admin', id: 5 }
|
|
776
|
+
]
|
|
777
|
+
await wrapper.setProps({ data: [...originalData, ...moreJohns] })
|
|
778
|
+
await nextTick()
|
|
779
|
+
await input.trigger('keydown', { key: 'ArrowDown' })
|
|
780
|
+
expect(wrapper.vm.hovered.role).toBe('Manager')
|
|
781
|
+
} finally { wrapper.unmount() }
|
|
782
|
+
})
|
|
783
|
+
})
|