@lion/ui 0.7.2 → 0.7.4
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/components/button/test-suites/LionButtonReset.suite.js +7 -9
- package/components/calendar/test/lion-calendar.test.js +26 -30
- package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +3 -0
- package/components/combobox/src/LionCombobox.js +35 -22
- package/components/combobox/test/lion-combobox.test.js +141 -98
- package/components/core/src/SlotMixin.js +7 -1
- package/components/form/test/lion-form.test.js +4 -4
- package/components/form-core/src/FormControlMixin.js +0 -9
- package/components/form-core/src/localizeNamespaceLoader.js +75 -0
- package/components/form-core/src/registration/FormRegisteringMixin.js +28 -0
- package/components/form-core/src/validate/LionValidationFeedback.js +36 -2
- package/components/form-core/test/validate/lion-validation-feedback.test.js +30 -2
- package/components/form-core/test-suites/FormRegistrationMixins.suite.js +17 -0
- package/components/form-core/test-suites/ValidateMixin.suite.js +2 -1
- package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +18 -18
- package/components/form-core/translations/bg-BG.js +5 -0
- package/components/form-core/translations/bg.js +6 -0
- package/components/form-core/translations/cs-CZ.js +5 -0
- package/components/form-core/translations/cs.js +6 -0
- package/components/form-core/translations/de-DE.js +5 -0
- package/components/form-core/translations/de.js +6 -0
- package/components/form-core/translations/en-AU.js +5 -0
- package/components/form-core/translations/en-GB.js +5 -0
- package/components/form-core/translations/en-US.js +5 -0
- package/components/form-core/translations/en.js +6 -0
- package/components/form-core/translations/es-ES.js +5 -0
- package/components/form-core/translations/es.js +6 -0
- package/components/form-core/translations/fr-BE.js +5 -0
- package/components/form-core/translations/fr-FR.js +5 -0
- package/components/form-core/translations/fr.js +6 -0
- package/components/form-core/translations/hu-HU.js +5 -0
- package/components/form-core/translations/hu.js +6 -0
- package/components/form-core/translations/it-IT.js +5 -0
- package/components/form-core/translations/it.js +6 -0
- package/components/form-core/translations/nl-BE.js +5 -0
- package/components/form-core/translations/nl-NL.js +5 -0
- package/components/form-core/translations/nl.js +6 -0
- package/components/form-core/translations/pl-PL.js +5 -0
- package/components/form-core/translations/pl.js +6 -0
- package/components/form-core/translations/ro-RO.js +5 -0
- package/components/form-core/translations/ro.js +6 -0
- package/components/form-core/translations/ru-RU.js +5 -0
- package/components/form-core/translations/ru.js +6 -0
- package/components/form-core/translations/sk-SK.js +5 -0
- package/components/form-core/translations/sk.js +6 -0
- package/components/form-core/translations/uk-UA.js +5 -0
- package/components/form-core/translations/uk.js +6 -0
- package/components/form-core/translations/zh.js +6 -0
- package/components/form-core/types/FormControlMixinTypes.ts +0 -4
- package/components/form-core/types/registration/FormRegisteringMixinTypes.ts +17 -4
- package/components/form-integrations/test/dialog-integrations.test.js +6 -4
- package/components/helpers/src/SbActionLogger.js +11 -2
- package/components/icon/test/lion-icon.test.js +12 -14
- package/components/input-amount/test/lion-input-amount.test.js +13 -14
- package/components/input-datepicker/test/lion-input-datepicker.test.js +4 -4
- package/components/input-file/src/LionInputFile.js +88 -30
- package/components/input-file/test/lion-input-file.test.js +105 -9
- package/components/input-file/test/lion-selected-file-list.test.js +2 -1
- package/components/input-file/translations/bg.js +3 -0
- package/components/input-file/translations/cs.js +3 -0
- package/components/input-file/translations/de.js +3 -0
- package/components/input-file/translations/en.js +3 -0
- package/components/input-file/translations/es.js +3 -0
- package/components/input-file/translations/fr.js +3 -0
- package/components/input-file/translations/hu.js +3 -0
- package/components/input-file/translations/it.js +3 -0
- package/components/input-file/translations/nl.js +3 -0
- package/components/input-file/translations/pl.js +3 -0
- package/components/input-file/translations/ro.js +3 -0
- package/components/input-file/translations/ru.js +3 -0
- package/components/input-file/translations/sk.js +3 -0
- package/components/input-file/translations/uk.js +3 -0
- package/components/input-file/translations/zh.js +3 -0
- package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +23 -23
- package/components/listbox/test-suites/ListboxMixin.suite.js +10 -3
- package/components/localize/src/date/utils/normalizeIntlDate.js +13 -2
- package/components/overlays/src/OverlayMixin.js +8 -1
- package/components/progress-indicator/test/lion-progress-indicator.test.js +42 -46
- package/components/select-rich/test/lion-select-rich.test.js +6 -8
- package/components/steps/test/lion-step.test.js +5 -7
- package/components/switch/src/LionSwitch.js +10 -0
- package/components/switch/test/lion-switch.test.js +5 -7
- package/components/tabs/src/LionTabs.js +10 -0
- package/components/tabs/test/lion-tabs.test.js +49 -38
- package/custom-elements.json +83073 -76992
- package/dist-types/components/button/test-suites/LionButtonReset.suite.d.ts.map +1 -1
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts.map +1 -1
- package/dist-types/components/combobox/src/LionCombobox.d.ts +12 -8
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/FormControlMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/LionField.d.ts +1 -1
- package/dist-types/components/form-core/src/localizeNamespaceLoader.d.ts +2 -0
- package/dist-types/components/form-core/src/localizeNamespaceLoader.d.ts.map +1 -0
- package/dist-types/components/form-core/src/registration/FormRegisteringMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +5 -6
- package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/FormRegistrationMixins.suite.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/ValidateMixin.suite.d.ts.map +1 -1
- package/dist-types/components/form-core/translations/bg-BG.d.ts +8 -0
- package/dist-types/components/form-core/translations/bg-BG.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/bg.d.ts +8 -0
- package/dist-types/components/form-core/translations/bg.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/cs-CZ.d.ts +8 -0
- package/dist-types/components/form-core/translations/cs-CZ.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/cs.d.ts +8 -0
- package/dist-types/components/form-core/translations/cs.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/de-DE.d.ts +8 -0
- package/dist-types/components/form-core/translations/de-DE.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/de.d.ts +8 -0
- package/dist-types/components/form-core/translations/de.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/en-AU.d.ts +8 -0
- package/dist-types/components/form-core/translations/en-AU.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/en-GB.d.ts +8 -0
- package/dist-types/components/form-core/translations/en-GB.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/en-US.d.ts +8 -0
- package/dist-types/components/form-core/translations/en-US.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/en.d.ts +8 -0
- package/dist-types/components/form-core/translations/en.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/es-ES.d.ts +8 -0
- package/dist-types/components/form-core/translations/es-ES.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/es.d.ts +8 -0
- package/dist-types/components/form-core/translations/es.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/fr-BE.d.ts +8 -0
- package/dist-types/components/form-core/translations/fr-BE.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/fr-FR.d.ts +8 -0
- package/dist-types/components/form-core/translations/fr-FR.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/fr.d.ts +8 -0
- package/dist-types/components/form-core/translations/fr.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/hu-HU.d.ts +8 -0
- package/dist-types/components/form-core/translations/hu-HU.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/hu.d.ts +8 -0
- package/dist-types/components/form-core/translations/hu.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/it-IT.d.ts +8 -0
- package/dist-types/components/form-core/translations/it-IT.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/it.d.ts +8 -0
- package/dist-types/components/form-core/translations/it.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/nl-BE.d.ts +8 -0
- package/dist-types/components/form-core/translations/nl-BE.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/nl-NL.d.ts +8 -0
- package/dist-types/components/form-core/translations/nl-NL.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/nl.d.ts +8 -0
- package/dist-types/components/form-core/translations/nl.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/pl-PL.d.ts +8 -0
- package/dist-types/components/form-core/translations/pl-PL.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/pl.d.ts +8 -0
- package/dist-types/components/form-core/translations/pl.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/ro-RO.d.ts +8 -0
- package/dist-types/components/form-core/translations/ro-RO.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/ro.d.ts +8 -0
- package/dist-types/components/form-core/translations/ro.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/ru-RU.d.ts +8 -0
- package/dist-types/components/form-core/translations/ru-RU.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/ru.d.ts +8 -0
- package/dist-types/components/form-core/translations/ru.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/sk-SK.d.ts +8 -0
- package/dist-types/components/form-core/translations/sk-SK.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/sk.d.ts +8 -0
- package/dist-types/components/form-core/translations/sk.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/uk-UA.d.ts +8 -0
- package/dist-types/components/form-core/translations/uk-UA.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/uk.d.ts +8 -0
- package/dist-types/components/form-core/translations/uk.d.ts.map +1 -0
- package/dist-types/components/form-core/translations/zh.d.ts +8 -0
- package/dist-types/components/form-core/translations/zh.d.ts.map +1 -0
- package/dist-types/components/form-core/types/FormControlMixinTypes.d.ts +0 -4
- package/dist-types/components/form-core/types/FormControlMixinTypes.d.ts.map +1 -1
- package/dist-types/components/form-core/types/registration/FormRegisteringMixinTypes.d.ts +14 -4
- package/dist-types/components/form-core/types/registration/FormRegisteringMixinTypes.d.ts.map +1 -1
- package/dist-types/components/helpers/src/SbActionLogger.d.ts.map +1 -1
- package/dist-types/components/input-file/src/LionInputFile.d.ts +12 -6
- package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -1
- package/dist-types/components/input-file/translations/bg-BG.d.ts +3 -0
- package/dist-types/components/input-file/translations/bg.d.ts +3 -0
- package/dist-types/components/input-file/translations/cs-CZ.d.ts +3 -0
- package/dist-types/components/input-file/translations/cs.d.ts +3 -0
- package/dist-types/components/input-file/translations/de-DE.d.ts +3 -0
- package/dist-types/components/input-file/translations/de.d.ts +3 -0
- package/dist-types/components/input-file/translations/en-AU.d.ts +3 -0
- package/dist-types/components/input-file/translations/en-GB.d.ts +3 -0
- package/dist-types/components/input-file/translations/en-PH.d.ts +3 -0
- package/dist-types/components/input-file/translations/en-US.d.ts +3 -0
- package/dist-types/components/input-file/translations/en.d.ts +3 -0
- package/dist-types/components/input-file/translations/es-ES.d.ts +3 -0
- package/dist-types/components/input-file/translations/es.d.ts +3 -0
- package/dist-types/components/input-file/translations/fr-BE.d.ts +3 -0
- package/dist-types/components/input-file/translations/fr-FR.d.ts +3 -0
- package/dist-types/components/input-file/translations/fr.d.ts +3 -0
- package/dist-types/components/input-file/translations/hu-HU.d.ts +3 -0
- package/dist-types/components/input-file/translations/hu.d.ts +3 -0
- package/dist-types/components/input-file/translations/it-IT.d.ts +3 -0
- package/dist-types/components/input-file/translations/it.d.ts +3 -0
- package/dist-types/components/input-file/translations/nl-BE.d.ts +3 -0
- package/dist-types/components/input-file/translations/nl-NL.d.ts +3 -0
- package/dist-types/components/input-file/translations/nl.d.ts +3 -0
- package/dist-types/components/input-file/translations/pl-PL.d.ts +3 -0
- package/dist-types/components/input-file/translations/pl.d.ts +3 -0
- package/dist-types/components/input-file/translations/ro-RO.d.ts +3 -0
- package/dist-types/components/input-file/translations/ro.d.ts +3 -0
- package/dist-types/components/input-file/translations/ru-RU.d.ts +3 -0
- package/dist-types/components/input-file/translations/ru.d.ts +3 -0
- package/dist-types/components/input-file/translations/sk-SK.d.ts +3 -0
- package/dist-types/components/input-file/translations/sk.d.ts +3 -0
- package/dist-types/components/input-file/translations/uk-UA.d.ts +3 -0
- package/dist-types/components/input-file/translations/uk.d.ts +3 -0
- package/dist-types/components/input-file/translations/zh-CN.d.ts +3 -0
- package/dist-types/components/input-file/translations/zh.d.ts +3 -0
- package/dist-types/components/input-tel-dropdown/test/LionInputTelDropdown.test.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionOption.d.ts +1 -1
- package/dist-types/components/listbox/test-suites/ListboxMixin.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/date/utils/normalizeIntlDate.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/switch/src/LionSwitch.d.ts.map +1 -1
- package/dist-types/components/tabs/src/LionTabs.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/api-table.md +31 -0
- package/docs/components/button/api-table.md +104 -0
- package/docs/components/button/use-cases.md +11 -10
- package/docs/components/calendar/api-table.md +44 -0
- package/docs/components/checkbox-group/api-table.md +564 -0
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/api-table.md +36 -0
- package/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js +6 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/api-table.md +256 -0
- package/docs/components/combobox/overview.md +4 -3
- package/docs/components/combobox/src/gh-combobox/gh-button.js +3 -1
- package/docs/components/combobox/src/gh-combobox/gh-combobox.js +9 -2
- package/docs/components/combobox/src/google-combobox/google-combobox.js +6 -8
- package/docs/components/combobox/src/md-combobox/MdFieldMixin.js +7 -3
- package/docs/components/combobox/src/md-combobox/style/md-ripple.js +1 -0
- package/docs/components/combobox/src/wa-combobox/wa-combobox.js +15 -3
- package/docs/components/combobox/use-cases.md +19 -17
- package/docs/components/dialog/api-table.md +45 -0
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/drawer/api-table.md +45 -0
- package/docs/components/fieldset/api-table.md +163 -0
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/api-table.md +1 -0
- package/docs/components/form/overview.md +3 -3
- package/docs/components/icon/api-table.md +29 -0
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/api-table.md +187 -0
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input/use-cases.md +3 -2
- package/docs/components/input-amount/api-table.md +196 -0
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/api-table.md +188 -0
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/api-table.md +234 -0
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/api-table.md +187 -0
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/api-table.md +272 -0
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/api-table.md +187 -0
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/api-table.md +198 -0
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/api-table.md +205 -0
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/api-table.md +202 -0
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/api-table.md +213 -0
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js +15 -5
- package/docs/components/listbox/api-table.md +293 -0
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/pagination/api-table.md +33 -0
- package/docs/components/progress-indicator/api-table.md +36 -0
- package/docs/components/progress-indicator/examples.md +11 -11
- package/docs/components/radio-group/api-table.md +378 -0
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/api-table.md +181 -0
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/api-table.md +288 -0
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/steps/api-table.md +80 -0
- package/docs/components/switch/api-table.md +229 -0
- package/docs/components/tabs/api-table.md +32 -0
- package/docs/components/tabs/examples.md +1 -1
- package/docs/components/tabs/src/lea-tab-panel.js +3 -1
- package/docs/components/tabs/src/lea-tab.js +7 -2
- package/docs/components/textarea/api-table.md +192 -0
- package/docs/components/tooltip/api-table.md +53 -0
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js +32 -8
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/api-table.md +34 -0
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/api-table.md +166 -0
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +3 -3
- package/docs/fundamentals/systems/localize/api-table.md +65 -0
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/_configuration-positioning.md +0 -9
- package/docs/fundamentals/systems/overlays/_edge-cases.md +74 -80
- package/docs/fundamentals/systems/overlays/api-table.md +168 -0
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +5 -8
- package/docs/fundamentals/tools/helpers/action-logger.md +3 -6
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/example-complex/demo-app.js +3 -1
- package/docs/fundamentals/tools/singleton-manager/example-fail/demo-app.js +3 -1
- package/docs/fundamentals/tools/singleton-manager/example-success/demo-app.js +3 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +6 -5
|
@@ -164,15 +164,13 @@ export function LionButtonResetSuite({ klass = LionButtonReset } = {}) {
|
|
|
164
164
|
const formSpyLater = /** @type {EventListener} */ (sinon.spy(e => e.preventDefault()));
|
|
165
165
|
|
|
166
166
|
const form2El = /** @type {HTMLFormElement} */ (
|
|
167
|
-
await fixture(
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
`,
|
|
175
|
-
)
|
|
167
|
+
await fixture(html`
|
|
168
|
+
<div @click="${outsideSpy}">
|
|
169
|
+
<form @click="${formSpyEarly}">
|
|
170
|
+
<div @click="${insideSpy}">${lionButton}</div>
|
|
171
|
+
</form>
|
|
172
|
+
</div>
|
|
173
|
+
`)
|
|
176
174
|
);
|
|
177
175
|
const form2Node = /** @type {HTMLFormElement} */ (form2El.querySelector('form'));
|
|
178
176
|
|
|
@@ -355,10 +355,12 @@ describe('<lion-calendar>', () => {
|
|
|
355
355
|
it('has a initCentralDate() method for external contexts like datepickers', async () => {
|
|
356
356
|
const initialCentralDate = new Date('2014/07/05');
|
|
357
357
|
const initialSelectedDate = new Date('2014/07/07');
|
|
358
|
-
const el = await fixture(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
const el = await fixture(
|
|
359
|
+
html`<lion-calendar
|
|
360
|
+
.centralDate="${initialCentralDate}"
|
|
361
|
+
.selectedDate="${initialSelectedDate}"
|
|
362
|
+
></lion-calendar>`,
|
|
363
|
+
);
|
|
362
364
|
|
|
363
365
|
expect(el.selectedDate).to.equal(initialSelectedDate);
|
|
364
366
|
expect(el.centralDate).to.equal(initialCentralDate);
|
|
@@ -408,14 +410,12 @@ describe('<lion-calendar>', () => {
|
|
|
408
410
|
it('disables a date with disableDates function', async () => {
|
|
409
411
|
/** @param {Date} d */
|
|
410
412
|
const disable15th = d => d.getDate() === 15;
|
|
411
|
-
const el = await fixture(
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
`,
|
|
418
|
-
);
|
|
413
|
+
const el = await fixture(html`
|
|
414
|
+
<lion-calendar
|
|
415
|
+
.selectedDate="${new Date('2000/12/01')}"
|
|
416
|
+
.disableDates=${disable15th}
|
|
417
|
+
></lion-calendar>
|
|
418
|
+
`);
|
|
419
419
|
const elObj = new CalendarObject(el);
|
|
420
420
|
elObj.dayEls.forEach((d, i) => {
|
|
421
421
|
const shouldBeDisabled = i === 15 - 1;
|
|
@@ -490,15 +490,13 @@ describe('<lion-calendar>', () => {
|
|
|
490
490
|
// without normalization, selectedDate < minDate would wrongfully be disabled
|
|
491
491
|
const minDate = new Date('2000-11-02T04:00:00');
|
|
492
492
|
|
|
493
|
-
const el = await fixture(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
`,
|
|
501
|
-
);
|
|
493
|
+
const el = await fixture(html`
|
|
494
|
+
<lion-calendar
|
|
495
|
+
.selectedDate="${selectedDate}"
|
|
496
|
+
.minDate="${minDate}"
|
|
497
|
+
.maxDate="${maxDate}"
|
|
498
|
+
></lion-calendar>
|
|
499
|
+
`);
|
|
502
500
|
const elObj = new CalendarObject(el);
|
|
503
501
|
|
|
504
502
|
expect(elObj.getDayObj(29).isDisabled).to.equal(false);
|
|
@@ -1531,15 +1529,13 @@ describe('<lion-calendar>', () => {
|
|
|
1531
1529
|
});
|
|
1532
1530
|
|
|
1533
1531
|
it('is accessible with disabled dates', async () => {
|
|
1534
|
-
const el = await fixture(
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
.
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
`,
|
|
1542
|
-
);
|
|
1532
|
+
const el = await fixture(html`
|
|
1533
|
+
<lion-calendar
|
|
1534
|
+
.disableDates=${
|
|
1535
|
+
/** @param {Date} date */ date => date.getDay() === 6 || date.getDay() === 0
|
|
1536
|
+
}
|
|
1537
|
+
></lion-calendar>
|
|
1538
|
+
`);
|
|
1543
1539
|
await expect(el).to.be.accessible();
|
|
1544
1540
|
});
|
|
1545
1541
|
|
|
@@ -40,8 +40,11 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
40
40
|
let childTag;
|
|
41
41
|
|
|
42
42
|
before(async () => {
|
|
43
|
+
// @ts-expect-error
|
|
43
44
|
tag = unsafeStatic(cfg.tagString);
|
|
45
|
+
// @ts-expect-error
|
|
44
46
|
groupTag = unsafeStatic(cfg.groupTagString);
|
|
47
|
+
// @ts-expect-error
|
|
45
48
|
childTag = unsafeStatic(cfg.childTagString);
|
|
46
49
|
});
|
|
47
50
|
|
|
@@ -456,10 +456,14 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
456
456
|
*/
|
|
457
457
|
this.__listboxContentChanged = false;
|
|
458
458
|
|
|
459
|
+
/** @type {EventListener}
|
|
460
|
+
* @protected
|
|
461
|
+
*/
|
|
462
|
+
this._onKeyUp = this._onKeyUp.bind(this);
|
|
459
463
|
/** @type {EventListener}
|
|
460
464
|
* @private
|
|
461
465
|
*/
|
|
462
|
-
this.
|
|
466
|
+
this._textboxOnClick = this._textboxOnClick.bind(this);
|
|
463
467
|
/** @type {EventListener}
|
|
464
468
|
* @protected
|
|
465
469
|
*/
|
|
@@ -500,9 +504,6 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
500
504
|
}
|
|
501
505
|
}
|
|
502
506
|
}
|
|
503
|
-
if (name === 'focused' && this.focused) {
|
|
504
|
-
this.__requestShowOverlay();
|
|
505
|
-
}
|
|
506
507
|
}
|
|
507
508
|
|
|
508
509
|
/**
|
|
@@ -614,11 +615,6 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
614
615
|
* that wraps the listbox with options
|
|
615
616
|
*
|
|
616
617
|
* @example
|
|
617
|
-
* _showOverlayCondition(options) {
|
|
618
|
-
* return this.focused || super._showOverlayCondition(options);
|
|
619
|
-
* }
|
|
620
|
-
*
|
|
621
|
-
* @example
|
|
622
618
|
* _showOverlayCondition({ lastKey }) {
|
|
623
619
|
* return lastKey === 'ArrowDown';
|
|
624
620
|
* }
|
|
@@ -635,19 +631,20 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
635
631
|
// TODO: batch all pending condition triggers in __pendingShowTriggers, reducing race conditions
|
|
636
632
|
// eslint-disable-next-line class-methods-use-this
|
|
637
633
|
_showOverlayCondition({ lastKey }) {
|
|
638
|
-
const
|
|
639
|
-
|
|
634
|
+
const alwaysHideOn = ['Tab', 'Escape'];
|
|
635
|
+
const notMultipleChoiceHideOn = ['Enter'];
|
|
636
|
+
if (
|
|
637
|
+
lastKey &&
|
|
638
|
+
(alwaysHideOn.includes(lastKey) ||
|
|
639
|
+
(!this.multipleChoice && notMultipleChoiceHideOn.includes(lastKey)))
|
|
640
|
+
) {
|
|
640
641
|
return false;
|
|
641
642
|
}
|
|
642
|
-
|
|
643
|
-
if (this.showAllOnEmpty && this.focused) {
|
|
643
|
+
if (this.filled || this.showAllOnEmpty) {
|
|
644
644
|
return true;
|
|
645
645
|
}
|
|
646
646
|
// when no keyboard action involved (on focused change), return current opened state
|
|
647
|
-
|
|
648
|
-
return /** @type {boolean} */ (this.opened);
|
|
649
|
-
}
|
|
650
|
-
return true;
|
|
647
|
+
return /** @type {boolean} */ (this.opened);
|
|
651
648
|
}
|
|
652
649
|
|
|
653
650
|
/**
|
|
@@ -678,9 +675,14 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
678
675
|
this.__listboxContentChanged = true;
|
|
679
676
|
}
|
|
680
677
|
|
|
678
|
+
/**
|
|
679
|
+
* @param {Event} ev
|
|
680
|
+
* @protected
|
|
681
|
+
*/
|
|
681
682
|
// eslint-disable-next-line no-unused-vars
|
|
682
|
-
_textboxOnInput() {
|
|
683
|
+
_textboxOnInput(ev) {
|
|
683
684
|
this.__shouldAutocompleteNextUpdate = true;
|
|
685
|
+
this.opened = true;
|
|
684
686
|
}
|
|
685
687
|
|
|
686
688
|
/**
|
|
@@ -1068,7 +1070,8 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
1068
1070
|
*/
|
|
1069
1071
|
_setupOpenCloseListeners() {
|
|
1070
1072
|
super._setupOpenCloseListeners();
|
|
1071
|
-
this._inputNode.addEventListener('keyup', this.
|
|
1073
|
+
this._inputNode.addEventListener('keyup', this._onKeyUp);
|
|
1074
|
+
this._inputNode.addEventListener('click', this._textboxOnClick);
|
|
1072
1075
|
}
|
|
1073
1076
|
|
|
1074
1077
|
/**
|
|
@@ -1077,7 +1080,8 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
1077
1080
|
*/
|
|
1078
1081
|
_teardownOpenCloseListeners() {
|
|
1079
1082
|
super._teardownOpenCloseListeners();
|
|
1080
|
-
this._inputNode.removeEventListener('keyup', this.
|
|
1083
|
+
this._inputNode.removeEventListener('keyup', this._onKeyUp);
|
|
1084
|
+
this._inputNode.removeEventListener('click', this._textboxOnClick);
|
|
1081
1085
|
}
|
|
1082
1086
|
|
|
1083
1087
|
/**
|
|
@@ -1225,9 +1229,9 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
1225
1229
|
|
|
1226
1230
|
/**
|
|
1227
1231
|
* @param {KeyboardEvent} [ev]
|
|
1228
|
-
* @
|
|
1232
|
+
* @protected
|
|
1229
1233
|
*/
|
|
1230
|
-
|
|
1234
|
+
_onKeyUp(ev) {
|
|
1231
1235
|
const lastKey = ev && ev.key;
|
|
1232
1236
|
this.opened = this._showOverlayCondition({
|
|
1233
1237
|
lastKey,
|
|
@@ -1235,6 +1239,15 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
|
|
|
1235
1239
|
});
|
|
1236
1240
|
}
|
|
1237
1241
|
|
|
1242
|
+
/**
|
|
1243
|
+
* @param {FocusEvent} [ev]
|
|
1244
|
+
* @protected
|
|
1245
|
+
*/
|
|
1246
|
+
// eslint-disable-next-line no-unused-vars
|
|
1247
|
+
_textboxOnClick(ev) {
|
|
1248
|
+
this.opened = this._showOverlayCondition({});
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1238
1251
|
clear() {
|
|
1239
1252
|
this.value = '';
|
|
1240
1253
|
super.clear();
|
|
@@ -93,11 +93,9 @@ describe('lion-combobox', () => {
|
|
|
93
93
|
`)
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
-
const {
|
|
96
|
+
const { _listboxNode } = getComboboxMembers(el);
|
|
97
97
|
|
|
98
98
|
async function open() {
|
|
99
|
-
// activate opened listbox
|
|
100
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
101
99
|
mimicUserTyping(el, 'ch');
|
|
102
100
|
return el.updateComplete;
|
|
103
101
|
}
|
|
@@ -150,7 +148,7 @@ describe('lion-combobox', () => {
|
|
|
150
148
|
await performChecks();
|
|
151
149
|
});
|
|
152
150
|
|
|
153
|
-
it('shows overlay on
|
|
151
|
+
it('shows overlay on click', async () => {
|
|
154
152
|
const el = /** @type {LionCombobox} */ (
|
|
155
153
|
await fixture(html`
|
|
156
154
|
<lion-combobox name="foo" .showAllOnEmpty="${true}">
|
|
@@ -161,15 +159,15 @@ describe('lion-combobox', () => {
|
|
|
161
159
|
</lion-combobox>
|
|
162
160
|
`)
|
|
163
161
|
);
|
|
164
|
-
const {
|
|
162
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
165
163
|
|
|
166
164
|
expect(el.opened).to.be.false;
|
|
167
|
-
|
|
165
|
+
_inputNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
|
|
168
166
|
await el.updateComplete;
|
|
169
167
|
expect(el.opened).to.be.true;
|
|
170
168
|
});
|
|
171
169
|
|
|
172
|
-
it('hides overlay on
|
|
170
|
+
it('hides overlay on [Escape] after being opened', async () => {
|
|
173
171
|
const el = /** @type {LionCombobox} */ (
|
|
174
172
|
await fixture(html`
|
|
175
173
|
<lion-combobox name="foo" .showAllOnEmpty="${true}">
|
|
@@ -183,7 +181,7 @@ describe('lion-combobox', () => {
|
|
|
183
181
|
const { _comboboxNode, _inputNode } = getComboboxMembers(el);
|
|
184
182
|
|
|
185
183
|
expect(el.opened).to.be.false;
|
|
186
|
-
_comboboxNode.dispatchEvent(new Event('
|
|
184
|
+
_comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
|
|
187
185
|
await el.updateComplete;
|
|
188
186
|
expect(el.opened).to.be.true;
|
|
189
187
|
_inputNode.dispatchEvent(new KeyboardEvent('keyup', { key: 'Escape' }));
|
|
@@ -203,11 +201,9 @@ describe('lion-combobox', () => {
|
|
|
203
201
|
`)
|
|
204
202
|
);
|
|
205
203
|
|
|
206
|
-
const {
|
|
204
|
+
const { _listboxNode, _inputNode } = getComboboxMembers(el);
|
|
207
205
|
|
|
208
206
|
async function open() {
|
|
209
|
-
// activate opened listbox
|
|
210
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
211
207
|
mimicUserTyping(el, 'ch');
|
|
212
208
|
return el.updateComplete;
|
|
213
209
|
}
|
|
@@ -870,10 +866,10 @@ describe('lion-combobox', () => {
|
|
|
870
866
|
});
|
|
871
867
|
|
|
872
868
|
describe('Overlay visibility', () => {
|
|
873
|
-
it('does not show overlay on
|
|
869
|
+
it('does not show overlay on click', async () => {
|
|
874
870
|
const el = /** @type {LionCombobox} */ (
|
|
875
871
|
await fixture(html`
|
|
876
|
-
<lion-combobox name="foo"
|
|
872
|
+
<lion-combobox name="foo">
|
|
877
873
|
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
878
874
|
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
879
875
|
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
@@ -884,7 +880,26 @@ describe('lion-combobox', () => {
|
|
|
884
880
|
const { _comboboxNode } = getComboboxMembers(el);
|
|
885
881
|
|
|
886
882
|
expect(el.opened).to.equal(false);
|
|
887
|
-
_comboboxNode.dispatchEvent(new Event('
|
|
883
|
+
_comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
|
|
884
|
+
await el.updateComplete;
|
|
885
|
+
expect(el.opened).to.equal(false);
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
it('shows overlay on click when filled', async () => {
|
|
889
|
+
const el = /** @type {LionCombobox} */ (
|
|
890
|
+
await fixture(html`
|
|
891
|
+
<lion-combobox name="foo">
|
|
892
|
+
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
893
|
+
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
894
|
+
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
895
|
+
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
896
|
+
</lion-combobox>
|
|
897
|
+
`)
|
|
898
|
+
);
|
|
899
|
+
const { _comboboxNode } = getComboboxMembers(el);
|
|
900
|
+
el.modelValue = 'Art';
|
|
901
|
+
expect(el.opened).to.equal(false);
|
|
902
|
+
_comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
|
|
888
903
|
await el.updateComplete;
|
|
889
904
|
expect(el.opened).to.equal(false);
|
|
890
905
|
});
|
|
@@ -914,7 +929,7 @@ describe('lion-combobox', () => {
|
|
|
914
929
|
expect(el.opened).to.equal(false);
|
|
915
930
|
|
|
916
931
|
// step [1]
|
|
917
|
-
_inputNode.dispatchEvent(new Event('
|
|
932
|
+
_inputNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
|
|
918
933
|
await el.updateComplete;
|
|
919
934
|
expect(el.opened).to.equal(false);
|
|
920
935
|
|
|
@@ -948,10 +963,7 @@ describe('lion-combobox', () => {
|
|
|
948
963
|
`)
|
|
949
964
|
);
|
|
950
965
|
|
|
951
|
-
const {
|
|
952
|
-
|
|
953
|
-
// open
|
|
954
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
966
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
955
967
|
|
|
956
968
|
mimicUserTyping(el, 'art');
|
|
957
969
|
await el.updateComplete;
|
|
@@ -963,7 +975,7 @@ describe('lion-combobox', () => {
|
|
|
963
975
|
expect(_inputNode.value).to.equal('');
|
|
964
976
|
});
|
|
965
977
|
|
|
966
|
-
it('hides overlay on [
|
|
978
|
+
it('hides overlay on [Enter]', async () => {
|
|
967
979
|
const el = /** @type {LionCombobox} */ (
|
|
968
980
|
await fixture(html`
|
|
969
981
|
<lion-combobox name="foo">
|
|
@@ -975,10 +987,33 @@ describe('lion-combobox', () => {
|
|
|
975
987
|
`)
|
|
976
988
|
);
|
|
977
989
|
|
|
978
|
-
const {
|
|
990
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
979
991
|
|
|
980
|
-
|
|
981
|
-
|
|
992
|
+
mimicUserTyping(el, 'art');
|
|
993
|
+
await el.updateComplete;
|
|
994
|
+
expect(el.opened).to.equal(true);
|
|
995
|
+
expect(_inputNode.value).to.equal('Artichoke');
|
|
996
|
+
|
|
997
|
+
// N.B. we do only trigger keydown here (and not mimicKeypress (both keyup and down)),
|
|
998
|
+
// because this closely mimics what happens in the browser
|
|
999
|
+
_inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
1000
|
+
expect(el.opened).to.equal(false);
|
|
1001
|
+
expect(_inputNode.value).to.equal('Artichoke');
|
|
1002
|
+
});
|
|
1003
|
+
|
|
1004
|
+
it('hides overlay on [Tab]', async () => {
|
|
1005
|
+
const el = /** @type {LionCombobox} */ (
|
|
1006
|
+
await fixture(html`
|
|
1007
|
+
<lion-combobox name="foo">
|
|
1008
|
+
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
1009
|
+
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
1010
|
+
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
1011
|
+
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
1012
|
+
</lion-combobox>
|
|
1013
|
+
`)
|
|
1014
|
+
);
|
|
1015
|
+
|
|
1016
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
982
1017
|
|
|
983
1018
|
mimicUserTyping(el, 'art');
|
|
984
1019
|
await el.updateComplete;
|
|
@@ -992,7 +1027,7 @@ describe('lion-combobox', () => {
|
|
|
992
1027
|
expect(_inputNode.value).to.equal('Artichoke');
|
|
993
1028
|
});
|
|
994
1029
|
|
|
995
|
-
it('
|
|
1030
|
+
it('keeps overlay open on [Shift]', async () => {
|
|
996
1031
|
const el = /** @type {LionCombobox} */ (
|
|
997
1032
|
await fixture(html`
|
|
998
1033
|
<lion-combobox name="foo">
|
|
@@ -1004,10 +1039,33 @@ describe('lion-combobox', () => {
|
|
|
1004
1039
|
`)
|
|
1005
1040
|
);
|
|
1006
1041
|
|
|
1007
|
-
const {
|
|
1042
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
1043
|
+
|
|
1044
|
+
mimicUserTyping(el, 'art');
|
|
1045
|
+
await el.updateComplete;
|
|
1046
|
+
expect(el.opened).to.equal(true);
|
|
1047
|
+
expect(_inputNode.value).to.equal('Artichoke');
|
|
1048
|
+
|
|
1049
|
+
// N.B. we do only trigger keydown here (and not mimicKeypress (both keyup and down)),
|
|
1050
|
+
// because this closely mimics what happens in the browser
|
|
1051
|
+
_inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'Shift' }));
|
|
1052
|
+
expect(el.opened).to.equal(true);
|
|
1053
|
+
expect(_inputNode.value).to.equal('Artichoke');
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
it('clears checkedIndex on empty text', async () => {
|
|
1057
|
+
const el = /** @type {LionCombobox} */ (
|
|
1058
|
+
await fixture(html`
|
|
1059
|
+
<lion-combobox name="foo">
|
|
1060
|
+
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
1061
|
+
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
1062
|
+
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
1063
|
+
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
1064
|
+
</lion-combobox>
|
|
1065
|
+
`)
|
|
1066
|
+
);
|
|
1008
1067
|
|
|
1009
|
-
|
|
1010
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
1068
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
1011
1069
|
|
|
1012
1070
|
mimicUserTyping(el, 'art');
|
|
1013
1071
|
await el.updateComplete;
|
|
@@ -1043,34 +1101,6 @@ describe('lion-combobox', () => {
|
|
|
1043
1101
|
|
|
1044
1102
|
// NB: If this becomes a suite, move to separate file
|
|
1045
1103
|
describe('Subclassers', () => {
|
|
1046
|
-
it('allows to control overlay visibility via "_showOverlayCondition"', async () => {
|
|
1047
|
-
class ShowOverlayConditionCombobox extends LionCombobox {
|
|
1048
|
-
/** @param {{ currentValue: string, lastKey:string }} options */
|
|
1049
|
-
_showOverlayCondition(options) {
|
|
1050
|
-
return this.focused || super._showOverlayCondition(options);
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
const tagName = defineCE(ShowOverlayConditionCombobox);
|
|
1054
|
-
const tag = unsafeStatic(tagName);
|
|
1055
|
-
|
|
1056
|
-
const el = /** @type {LionCombobox} */ (
|
|
1057
|
-
await fixture(html`
|
|
1058
|
-
<${tag} name="foo" multiple-choice>
|
|
1059
|
-
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
1060
|
-
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
1061
|
-
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
1062
|
-
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
1063
|
-
</${tag}>
|
|
1064
|
-
`)
|
|
1065
|
-
);
|
|
1066
|
-
const { _comboboxNode } = getComboboxMembers(el);
|
|
1067
|
-
|
|
1068
|
-
expect(el.opened).to.equal(false);
|
|
1069
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
1070
|
-
await el.updateComplete;
|
|
1071
|
-
expect(el.opened).to.equal(true);
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
1104
|
it('allows to control overlay visibility via "_showOverlayCondition": should not display overlay if currentValue length condition is not fulfilled', async () => {
|
|
1075
1105
|
class ShowOverlayConditionCombobox extends LionCombobox {
|
|
1076
1106
|
/** @param {{ currentValue: string, lastKey:string }} options */
|
|
@@ -1164,11 +1194,8 @@ describe('lion-combobox', () => {
|
|
|
1164
1194
|
`)
|
|
1165
1195
|
);
|
|
1166
1196
|
const options = el.formElements;
|
|
1167
|
-
const { _comboboxNode } = getComboboxMembers(el);
|
|
1168
1197
|
expect(el.opened).to.equal(false);
|
|
1169
1198
|
|
|
1170
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
1171
|
-
|
|
1172
1199
|
mimicUserTyping(el, 'art');
|
|
1173
1200
|
await el.updateComplete;
|
|
1174
1201
|
expect(el.opened).to.equal(true);
|
|
@@ -1208,11 +1235,8 @@ describe('lion-combobox', () => {
|
|
|
1208
1235
|
`)
|
|
1209
1236
|
);
|
|
1210
1237
|
const options = el.formElements;
|
|
1211
|
-
const { _comboboxNode } = getComboboxMembers(el);
|
|
1212
1238
|
expect(el.opened).to.equal(false);
|
|
1213
1239
|
|
|
1214
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
1215
|
-
|
|
1216
1240
|
mimicUserTyping(el, 'art');
|
|
1217
1241
|
expect(el.opened).to.equal(true);
|
|
1218
1242
|
await el.updateComplete;
|
|
@@ -2300,17 +2324,17 @@ describe('lion-combobox', () => {
|
|
|
2300
2324
|
await fixture(html`
|
|
2301
2325
|
<${tag} name="foo" autocomplete="both" multiple-choice>
|
|
2302
2326
|
<lion-option .label="${'Artichoke as label'}" .choiceValue="${{
|
|
2303
|
-
|
|
2304
|
-
|
|
2327
|
+
value: 'Artichoke',
|
|
2328
|
+
}}">Artichoke</lion-option>
|
|
2305
2329
|
<lion-option .label="${'Chard as label'}" .choiceValue="${{
|
|
2306
|
-
|
|
2307
|
-
|
|
2330
|
+
value: 'Chard',
|
|
2331
|
+
}}">Chard</lion-option>
|
|
2308
2332
|
<lion-option .label="${'Chicory as label'}" .choiceValue="${{
|
|
2309
|
-
|
|
2310
|
-
|
|
2333
|
+
value: 'Chicory',
|
|
2334
|
+
}}">Chicory</lion-option>
|
|
2311
2335
|
<lion-option .label="${'Victoria Plum as label'}" .choiceValue="${{
|
|
2312
|
-
|
|
2313
|
-
|
|
2336
|
+
value: 'Victoria Plum',
|
|
2337
|
+
}}">Victoria Plum</lion-option>
|
|
2314
2338
|
</${tag}>
|
|
2315
2339
|
`)
|
|
2316
2340
|
);
|
|
@@ -2353,17 +2377,17 @@ describe('lion-combobox', () => {
|
|
|
2353
2377
|
await fixture(html`
|
|
2354
2378
|
<${tag} name="foo">
|
|
2355
2379
|
<lion-option .label="${'Artichoke as label'}" .choiceValue="${{
|
|
2356
|
-
|
|
2357
|
-
|
|
2380
|
+
value: 'Artichoke',
|
|
2381
|
+
}}">Artichoke</lion-option>
|
|
2358
2382
|
<lion-option .label="${'Chard as label'}" .choiceValue="${{
|
|
2359
|
-
|
|
2360
|
-
|
|
2383
|
+
value: 'Chard',
|
|
2384
|
+
}}" checked>Chard</lion-option>
|
|
2361
2385
|
<lion-option .label="${'Chicory as label'}" .choiceValue="${{
|
|
2362
|
-
|
|
2363
|
-
|
|
2386
|
+
value: 'Chicory',
|
|
2387
|
+
}}">Chicory</lion-option>
|
|
2364
2388
|
<lion-option .label="${'Victoria Plum as label'}" .choiceValue="${{
|
|
2365
|
-
|
|
2366
|
-
|
|
2389
|
+
value: 'Victoria Plum',
|
|
2390
|
+
}}">Victoria Plum</lion-option>
|
|
2367
2391
|
</${tag}>
|
|
2368
2392
|
`)
|
|
2369
2393
|
);
|
|
@@ -2403,17 +2427,17 @@ describe('lion-combobox', () => {
|
|
|
2403
2427
|
await fixture(html`
|
|
2404
2428
|
<${tag} name="foo" .modelValue="${{ value: 'Artichoke' }}">
|
|
2405
2429
|
<lion-option .label="${'Artichoke as label'}" .choiceValue="${{
|
|
2406
|
-
|
|
2407
|
-
|
|
2430
|
+
value: 'Artichoke',
|
|
2431
|
+
}}">Artichoke</lion-option>
|
|
2408
2432
|
<lion-option .label="${'Chard as label'}" .choiceValue="${{
|
|
2409
|
-
|
|
2410
|
-
|
|
2433
|
+
value: 'Chard',
|
|
2434
|
+
}}">Chard</lion-option>
|
|
2411
2435
|
<lion-option .label="${'Chicory as label'}" .choiceValue="${{
|
|
2412
|
-
|
|
2413
|
-
|
|
2436
|
+
value: 'Chicory',
|
|
2437
|
+
}}">Chicory</lion-option>
|
|
2414
2438
|
<lion-option .label="${'Victoria Plum as label'}" .choiceValue="${{
|
|
2415
|
-
|
|
2416
|
-
|
|
2439
|
+
value: 'Victoria Plum',
|
|
2440
|
+
}}">Victoria Plum</lion-option>
|
|
2417
2441
|
</${tag}>
|
|
2418
2442
|
`)
|
|
2419
2443
|
);
|
|
@@ -2450,17 +2474,17 @@ describe('lion-combobox', () => {
|
|
|
2450
2474
|
await fixture(html`
|
|
2451
2475
|
<${tag} name="foo">
|
|
2452
2476
|
<lion-option .label="${'Artichoke as label'}" .choiceValue="${{
|
|
2453
|
-
|
|
2454
|
-
|
|
2477
|
+
value: 'Artichoke',
|
|
2478
|
+
}}">Artichoke</lion-option>
|
|
2455
2479
|
<lion-option .label="${'Chard as label'}" .choiceValue="${{
|
|
2456
|
-
|
|
2457
|
-
|
|
2480
|
+
value: 'Chard',
|
|
2481
|
+
}}">Chard</lion-option>
|
|
2458
2482
|
<lion-option .label="${'Chicory as label'}" .choiceValue="${{
|
|
2459
|
-
|
|
2460
|
-
|
|
2483
|
+
value: 'Chicory',
|
|
2484
|
+
}}">Chicory</lion-option>
|
|
2461
2485
|
<lion-option .label="${'Victoria Plum as label'}" .choiceValue="${{
|
|
2462
|
-
|
|
2463
|
-
|
|
2486
|
+
value: 'Victoria Plum',
|
|
2487
|
+
}}">Victoria Plum</lion-option>
|
|
2464
2488
|
</${tag}>
|
|
2465
2489
|
`)
|
|
2466
2490
|
);
|
|
@@ -2948,7 +2972,7 @@ describe('lion-combobox', () => {
|
|
|
2948
2972
|
|
|
2949
2973
|
describe('Multiple Choice', () => {
|
|
2950
2974
|
// TODO: possibly later share test with select-rich if it officially supports multipleChoice
|
|
2951
|
-
it('does not close listbox on click
|
|
2975
|
+
it('does not close listbox on click', async () => {
|
|
2952
2976
|
const el = /** @type {LionCombobox} */ (
|
|
2953
2977
|
await fixture(html`
|
|
2954
2978
|
<lion-combobox name="foo" multiple-choice>
|
|
@@ -2960,10 +2984,7 @@ describe('lion-combobox', () => {
|
|
|
2960
2984
|
`)
|
|
2961
2985
|
);
|
|
2962
2986
|
|
|
2963
|
-
const { _comboboxNode } = getComboboxMembers(el);
|
|
2964
|
-
|
|
2965
2987
|
// activate opened listbox
|
|
2966
|
-
_comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
|
2967
2988
|
mimicUserTyping(el, 'ch');
|
|
2968
2989
|
await el.updateComplete;
|
|
2969
2990
|
|
|
@@ -2971,7 +2992,29 @@ describe('lion-combobox', () => {
|
|
|
2971
2992
|
const visibleOptions = el.formElements.filter(o => o.style.display !== 'none');
|
|
2972
2993
|
visibleOptions[0].click();
|
|
2973
2994
|
expect(el.opened).to.equal(true);
|
|
2974
|
-
|
|
2995
|
+
});
|
|
2996
|
+
|
|
2997
|
+
it('does not close listbox on [Enter]', async () => {
|
|
2998
|
+
const el = /** @type {LionCombobox} */ (
|
|
2999
|
+
await fixture(html`
|
|
3000
|
+
<lion-combobox name="foo" multiple-choice>
|
|
3001
|
+
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
3002
|
+
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
3003
|
+
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
3004
|
+
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
|
3005
|
+
</lion-combobox>
|
|
3006
|
+
`)
|
|
3007
|
+
);
|
|
3008
|
+
|
|
3009
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
3010
|
+
|
|
3011
|
+
mimicUserTyping(el, 'art');
|
|
3012
|
+
await el.updateComplete;
|
|
3013
|
+
expect(el.opened).to.equal(true);
|
|
3014
|
+
|
|
3015
|
+
// N.B. we do only trigger keydown here (and not mimicKeypress (both keyup and down)),
|
|
3016
|
+
// because this closely mimics what happens in the browser
|
|
3017
|
+
_inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
2975
3018
|
expect(el.opened).to.equal(true);
|
|
2976
3019
|
});
|
|
2977
3020
|
|