@lion/ui 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -20
- package/components/accordion/src/LionAccordion.js +31 -42
- package/components/accordion/test/lion-accordion.test.js +108 -134
- package/components/button/src/LionButton.js +9 -12
- package/components/button/src/LionButtonReset.js +0 -5
- package/components/button/src/LionButtonSubmit.js +7 -12
- package/components/button/test/demos.screenshots-test.js +50 -11
- package/components/button/test/lion-button.test.js +0 -1
- package/components/button/test-suites/LionButton.suite.js +135 -145
- package/components/button/test-suites/LionButtonReset.suite.js +54 -72
- package/components/button/test-suites/LionButtonSubmit.suite.js +49 -68
- package/components/calendar/src/LionCalendar.js +151 -104
- package/components/calendar/src/calendarStyle.js +0 -1
- package/components/calendar/src/utils/createMonth.js +3 -4
- package/components/calendar/src/utils/createMultipleMonth.js +15 -7
- package/components/calendar/src/utils/createWeek.js +0 -2
- package/components/calendar/src/utils/dataTemplate.js +8 -4
- package/components/calendar/src/utils/dayTemplate.js +0 -6
- package/components/calendar/src/utils/getDayMonthYear.js +6 -2
- package/components/calendar/test/demos.screenshots-test.js +40 -9
- package/components/calendar/test/lion-calendar.test.js +171 -282
- package/components/calendar/test/utils/createMonth.test.js +61 -22
- package/components/calendar/test/utils/createMultipleMonth.test.js +14 -7
- package/components/calendar/test/utils/createWeek.test.js +51 -17
- package/components/calendar/test/utils/dataTemplate.test.js +3 -4
- package/components/calendar/test/utils/dayTemplate.test.js +106 -34
- package/components/calendar/test/utils/getFirstDayNextMonth.test.js +0 -1
- package/components/calendar/test/utils/getLastDayPreviousMonth.test.js +0 -1
- package/components/calendar/test/utils/isSameDate.test.js +0 -1
- package/components/calendar/test/utils/snapshots/monthTemplate_en-GB_Sunday_2018-12.js +1 -2
- package/components/calendar/test-helpers/CalendarObject.js +31 -62
- package/components/calendar/test-helpers/DayObject.js +7 -15
- package/components/calendar/test-suites/LionCalendar.suite.js +7 -9
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +17 -30
- package/components/checkbox-group/test/lion-checkbox-group-integrations.test.js +0 -1
- package/components/checkbox-group/test/lion-checkbox-group.test.js +21 -16
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +3 -3
- package/components/checkbox-group/test/lion-checkbox-integrations.test.js +3 -2
- package/components/checkbox-group/test/lion-checkbox.test.js +30 -16
- package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +147 -191
- package/components/collapsible/src/LionCollapsible.js +10 -15
- package/components/collapsible/test/lion-collapsible.test.js +4 -18
- package/components/combobox/src/LionCombobox.js +35 -53
- package/components/combobox/src/utils/makeMatchingTextBold.js +2 -5
- package/components/combobox/src/validators.js +0 -1
- package/components/combobox/test/lion-combobox-integrations.test.js +6 -6
- package/components/combobox/test/lion-combobox.test.js +576 -869
- package/components/combobox/test/validators.test.js +6 -13
- package/components/combobox/test-helpers/combobox-helpers.js +24 -11
- package/components/core/src/DisabledMixin.js +61 -66
- package/components/core/src/DisabledWithTabIndexMixin.js +76 -83
- package/components/core/src/EventTargetShim.js +1 -4
- package/components/core/src/ScopedElementsMixin.js +4 -15
- package/components/core/src/ScopedStylesController.js +1 -5
- package/components/core/src/SlotMixin.js +236 -239
- package/components/core/src/browserDetection.js +5 -12
- package/components/core/test/DisabledMixin.test.js +24 -39
- package/components/core/test/DisabledWithTabIndexMixin.test.js +21 -34
- package/components/core/test/EventTargetShim.test.js +0 -8
- package/components/core/test/ScopedElementsMixin.test.js +22 -38
- package/components/core/test/ScopedStylesController.test.js +11 -20
- package/components/core/test/SlotMixin.test.js +102 -154
- package/components/core/test-helpers/getCachedFixture.js +5 -11
- package/components/core/types/SlotMixinTypes.ts +8 -3
- package/components/dialog/src/LionDialog.js +4 -3
- package/components/dialog/test/lion-dialog.integration.test.js +10 -20
- package/components/dialog/test/lion-dialog.test.js +48 -62
- package/components/dialog/test-helpers/test-router.js +4 -6
- package/components/drawer/src/LionDrawer.js +18 -34
- package/components/drawer/src/drawerStyle.js +0 -1
- package/components/drawer/test/lion-drawer.test.js +1 -17
- package/components/fieldset/test/lion-fieldset.test.js +6 -4
- package/components/form/src/LionForm.js +18 -13
- package/components/form/test/lion-form.test.js +22 -52
- package/components/form-core/src/FocusMixin.js +172 -174
- package/components/form-core/src/FormControlMixin.js +811 -813
- package/components/form-core/src/FormatMixin.js +537 -537
- package/components/form-core/src/InteractionStateMixin.js +196 -183
- package/components/form-core/src/LionField.js +9 -5
- package/components/form-core/src/NativeTextFieldMixin.js +114 -116
- package/components/form-core/src/choice-group/ChoiceGroupMixin.js +322 -364
- package/components/form-core/src/choice-group/ChoiceInputMixin.js +306 -296
- package/components/form-core/src/choice-group/CustomChoiceGroupMixin.js +114 -139
- package/components/form-core/src/form-group/FormElementsHaveNoError.js +0 -2
- package/components/form-core/src/form-group/FormGroupMixin.js +551 -557
- package/components/form-core/src/registration/FormRegisteringMixin.js +72 -71
- package/components/form-core/src/registration/FormRegistrarMixin.js +201 -217
- package/components/form-core/src/registration/FormRegistrarPortalMixin.js +31 -37
- package/components/form-core/src/utils/SyncUpdatableMixin.js +106 -117
- package/components/form-core/src/utils/getAriaElementsInRightDomOrder.js +1 -2
- package/components/form-core/src/validate/LionValidationFeedback.js +12 -8
- package/components/form-core/src/validate/Unparseable.js +4 -2
- package/components/form-core/src/validate/ValidateMixin.js +829 -883
- package/components/form-core/src/validate/Validator.js +3 -6
- package/components/form-core/src/validate/resultValidators/DefaultSuccess.js +1 -2
- package/components/form-core/src/validate/validators/DateValidators.js +0 -5
- package/components/form-core/src/validate/validators/NumberValidators.js +1 -5
- package/components/form-core/src/validate/validators/Required.js +1 -1
- package/components/form-core/src/validate/validators/StringValidators.js +1 -8
- package/components/form-core/test/FocusMixin.test.js +96 -82
- package/components/form-core/test/FormControlMixin.test.js +120 -176
- package/components/form-core/test/FormRegistrationMixins.test.js +0 -2
- package/components/form-core/test/FormatMixin.test.js +0 -1
- package/components/form-core/test/InteractionStateMixin.test.js +0 -1
- package/components/form-core/test/NativeTextFieldMixin.test.js +0 -1
- package/components/form-core/test/choice-group/ChoiceGroupMixin.test.js +0 -1
- package/components/form-core/test/choice-group/ChoiceInputMixin.test.js +0 -1
- package/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.js +6 -8
- package/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.js +0 -3
- package/components/form-core/test/form-group/FormGroupMixin.test.js +0 -1
- package/components/form-core/test/lion-field.test.js +88 -98
- package/components/form-core/test/utils/SyncUpdatableMixin.test.js +51 -65
- package/components/form-core/test/utils/getAriaElementsInRightDomOrder.test.js +3 -3
- package/components/form-core/test/validate/DateValidators.test.js +5 -27
- package/components/form-core/test/validate/NumberValidators.test.js +4 -16
- package/components/form-core/test/validate/Required.test.js +8 -21
- package/components/form-core/test/validate/ResultValidator.test.js +1 -2
- package/components/form-core/test/validate/StringValidators.test.js +4 -35
- package/components/form-core/test/validate/ValidateMixin.test.js +0 -1
- package/components/form-core/test/validate/ValidateMixinFeedbackPart.test.js +0 -1
- package/components/form-core/test/validate/Validator.test.js +39 -34
- package/components/form-core/test/validate/lion-validation-feedback.test.js +81 -43
- package/components/form-core/test-helpers/ExampleValidators.js +0 -5
- package/components/form-core/test-helpers/getFormControlMembers.js +2 -2
- package/components/form-core/test-helpers/mimicUserInput.js +5 -1
- package/components/form-core/test-suites/FormRegistrationMixins.suite.js +65 -122
- package/components/form-core/test-suites/FormatMixin.suite.js +202 -227
- package/components/form-core/test-suites/InteractionStateMixin.suite.js +47 -60
- package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +8 -11
- package/components/form-core/test-suites/ValidateMixin.suite.js +280 -359
- package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +112 -163
- package/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js +185 -218
- package/components/form-core/test-suites/choice-group/ChoiceInputMixin.suite.js +116 -109
- package/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.js +36 -70
- package/components/form-core/test-suites/form-group/FormGroupMixin-input.suite.js +57 -65
- package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +664 -523
- package/components/form-core/translations/bg-BG.js +0 -1
- package/components/form-core/translations/cs-CZ.js +0 -1
- package/components/form-core/translations/de-DE.js +0 -1
- package/components/form-core/translations/en-AU.js +0 -1
- package/components/form-core/translations/en-GB.js +0 -1
- package/components/form-core/translations/en-US.js +0 -1
- package/components/form-core/translations/es-ES.js +0 -1
- package/components/form-core/translations/fr-BE.js +0 -1
- package/components/form-core/translations/fr-FR.js +0 -1
- package/components/form-core/translations/hu-HU.js +0 -1
- package/components/form-core/translations/it-IT.js +0 -1
- package/components/form-core/translations/nl-BE.js +0 -1
- package/components/form-core/translations/nl-NL.js +0 -1
- package/components/form-core/translations/pl-PL.js +0 -1
- package/components/form-core/translations/ro-RO.js +0 -1
- package/components/form-core/translations/ru-RU.js +0 -1
- package/components/form-core/translations/sk-SK.js +0 -1
- package/components/form-core/translations/tr-TR.js +0 -1
- package/components/form-core/translations/uk-UA.js +0 -1
- package/components/form-integrations/test/dialog-integrations.test.js +1 -4
- package/components/form-integrations/test/form-group-methods.test.js +28 -31
- package/components/form-integrations/test/form-integrations.test.js +27 -28
- package/components/form-integrations/test/form-validation-integrations.test.js +21 -29
- package/components/form-integrations/test/helpers/umbrella-form.js +3 -5
- package/components/form-integrations/test/model-value-consistency.test.js +75 -77
- package/components/form-integrations/test/model-value-event.test.js +10 -20
- package/components/helpers/src/SbActionLogger.js +13 -17
- package/components/helpers/src/SbLocaleSwitcher.js +5 -5
- package/components/helpers/src/sortEachDepth.js +0 -2
- package/components/helpers/test/renderLitAsNode.test.js +0 -4
- package/components/helpers/test/sb-action-logger.test.js +24 -55
- package/components/icon/src/IconManager.js +0 -2
- package/components/icon/src/LionIcon.js +2 -7
- package/components/icon/src/icons.js +0 -2
- package/components/icon/test/IconManager.test.js +0 -15
- package/components/icon/test/hammer.svg.js +3 -4
- package/components/icon/test/heart.svg.js +3 -4
- package/components/icon/test/lion-icon.test.js +14 -43
- package/components/input/src/LionInput.js +2 -8
- package/components/input/test/input-integrations.test.js +0 -5
- package/components/input/test/lion-input-integrations.test.js +0 -4
- package/components/input/test/lion-input.test.js +28 -58
- package/components/input/test-helpers/getInputMembers.js +2 -2
- package/components/input-amount/src/LionInputAmount.js +20 -20
- package/components/input-amount/src/formatters.js +0 -3
- package/components/input-amount/src/parsers.js +0 -3
- package/components/input-amount/test/formatters.test.js +24 -16
- package/components/input-amount/test/lion-input-amount-integrations.test.js +0 -4
- package/components/input-amount/test/lion-input-amount.test.js +123 -147
- package/components/input-amount/test/parsers.test.js +33 -17
- package/components/input-amount/test/preprocessors.test.js +0 -3
- package/components/input-amount-dropdown/src/LionInputAmountDropdown.js +49 -59
- package/components/input-amount-dropdown/src/currencyUtil.js +8 -7
- package/components/input-amount-dropdown/src/parsers.js +0 -1
- package/components/input-amount-dropdown/src/validators.js +0 -1
- package/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js +34 -36
- package/components/input-amount-dropdown/test/lion-input-amount-dropdown-integrations.test.js +18 -13
- package/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
- package/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js +132 -107
- package/components/input-date/src/LionInputDate.js +4 -3
- package/components/input-date/test/lion-input-date-integrations.test.js +0 -3
- package/components/input-date/test/lion-input-date.test.js +19 -32
- package/components/input-datepicker/src/LionInputDatepicker.js +17 -29
- package/components/input-datepicker/src/localizeNamespaceLoader.js +1 -2
- package/components/input-datepicker/test/lion-input-datepicker-integrations.test.js +0 -3
- package/components/input-datepicker/test/lion-input-datepicker.test.js +88 -153
- package/components/input-datepicker/test-helpers/DatepickerInputObject.js +9 -12
- package/components/input-datepicker/test-suites/LionInputDatepicker.suite.js +6 -4
- package/components/input-datepicker/translations/bg-BG.js +0 -1
- package/components/input-datepicker/translations/cs-CZ.js +0 -1
- package/components/input-datepicker/translations/de-DE.js +0 -1
- package/components/input-datepicker/translations/en-AU.js +0 -1
- package/components/input-datepicker/translations/en-GB.js +0 -1
- package/components/input-datepicker/translations/en-US.js +0 -1
- package/components/input-datepicker/translations/es-ES.js +0 -1
- package/components/input-datepicker/translations/fr-BE.js +0 -1
- package/components/input-datepicker/translations/fr-FR.js +0 -1
- package/components/input-datepicker/translations/hu-HU.js +0 -1
- package/components/input-datepicker/translations/it-IT.js +0 -1
- package/components/input-datepicker/translations/nl-BE.js +0 -1
- package/components/input-datepicker/translations/nl-NL.js +0 -1
- package/components/input-datepicker/translations/pl-PL.js +0 -1
- package/components/input-datepicker/translations/ro-RO.js +0 -1
- package/components/input-datepicker/translations/ru-RU.js +0 -1
- package/components/input-datepicker/translations/sk-SK.js +0 -1
- package/components/input-datepicker/translations/tr-TR.js +0 -1
- package/components/input-datepicker/translations/uk-UA.js +0 -1
- package/components/input-email/test/lion-input-email-integrations.test.js +0 -2
- package/components/input-email/test/lion-input-email.test.js +1 -7
- package/components/input-file/src/FileHandle.js +0 -3
- package/components/input-file/src/LionInputFile.js +85 -83
- package/components/input-file/src/LionSelectedFileList.js +12 -12
- package/components/input-file/src/validators.js +10 -9
- package/components/input-file/test/FileValidators.test.js +170 -80
- package/components/input-file/test/lion-input-file.test.js +160 -244
- package/components/input-file/test/lion-selected-file-list.test.js +13 -22
- package/components/input-file/translations/bg-BG.js +0 -1
- package/components/input-file/translations/cs-CZ.js +0 -1
- package/components/input-file/translations/de-DE.js +0 -1
- package/components/input-file/translations/en-AU.js +0 -1
- package/components/input-file/translations/en-GB.js +0 -1
- package/components/input-file/translations/en-PH.js +0 -1
- package/components/input-file/translations/en-US.js +0 -1
- package/components/input-file/translations/en.js +2 -1
- package/components/input-file/translations/es-ES.js +0 -1
- package/components/input-file/translations/fr-BE.js +0 -1
- package/components/input-file/translations/fr-FR.js +0 -1
- package/components/input-file/translations/hu-HU.js +0 -1
- package/components/input-file/translations/id-ID.js +0 -1
- package/components/input-file/translations/id.js +2 -1
- package/components/input-file/translations/it-IT.js +0 -1
- package/components/input-file/translations/nl-BE.js +0 -1
- package/components/input-file/translations/nl-NL.js +0 -1
- package/components/input-file/translations/pl-PL.js +0 -1
- package/components/input-file/translations/ro-RO.js +0 -1
- package/components/input-file/translations/ru-RU.js +0 -1
- package/components/input-file/translations/sk-SK.js +0 -1
- package/components/input-file/translations/uk-UA.js +0 -1
- package/components/input-file/translations/zh-CN.js +0 -1
- package/components/input-iban/src/validators.js +6 -11
- package/components/input-iban/test/formatters.test.js +0 -3
- package/components/input-iban/test/lion-input-iban-integrations.test.js +0 -2
- package/components/input-iban/test/lion-input-iban.test.js +1 -9
- package/components/input-iban/test/parsers.test.js +0 -2
- package/components/input-iban/test/validators.test.js +0 -12
- package/components/input-iban/translations/bg-BG.js +0 -1
- package/components/input-iban/translations/cs-CZ.js +0 -1
- package/components/input-iban/translations/de-DE.js +0 -1
- package/components/input-iban/translations/en-AU.js +0 -1
- package/components/input-iban/translations/en-GB.js +0 -1
- package/components/input-iban/translations/en-US.js +0 -1
- package/components/input-iban/translations/es-ES.js +0 -1
- package/components/input-iban/translations/fr-BE.js +0 -1
- package/components/input-iban/translations/fr-FR.js +0 -1
- package/components/input-iban/translations/hu-HU.js +0 -1
- package/components/input-iban/translations/it-IT.js +0 -1
- package/components/input-iban/translations/nl-BE.js +0 -1
- package/components/input-iban/translations/nl-NL.js +0 -1
- package/components/input-iban/translations/pl-PL.js +0 -1
- package/components/input-iban/translations/ro-RO.js +0 -1
- package/components/input-iban/translations/ru-RU.js +0 -1
- package/components/input-iban/translations/sk-SK.js +0 -1
- package/components/input-iban/translations/uk-UA.js +0 -1
- package/components/input-range/src/LionInputRange.js +18 -19
- package/components/input-range/test/lion-input-range.test.js +23 -48
- package/components/input-range/translations/bg-BG.js +0 -1
- package/components/input-range/translations/cs-CZ.js +0 -1
- package/components/input-range/translations/de-DE.js +0 -1
- package/components/input-range/translations/en-AU.js +0 -1
- package/components/input-range/translations/en-GB.js +0 -1
- package/components/input-range/translations/en-PH.js +0 -1
- package/components/input-range/translations/en-US.js +0 -1
- package/components/input-range/translations/es-ES.js +0 -1
- package/components/input-range/translations/fr-BE.js +0 -1
- package/components/input-range/translations/fr-FR.js +0 -1
- package/components/input-range/translations/hu-HU.js +0 -1
- package/components/input-range/translations/it-IT.js +0 -1
- package/components/input-range/translations/nl-BE.js +0 -1
- package/components/input-range/translations/nl-NL.js +0 -1
- package/components/input-range/translations/pl-PL.js +0 -1
- package/components/input-range/translations/ro-RO.js +0 -1
- package/components/input-range/translations/ru-RU.js +0 -1
- package/components/input-range/translations/sk-SK.js +0 -1
- package/components/input-range/translations/uk-UA.js +0 -1
- package/components/input-range/translations/zh-CN.js +0 -1
- package/components/input-stepper/src/LionInputStepper.js +19 -38
- package/components/input-stepper/test/lion-input-stepper-integrations.test.js +0 -1
- package/components/input-stepper/test/lion-input-stepper.test.js +0 -1
- package/components/input-stepper/test-suites/lion-input-stepper.integration.suite.js +0 -2
- package/components/input-stepper/test-suites/lion-input-stepper.suite.js +56 -105
- package/components/input-stepper/translations/bg-BG.js +0 -1
- package/components/input-stepper/translations/cs-CZ.js +0 -1
- package/components/input-stepper/translations/de-DE.js +0 -1
- package/components/input-stepper/translations/en-AU.js +0 -1
- package/components/input-stepper/translations/en-GB.js +0 -1
- package/components/input-stepper/translations/en-US.js +0 -1
- package/components/input-stepper/translations/es-ES.js +0 -1
- package/components/input-stepper/translations/fr-BE.js +0 -1
- package/components/input-stepper/translations/fr-FR.js +0 -1
- package/components/input-stepper/translations/hu-HU.js +0 -1
- package/components/input-stepper/translations/it-IT.js +0 -1
- package/components/input-stepper/translations/nl-BE.js +0 -1
- package/components/input-stepper/translations/nl-NL.js +0 -1
- package/components/input-stepper/translations/pl-PL.js +0 -1
- package/components/input-stepper/translations/ro-RO.js +0 -1
- package/components/input-stepper/translations/ru-RU.js +0 -1
- package/components/input-stepper/translations/sk-SK.js +0 -1
- package/components/input-stepper/translations/uk-UA.js +0 -1
- package/components/input-tel/src/LionInputTel.js +53 -37
- package/components/input-tel/src/PhoneUtilManager.js +6 -4
- package/components/input-tel/src/formatters.js +12 -10
- package/components/input-tel/src/parsers.js +3 -3
- package/components/input-tel/src/preprocessors.js +15 -7
- package/components/input-tel/src/validators.js +4 -6
- package/components/input-tel/test/LionInputTel.test.js +4 -2
- package/components/input-tel/test/formatters.test.js +22 -10
- package/components/input-tel/test/parsers.test.js +127 -11
- package/components/input-tel/test/preprocessors.test.js +24 -13
- package/components/input-tel/test/validators.test.js +7 -14
- package/components/input-tel/test-helpers/mockPhoneUtilManager.js +20 -8
- package/components/input-tel/test-suites/LionInputTel.suite.js +33 -73
- package/components/input-tel/translations/bg-BG.js +0 -1
- package/components/input-tel/translations/cs-CZ.js +0 -1
- package/components/input-tel/translations/de-DE.js +0 -1
- package/components/input-tel/translations/en-AU.js +0 -1
- package/components/input-tel/translations/en-GB.js +0 -1
- package/components/input-tel/translations/en-US.js +0 -1
- package/components/input-tel/translations/es-ES.js +0 -1
- package/components/input-tel/translations/fr-BE.js +0 -1
- package/components/input-tel/translations/fr-FR.js +0 -1
- package/components/input-tel/translations/hu-HU.js +0 -1
- package/components/input-tel/translations/it-IT.js +0 -1
- package/components/input-tel/translations/nl-BE.js +0 -1
- package/components/input-tel/translations/nl-NL.js +0 -1
- package/components/input-tel/translations/pl-PL.js +0 -1
- package/components/input-tel/translations/ro-RO.js +0 -1
- package/components/input-tel/translations/ru-RU.js +0 -1
- package/components/input-tel/translations/sk-SK.js +0 -1
- package/components/input-tel/translations/uk-UA.js +0 -1
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +10 -28
- package/components/input-tel-dropdown/src/regionCodeToLocale.js +3 -1
- package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +31 -38
- package/components/input-tel-dropdown/test/regionCodeToLocale.test.js +0 -1
- package/components/input-tel-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown--parentheses.suite.js +16 -11
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +54 -79
- package/components/listbox/src/LionListbox.js +5 -2
- package/components/listbox/src/LionOption.js +8 -7
- package/components/listbox/src/LionOptions.js +0 -3
- package/components/listbox/src/ListboxMixin.js +786 -820
- package/components/listbox/test/lion-listbox.test.js +0 -1
- package/components/listbox/test/lion-option.test.js +53 -64
- package/components/listbox/test/lion-options.test.js +3 -4
- package/components/listbox/test-helpers/getListboxMembers.js +6 -3
- package/components/listbox/test-suites/ListboxMixin.suite.js +101 -261
- package/components/localize/src/LocalizeManager.js +40 -40
- package/components/localize/src/LocalizeMixin.js +130 -157
- package/components/localize/src/date/formatDate.js +1 -5
- package/components/localize/src/date/getDateFormatBasedOnLocale.js +5 -3
- package/components/localize/src/date/getMonthNames.js +3 -5
- package/components/localize/src/date/getWeekdayNames.js +1 -5
- package/components/localize/src/date/parseDate.js +5 -20
- package/components/localize/src/date/utils/normalizeIntlDate.js +0 -7
- package/components/localize/src/getLocalizeManager.js +0 -3
- package/components/localize/src/number/formatNumber.js +3 -7
- package/components/localize/src/number/formatNumberToParts.js +52 -18
- package/components/localize/src/number/getCurrencyName.js +5 -5
- package/components/localize/src/number/getFractionDigits.js +4 -4
- package/components/localize/src/number/getSeparatorsFromNumber.js +1 -3
- package/components/localize/src/number/parseNumber.js +0 -3
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceAddGroupSeparators.js +0 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSpaceBetweenCurrencyCodeAndNumber.js +4 -1
- package/components/localize/test/LocalizeManager.test.js +385 -278
- package/components/localize/test/LocalizeMixin.test.js +28 -112
- package/components/localize/test/date/formatDate.test.js +18 -48
- package/components/localize/test/date/getDateFormatBasedOnLocale.test.js +0 -3
- package/components/localize/test/date/getMonthNames.test.js +27 -12
- package/components/localize/test/date/getWeekdayNames.test.js +93 -49
- package/components/localize/test/date/normalizeDateTime.test.js +0 -2
- package/components/localize/test/date/parseDate.test.js +12 -16
- package/components/localize/test/getLocalizeManager.test.js +0 -3
- package/components/localize/test/isLocalizeESModule.test.js +32 -13
- package/components/localize/test/localize.test.js +0 -4
- package/components/localize/test/number/formatNumber.test.js +215 -106
- package/components/localize/test/number/formatNumberToParts.test.js +31 -38
- package/components/localize/test/number/getCurrencyName.test.js +20 -6
- package/components/localize/test/number/getDecimalSeparator.test.js +5 -4
- package/components/localize/test/number/getFractionDigits.test.js +0 -2
- package/components/localize/test/number/getGroupSeparator.test.js +0 -2
- package/components/localize/test/number/getSeparatorsFromNumber.test.js +5 -3
- package/components/localize/test/number/parseNumber.test.js +123 -56
- package/components/localize/test/side-effect-free-entrypoint.test.js +0 -6
- package/components/localize/test-helpers/fake-imports.js +11 -6
- package/components/localize/test-helpers/localizeTearDown.js +0 -1
- package/components/menu/src/InteractiveListMixin.js +637 -638
- package/components/menu/src/LionMenu.js +46 -59
- package/components/menu/src/MoreButtonMenuMixin.js +215 -238
- package/components/menu/src/MultiLevelListMixin.js +240 -246
- package/components/menu/src/utils/isInView.js +0 -1
- package/components/menu/src/utils/listItemInteractions.js +4 -4
- package/components/menu/test/InteractiveListMixin.test.js +0 -1
- package/components/menu/test/MoreButtonMenuMixin.test.js +3 -2
- package/components/menu/test/MultiLevelListMixin.test.js +0 -1
- package/components/menu/test/lion-menu-interactions.test.js +0 -1
- package/components/menu/test/lion-menu.test.js +6 -2
- package/components/menu/test-helpers/mimicKeyPress.js +12 -2
- package/components/menu/test-suites/InteractiveListMixin.suite.js +4 -43
- package/components/menu/test-suites/LionMenu.suite.js +1 -8
- package/components/menu/test-suites/LionMenuInteractions.suite.js +22 -44
- package/components/menu/test-suites/MoreButtonMenuMixin.suite.js +34 -41
- package/components/menu/test-suites/MultiLevelListMixin.suite.js +5 -23
- package/components/overlays/src/ArrowMixin.js +111 -127
- package/components/overlays/src/OverlayController.js +172 -152
- package/components/overlays/src/OverlayMixin.js +64 -69
- package/components/overlays/src/OverlaysManager.js +30 -32
- package/components/overlays/src/configurations/visibility-trigger-partials/withClickInteraction.js +0 -1
- package/components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js +11 -11
- package/components/overlays/src/configurations/withBottomSheetConfig.js +12 -13
- package/components/overlays/src/configurations/withDropdownConfig.js +4 -2
- package/components/overlays/src/configurations/withModalDialogConfig.js +12 -13
- package/components/overlays/src/configurations/withPopoverConfig.js +27 -25
- package/components/overlays/src/configurations/withTooltipConfig.js +15 -13
- package/components/overlays/src/overlayDocumentStyle.js +1 -1
- package/components/overlays/src/overlayShadowDomStyle.js +0 -1
- package/components/overlays/src/singleton.js +0 -2
- package/components/overlays/src/utils/adopt-styles.js +18 -18
- package/components/overlays/src/utils/deep-contains.js +7 -6
- package/components/overlays/src/utils/get-focusable-elements.js +7 -10
- package/components/overlays/src/utils/inert-siblings.js +2 -4
- package/components/overlays/src/utils/is-equal-config.js +2 -3
- package/components/overlays/src/utils/is-visible.js +0 -1
- package/components/overlays/src/utils/simulate-tab.js +1 -4
- package/components/overlays/src/utils/sort-by-tabindex.js +2 -4
- package/components/overlays/test/ArrowMixin.test.js +18 -30
- package/components/overlays/test/OverlayController.test.js +406 -555
- package/components/overlays/test/OverlayMixin.test.js +0 -2
- package/components/overlays/test/OverlaysManager.test.js +30 -35
- package/components/overlays/test/global-positioning.test.js +6 -10
- package/components/overlays/test/invoker-compatibility.test.js +37 -0
- package/components/overlays/test/local-positioning.test.js +101 -103
- package/components/overlays/test/utils-tests/active-element.test.js +12 -27
- package/components/overlays/test/utils-tests/adopt-styles.test.js +25 -56
- package/components/overlays/test/utils-tests/deep-contains.test.js +73 -74
- package/components/overlays/test/utils-tests/get-focusable-elements.test.js +6 -23
- package/components/overlays/test/utils-tests/is-equal-config.test.js +32 -13
- package/components/overlays/test/utils-tests/visibility.test.js +44 -79
- package/components/overlays/test-helpers/createShadowHost.js +5 -3
- package/components/overlays/test-helpers/normalizeTransformStyle.js +2 -4
- package/components/overlays/test-suites/OverlayMixin.suite.js +152 -181
- package/components/overlays/test-suites/WithHoverInteraction.suite.js +96 -79
- package/components/overlays/translations/bg-BG.js +0 -1
- package/components/overlays/translations/cs-CZ.js +0 -1
- package/components/overlays/translations/de-DE.js +0 -1
- package/components/overlays/translations/en-AU.js +0 -1
- package/components/overlays/translations/en-GB.js +0 -1
- package/components/overlays/translations/en-US.js +0 -1
- package/components/overlays/translations/es-ES.js +0 -1
- package/components/overlays/translations/fr-BE.js +0 -1
- package/components/overlays/translations/fr-FR.js +0 -1
- package/components/overlays/translations/hu-HU.js +0 -1
- package/components/overlays/translations/it-IT.js +0 -1
- package/components/overlays/translations/nl-BE.js +0 -1
- package/components/overlays/translations/nl-NL.js +0 -1
- package/components/overlays/translations/pl-PL.js +0 -1
- package/components/overlays/translations/ro-RO.js +0 -1
- package/components/overlays/translations/ru-RU.js +0 -1
- package/components/overlays/translations/sk-SK.js +0 -1
- package/components/overlays/translations/tr-TR.js +0 -1
- package/components/overlays/translations/uk-UA.js +0 -1
- package/components/pagination/src/LionPagination.js +9 -12
- package/components/pagination/test/lion-pagination.test.js +18 -50
- package/components/progress-indicator/src/LionProgressIndicator.js +10 -12
- package/components/progress-indicator/test/lion-progress-indicator.test.js +1 -22
- package/components/radio-group/src/LionRadioGroup.js +1 -2
- package/components/radio-group/test/lion-radio-group-integrations.test.js +0 -1
- package/components/radio-group/test/lion-radio-group.test.js +27 -27
- package/components/radio-group/test/lion-radio-integrations.test.js +3 -2
- package/components/radio-group/test/lion-radio.test.js +30 -16
- package/components/select/src/LionSelect.js +12 -13
- package/components/select/test/lion-select.test.js +7 -12
- package/components/select-rich/src/LionSelectInvoker.js +18 -11
- package/components/select-rich/src/LionSelectRich.js +22 -44
- package/components/select-rich/test/demos.screenshots-test.js +40 -9
- package/components/select-rich/test/lion-select-invoker.test.js +26 -43
- package/components/select-rich/test/lion-select-listbox-suite-integration.test.js +3 -3
- package/components/select-rich/test/lion-select-rich-dialog-integration.test.js +4 -9
- package/components/select-rich/test/lion-select-rich-interaction.test.js +116 -116
- package/components/select-rich/test/lion-select-rich-upgrade.test.js +3 -7
- package/components/select-rich/test/lion-select-rich.test.js +153 -195
- package/components/select-rich/test-helpers/getSelectRichMembers.js +4 -1
- package/components/steps/src/LionStep.js +21 -12
- package/components/steps/src/LionSteps.js +25 -25
- package/components/steps/test/lion-step.test.js +18 -25
- package/components/steps/test/lion-steps.test.js +45 -78
- package/components/switch/src/LionSwitch.js +2 -7
- package/components/switch/src/LionSwitchButton.js +5 -6
- package/components/switch/test/lion-switch-button.test.js +16 -28
- package/components/switch/test/lion-switch.test.js +17 -31
- package/components/tabs/src/LionTabs.js +25 -28
- package/components/tabs/test/lion-tabs.test.js +156 -154
- package/components/textarea/src/LionTextarea.js +4 -23
- package/components/textarea/test/lion-textarea-integrations.test.js +0 -5
- package/components/textarea/test/lion-textarea.test.js +2 -28
- package/components/tooltip/src/LionTooltip.js +6 -6
- package/components/tooltip/test/lion-tooltip.test.js +75 -102
- package/components/validate-messages/src/getLocalizedMessage.js +8 -7
- package/components/validate-messages/src/loadDefaultFeedbackMessages.js +3 -1
- package/components/validate-messages/src/loadDefaultFeedbackMessagesNoSideEffects.js +9 -5
- package/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.js +5 -2
- package/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.js +99 -35
- package/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.js +4 -3
- package/components/validate-messages/test/loadDefaultFeedbackMessages.test.js +5 -3
- package/components/validate-messages/test/loadDefaultFeedbackMessagesNoSideEffects.test.js +80 -45
- package/components/validate-messages/translations/bg-BG.js +0 -1
- package/components/validate-messages/translations/cs-CZ.js +0 -1
- package/components/validate-messages/translations/de-DE.js +0 -1
- package/components/validate-messages/translations/en-AU.js +0 -1
- package/components/validate-messages/translations/en-GB.js +0 -1
- package/components/validate-messages/translations/en-PH.js +0 -1
- package/components/validate-messages/translations/en-US.js +0 -1
- package/components/validate-messages/translations/es-ES.js +0 -1
- package/components/validate-messages/translations/fr-BE.js +0 -1
- package/components/validate-messages/translations/fr-FR.js +0 -1
- package/components/validate-messages/translations/hu-HU.js +0 -1
- package/components/validate-messages/translations/it-IT.js +0 -1
- package/components/validate-messages/translations/nl-BE.js +0 -1
- package/components/validate-messages/translations/nl-NL.js +0 -1
- package/components/validate-messages/translations/pl-PL.js +0 -1
- package/components/validate-messages/translations/ro-RO.js +0 -1
- package/components/validate-messages/translations/ru-RU.js +0 -1
- package/components/validate-messages/translations/sk-SK.js +0 -1
- package/components/validate-messages/translations/tr-TR.js +0 -1
- package/components/validate-messages/translations/uk-UA.js +0 -1
- package/custom-elements.json +229 -85
- package/dist-types/components/core/src/SlotMixin.d.ts +6 -1
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +5 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/form-core/src/LionField.d.ts +3 -1
- package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/LionInputTel.d.ts +6 -6
- package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts +2 -2
- package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/formatters.d.ts +2 -2
- package/dist-types/components/input-tel/src/formatters.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/preprocessors.d.ts +2 -2
- package/dist-types/components/input-tel/src/preprocessors.d.ts.map +1 -1
- package/dist-types/components/input-tel/test/validators.test.d.ts +1 -1
- package/dist-types/components/input-tel/test/validators.test.d.ts.map +1 -1
- package/dist-types/components/input-tel/test-helpers/mockPhoneUtilManager.d.ts +5 -0
- package/dist-types/components/input-tel/test-helpers/mockPhoneUtilManager.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionListbox.d.ts +2 -2
- package/dist-types/components/listbox/src/LionListbox.d.ts.map +1 -1
- package/dist-types/components/listbox/src/LionOption.d.ts +5 -2
- package/dist-types/components/listbox/src/LionOption.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts +3 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
- package/dist-types/components/overlays/src/overlayDocumentStyle.d.ts.map +1 -1
- package/dist-types/components/overlays/test/invoker-compatibility.test.d.ts +3 -0
- package/dist-types/components/overlays/test/invoker-compatibility.test.d.ts.map +1 -0
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts +3 -1
- package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +6 -5
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/overview.md +2 -2
- package/docs/components/accordion/reference.md +2 -2
- package/docs/components/accordion/use-cases.md +2 -2
- package/docs/components/button/examples.md +2 -2
- package/docs/components/button/extensions.md +2 -2
- package/docs/components/button/overview.md +2 -2
- package/docs/components/button/use-cases.md +2 -2
- package/docs/components/calendar/overview.md +2 -2
- package/docs/components/calendar/use-cases.md +2 -2
- package/docs/components/checkbox-group/overview.md +4 -4
- package/docs/components/checkbox-group/use-cases.md +2 -2
- package/docs/components/collapsible/examples.md +2 -2
- package/docs/components/collapsible/overview.md +3 -3
- package/docs/components/collapsible/use-cases.md +2 -2
- package/docs/components/combobox/api-table.md +1 -1
- package/docs/components/combobox/extensions.md +2 -2
- package/docs/components/combobox/overview.md +3 -3
- package/docs/components/combobox/use-cases.md +3 -3
- package/docs/components/dialog/overview.md +3 -3
- package/docs/components/dialog/use-cases.md +2 -2
- package/docs/components/drawer/overview.md +2 -2
- package/docs/components/drawer/use-cases.md +2 -2
- package/docs/components/fieldset/overview.md +7 -7
- package/docs/components/fieldset/use-cases.md +2 -2
- package/docs/components/form/overview.md +5 -5
- package/docs/components/form/use-cases.md +4 -4
- package/docs/components/icon/overview.md +2 -2
- package/docs/components/icon/use-cases.md +3 -3
- package/docs/components/input/overview.md +3 -3
- package/docs/components/input/use-cases.md +2 -2
- package/docs/components/input-amount/overview.md +5 -5
- package/docs/components/input-amount/use-cases.md +2 -2
- package/docs/components/input-amount-dropdown/use-cases.md +2 -2
- package/docs/components/input-date/overview.md +5 -5
- package/docs/components/input-date/use-cases.md +2 -2
- package/docs/components/input-datepicker/overview.md +7 -7
- package/docs/components/input-datepicker/use-cases.md +2 -2
- package/docs/components/input-email/overview.md +4 -4
- package/docs/components/input-email/use-cases.md +2 -2
- package/docs/components/input-file/overview.md +3 -3
- package/docs/components/input-file/use-cases.md +2 -2
- package/docs/components/input-iban/overview.md +4 -4
- package/docs/components/input-iban/use-cases.md +2 -2
- package/docs/components/input-range/overview.md +4 -4
- package/docs/components/input-range/use-cases.md +2 -2
- package/docs/components/input-stepper/overview.md +3 -3
- package/docs/components/input-stepper/use-cases.md +2 -2
- package/docs/components/input-tel/overview.md +3 -3
- package/docs/components/input-tel/use-cases.md +8 -8
- package/docs/components/input-tel-dropdown/extensions.md +2 -2
- package/docs/components/input-tel-dropdown/overview.md +3 -3
- package/docs/components/input-tel-dropdown/use-cases.md +2 -2
- package/docs/components/listbox/api-table.md +4 -4
- package/docs/components/listbox/overview.md +2 -2
- package/docs/components/listbox/use-cases.md +3 -3
- package/docs/components/menu/extensions.md +2 -2
- package/docs/components/menu/migration.md +2 -2
- package/docs/components/menu/overview.md +2 -2
- package/docs/components/menu/use-cases.md +1 -1
- package/docs/components/pagination/overview.md +2 -2
- package/docs/components/pagination/use-cases.md +2 -2
- package/docs/components/progress-indicator/examples.md +2 -2
- package/docs/components/progress-indicator/overview.md +2 -2
- package/docs/components/radio-group/overview.md +5 -5
- package/docs/components/radio-group/use-cases.md +2 -2
- package/docs/components/select/overview.md +2 -2
- package/docs/components/select/use-cases.md +3 -3
- package/docs/components/select-rich/api-table.md +1 -1
- package/docs/components/select-rich/examples.md +2 -2
- package/docs/components/select-rich/overview.md +2 -2
- package/docs/components/select-rich/use-cases.md +4 -4
- package/docs/components/steps/overview.md +2 -2
- package/docs/components/steps/use-cases.md +2 -2
- package/docs/components/switch/overview.md +2 -2
- package/docs/components/switch/reference.md +2 -2
- package/docs/components/switch/use-cases.md +2 -2
- package/docs/components/tabs/examples.md +3 -3
- package/docs/components/tabs/overview.md +2 -2
- package/docs/components/tabs/use-cases.md +2 -2
- package/docs/components/textarea/overview.md +2 -2
- package/docs/components/textarea/use-cases.md +2 -2
- package/docs/components/tooltip/examples.md +2 -2
- package/docs/components/tooltip/overview.md +2 -2
- package/docs/components/tooltip/use-cases.md +2 -2
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +2 -2
- package/docs/fundamentals/node-tools/providence-analytics/index.md +2 -2
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +2 -2
- package/docs/fundamentals/node-tools/publish-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/publish-docs/overview.md +5 -5
- package/docs/fundamentals/node-tools/remark-extend/index.md +2 -2
- package/docs/fundamentals/node-tools/remark-extend/overview.md +2 -2
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +2 -2
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +4 -4
- package/docs/fundamentals/rationales/TypeScript.md +62 -2
- package/docs/fundamentals/rationales/accessibility.md +5 -5
- package/docs/fundamentals/rationales/side-effects.md +2 -2
- package/docs/fundamentals/rationales/versioning.md +2 -2
- package/docs/fundamentals/systems/core/SlotMixin.md +3 -3
- package/docs/fundamentals/systems/core/index.md +2 -2
- package/docs/fundamentals/systems/core/overview.md +3 -3
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +6 -6
- package/docs/fundamentals/systems/form/index.md +2 -2
- package/docs/fundamentals/systems/form/interaction-states.md +2 -2
- package/docs/fundamentals/systems/form/model-value.md +3 -3
- package/docs/fundamentals/systems/form/overview.md +30 -30
- package/docs/fundamentals/systems/form/styling.md +2 -2
- package/docs/fundamentals/systems/form/use-cases.md +2 -2
- package/docs/fundamentals/systems/form/validate.md +4 -4
- package/docs/fundamentals/systems/icon/index.md +2 -2
- package/docs/fundamentals/systems/icon/overview.md +2 -2
- package/docs/fundamentals/systems/localize/dates.md +2 -2
- package/docs/fundamentals/systems/localize/index.md +2 -2
- package/docs/fundamentals/systems/localize/numbers.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +6 -6
- package/docs/fundamentals/systems/localize/rationale.md +2 -2
- package/docs/fundamentals/systems/localize/text.md +2 -2
- package/docs/fundamentals/systems/localize/use-cases.md +2 -2
- package/docs/fundamentals/systems/overlays/_edge-cases.md +2 -2
- package/docs/fundamentals/systems/overlays/api-table.md +1 -1
- package/docs/fundamentals/systems/overlays/configuration.md +4 -4
- package/docs/fundamentals/systems/overlays/index.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +7 -7
- package/docs/fundamentals/systems/overlays/rationale.md +2 -2
- package/docs/fundamentals/systems/overlays/use-cases.md +4 -4
- package/docs/fundamentals/tools/ajax/index.md +2 -2
- package/docs/fundamentals/tools/ajax/overview.md +2 -2
- package/docs/fundamentals/tools/ajax/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/action-logger.md +2 -2
- package/docs/fundamentals/tools/helpers/index.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +3 -3
- package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/example-success/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/index.md +2 -2
- package/docs/fundamentals/tools/singleton-manager/overview.md +6 -6
- package/docs/guides/how-to/create-a-custom-field.md +7 -7
- package/docs/guides/how-to/create-a-form.md +6 -6
- package/docs/guides/how-to/extend-a-native-input.md +4 -4
- package/docs/guides/how-to/get-started.md +2 -2
- package/docs/guides/how-to/index.md +1 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/definitions-and-terms.md +2 -2
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/scoped-elements.md +2 -2
- package/docs/guides/principles/styling.md +3 -3
- package/docs/guides/principles/subclasser-apis.md +2 -2
- package/exports/define/lion-accordion.js +0 -1
- package/exports/define/lion-button-reset.js +0 -1
- package/exports/define/lion-button-submit.js +0 -1
- package/exports/define/lion-button.js +0 -1
- package/exports/define/lion-calendar.js +0 -1
- package/exports/define/lion-checkbox-group.js +0 -1
- package/exports/define/lion-checkbox-indeterminate.js +0 -1
- package/exports/define/lion-checkbox.js +0 -1
- package/exports/define/lion-collapsible.js +0 -1
- package/exports/define/lion-combobox.js +0 -1
- package/exports/define/lion-dialog.js +0 -1
- package/exports/define/lion-drawer.js +0 -1
- package/exports/define/lion-field.js +0 -1
- package/exports/define/lion-fieldset.js +0 -1
- package/exports/define/lion-form.js +0 -1
- package/exports/define/lion-icon.js +0 -1
- package/exports/define/lion-input-amount-dropdown.js +0 -1
- package/exports/define/lion-input-amount.js +0 -1
- package/exports/define/lion-input-date.js +0 -1
- package/exports/define/lion-input-datepicker.js +0 -1
- package/exports/define/lion-input-email.js +0 -1
- package/exports/define/lion-input-file.js +0 -1
- package/exports/define/lion-input-iban.js +0 -1
- package/exports/define/lion-input-range.js +0 -1
- package/exports/define/lion-input-stepper.js +0 -1
- package/exports/define/lion-input-tel-dropdown.js +0 -1
- package/exports/define/lion-input-tel.js +0 -1
- package/exports/define/lion-input.js +0 -1
- package/exports/define/lion-item.js +0 -1
- package/exports/define/lion-listbox.js +0 -1
- package/exports/define/lion-menu.js +0 -1
- package/exports/define/lion-menuitem.js +0 -1
- package/exports/define/lion-option.js +0 -1
- package/exports/define/lion-options.js +0 -1
- package/exports/define/lion-pagination.js +0 -1
- package/exports/define/lion-progress-indicator.js +0 -1
- package/exports/define/lion-radio-group.js +0 -1
- package/exports/define/lion-radio.js +0 -1
- package/exports/define/lion-select-invoker.js +0 -1
- package/exports/define/lion-select-rich.js +0 -1
- package/exports/define/lion-select.js +0 -1
- package/exports/define/lion-selected-file-list.js +0 -1
- package/exports/define/lion-step.js +0 -1
- package/exports/define/lion-steps.js +0 -1
- package/exports/define/lion-switch-button.js +0 -1
- package/exports/define/lion-switch.js +0 -1
- package/exports/define/lion-tabs.js +0 -1
- package/exports/define/lion-textarea.js +0 -1
- package/exports/define/lion-tooltip.js +0 -1
- package/exports/define/lion-validation-feedback.js +0 -1
- package/exports/define-helpers/sb-action-logger.js +0 -1
- package/exports/define-helpers/sb-locale-switcher.js +0 -1
- package/exports/form-core.js +0 -8
- package/exports/localize-no-side-effects.js +0 -1
- package/exports/localize.js +0 -2
- package/exports/overlays.js +0 -4
- package/generated/awesome-phonenumber/LICENSE +22 -0
- package/generated/awesome-phonenumber/LICENSE.closure-library +176 -0
- package/generated/awesome-phonenumber/LICENSE.libphonenumber +176 -0
- package/generated/awesome-phonenumber/checksums.json +6 -0
- package/generated/awesome-phonenumber/index-esm.mjs +817 -0
- package/generated/awesome-phonenumber/index.d.ts +227 -0
- package/generated/awesome-phonenumber/index.js +45 -0
- package/generated/awesome-phonenumber/lib/index.js +710 -0
- package/generated/awesome-phonenumber/package.json +9 -0
- package/generated/awesome-phonenumber/provenance.json +13 -0
- package/package.json +38 -15
- package/vscode.html-custom-data.json +5 -5
- package/web-types.json +1 -1
- package/vendor/README.md +0 -61
- package/vendor/awesome-phonenumber-7.9.0-tlouisse.libphonenumber-9.0.41.tgz +0 -0
|
@@ -26,7 +26,7 @@ import { getCachedFixture } from '../../core/test-helpers/getCachedFixture.js';
|
|
|
26
26
|
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
const fixture = /** @type {(arg: TemplateResult) => Promise<LionListbox>} */
|
|
29
|
+
const fixture = /** @type {(arg: TemplateResult) => Promise<LionListbox>} */ _fixture;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @param {HTMLElement} el
|
|
@@ -34,8 +34,18 @@ const fixture = /** @type {(arg: TemplateResult) => Promise<LionListbox>} */ (_f
|
|
|
34
34
|
* @param {string} code
|
|
35
35
|
*/
|
|
36
36
|
function mimicKeyPress(el, key, code = '') {
|
|
37
|
-
el.dispatchEvent(
|
|
38
|
-
|
|
37
|
+
el.dispatchEvent(
|
|
38
|
+
new KeyboardEvent('keydown', {
|
|
39
|
+
key,
|
|
40
|
+
code,
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
el.dispatchEvent(
|
|
44
|
+
new KeyboardEvent('keyup', {
|
|
45
|
+
key,
|
|
46
|
+
code,
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
/**
|
|
@@ -47,10 +57,8 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
47
57
|
optionTagString: 'lion-option',
|
|
48
58
|
...customConfig,
|
|
49
59
|
};
|
|
50
|
-
|
|
51
60
|
const tag = unsafeStatic(cfg.tagString);
|
|
52
61
|
const optionTag = unsafeStatic(cfg.optionTagString);
|
|
53
|
-
|
|
54
62
|
describe('ListboxMixin', () => {
|
|
55
63
|
// TODO: See if it is possible to get functionality from ChoiceGroup and/or Field suite(s)
|
|
56
64
|
describe('FormControl (Field / ChoiceGroup) functionality', () => {
|
|
@@ -63,7 +71,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
63
71
|
`);
|
|
64
72
|
expect(el.modelValue).to.equal('10');
|
|
65
73
|
});
|
|
66
|
-
|
|
67
74
|
it('should dispatch model-value-changed 1 time on first paint', async () => {
|
|
68
75
|
const spy = sinon.spy();
|
|
69
76
|
await fixture(html`
|
|
@@ -75,7 +82,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
75
82
|
`);
|
|
76
83
|
expect(spy.callCount).to.equal(1);
|
|
77
84
|
});
|
|
78
|
-
|
|
79
85
|
it('should dispatch model-value-changed 1 time on interaction', async () => {
|
|
80
86
|
const spy = sinon.spy();
|
|
81
87
|
const el = await fixture(html`
|
|
@@ -85,17 +91,13 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
85
91
|
<${optionTag} .choiceValue="${'30'}">Item 3</${optionTag}>
|
|
86
92
|
</${tag}>
|
|
87
93
|
`);
|
|
88
|
-
|
|
89
94
|
el.addEventListener('model-value-changed', spy);
|
|
90
95
|
el.formElements[1].checked = true;
|
|
91
96
|
expect(spy.callCount).to.equal(1);
|
|
92
|
-
|
|
93
97
|
spy.resetHistory();
|
|
94
|
-
|
|
95
98
|
el.formElements[2].checked = true;
|
|
96
99
|
expect(spy.callCount).to.equal(1);
|
|
97
100
|
});
|
|
98
|
-
|
|
99
101
|
it('should not dispatch model-value-changed on reappend checked child', async () => {
|
|
100
102
|
const spy = sinon.spy();
|
|
101
103
|
const el = await fixture(html`
|
|
@@ -105,15 +107,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
105
107
|
<${optionTag} .choiceValue="${'30'}">Item 3</${optionTag}>
|
|
106
108
|
</${tag}>
|
|
107
109
|
`);
|
|
108
|
-
|
|
109
110
|
el.addEventListener('model-value-changed', spy);
|
|
110
111
|
el.formElements[1].checked = true;
|
|
111
112
|
expect(spy.callCount).to.equal(1);
|
|
112
|
-
|
|
113
113
|
el.appendChild(el.formElements[1]);
|
|
114
114
|
expect(spy.callCount).to.equal(1);
|
|
115
115
|
});
|
|
116
|
-
|
|
117
116
|
it('automatically sets the name attribute of child checkboxes to its own name', async () => {
|
|
118
117
|
const el = await fixture(html`
|
|
119
118
|
<${tag} name="foo">
|
|
@@ -121,18 +120,14 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
121
120
|
<${optionTag} .choiceValue=${20}>Item 2</${optionTag}>
|
|
122
121
|
</${tag}>
|
|
123
122
|
`);
|
|
124
|
-
|
|
125
123
|
expect(el.formElements[0].name).to.equal('foo');
|
|
126
124
|
expect(el.formElements[1].name).to.equal('foo');
|
|
127
|
-
|
|
128
125
|
const validChild = await fixture(
|
|
129
126
|
html` <${optionTag} .choiceValue=${30}>Item 3</${optionTag}> `,
|
|
130
127
|
);
|
|
131
128
|
el.appendChild(validChild);
|
|
132
|
-
|
|
133
129
|
expect(el.formElements[2].name).to.equal('foo');
|
|
134
130
|
});
|
|
135
|
-
|
|
136
131
|
it('throws if a child element without a modelValue like { value: "foo", checked: false } tries to register', async () => {
|
|
137
132
|
const el = await fixture(html`
|
|
138
133
|
<${tag} name="foo">
|
|
@@ -143,14 +138,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
143
138
|
const invalidChild = await fixture(
|
|
144
139
|
html` <${optionTag} .modelValue=${'Lara'}></${optionTag}> `,
|
|
145
140
|
);
|
|
146
|
-
|
|
147
141
|
expect(() => {
|
|
148
142
|
el.addFormElement(invalidChild);
|
|
149
143
|
}).to.throw(
|
|
150
144
|
`The ${cfg.tagString} name="foo" does not allow to register lion-option with .modelValue="Lara" - The modelValue should represent an Object { value: "foo", checked: false }`,
|
|
151
145
|
);
|
|
152
146
|
});
|
|
153
|
-
|
|
154
147
|
it('can set initial modelValue on creation', async () => {
|
|
155
148
|
const el = await fixture(html`
|
|
156
149
|
<${tag} name="gender" .modelValue=${'other'}>
|
|
@@ -159,11 +152,9 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
159
152
|
<${optionTag} .choiceValue=${'other'}></${optionTag}>
|
|
160
153
|
</${tag}>
|
|
161
154
|
`);
|
|
162
|
-
|
|
163
155
|
expect(el.modelValue).to.equal('other');
|
|
164
156
|
expect(el.formElements[2].checked).to.be.true;
|
|
165
157
|
});
|
|
166
|
-
|
|
167
158
|
it('requests update for modelValue when checkedIndex changes', async () => {
|
|
168
159
|
const el = /** @type {LionListbox} */ await fixture(html`
|
|
169
160
|
<${tag} name="gender" .modelValue=${'other'}>
|
|
@@ -182,7 +173,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
182
173
|
sinon.match.map.contains(new Map([['modelValue', 'other']])),
|
|
183
174
|
);
|
|
184
175
|
});
|
|
185
|
-
|
|
186
176
|
it('requests update for modelValue after click', async () => {
|
|
187
177
|
const el = await fixture(html`
|
|
188
178
|
<${tag} name="gender" .modelValue=${'other'}>
|
|
@@ -201,7 +191,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
201
191
|
sinon.match.map.contains(new Map([['modelValue', 'other']])),
|
|
202
192
|
);
|
|
203
193
|
});
|
|
204
|
-
|
|
205
194
|
it('requests update for modelValue when checkedIndex changes for multiple choice', async () => {
|
|
206
195
|
const el = await fixture(html`
|
|
207
196
|
<${tag} name="gender" multiple-choice .modelValue=${['other']}>
|
|
@@ -223,7 +212,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
223
212
|
// reference values vs real values suck :( had to do it like this, sinon matchers did not match because 'other' is inside an array so it's not a "real" match
|
|
224
213
|
expect([...updatedSpy.args[0][0].entries()]).to.deep.include(['modelValue', ['other']]);
|
|
225
214
|
});
|
|
226
|
-
|
|
227
215
|
it('requests update for modelValue after click for multiple choice', async () => {
|
|
228
216
|
const el = await fixture(html`
|
|
229
217
|
<${tag} name="gender" multiple-choice .modelValue=${['other']}>
|
|
@@ -245,14 +233,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
245
233
|
// reference values vs real values suck :( had to do it like this, sinon matchers did not match because 'other' is inside an array so it's not a "real" match
|
|
246
234
|
expect([...updatedSpy.args[0][0].entries()]).to.deep.include(['modelValue', ['other']]);
|
|
247
235
|
});
|
|
248
|
-
|
|
249
236
|
it(`has a fieldName based on the label`, async () => {
|
|
250
237
|
const el1 = await fixture(html`
|
|
251
238
|
<${tag} label="foo"></${tag}>
|
|
252
239
|
`);
|
|
253
240
|
const { _labelNode: _labelNode1 } = getListboxMembers(el1);
|
|
254
241
|
expect(el1.fieldName).to.equal(_labelNode1.textContent);
|
|
255
|
-
|
|
256
242
|
const el2 = await fixture(html`
|
|
257
243
|
<${tag}>
|
|
258
244
|
<label slot="label">bar</label>
|
|
@@ -261,14 +247,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
261
247
|
const { _labelNode: _labelNode2 } = getListboxMembers(el2);
|
|
262
248
|
expect(el2.fieldName).to.equal(_labelNode2.textContent);
|
|
263
249
|
});
|
|
264
|
-
|
|
265
250
|
it(`has a fieldName based on the name if no label exists`, async () => {
|
|
266
251
|
const el = await fixture(html`
|
|
267
252
|
<${tag} name="foo"></${tag}>
|
|
268
253
|
`);
|
|
269
254
|
expect(el.fieldName).to.equal(el.name);
|
|
270
255
|
});
|
|
271
|
-
|
|
272
256
|
it(`can override fieldName`, async () => {
|
|
273
257
|
const el = await fixture(html`
|
|
274
258
|
<${tag} label="foo" .fieldName="${'bar'}"></${tag}>
|
|
@@ -276,7 +260,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
276
260
|
// @ts-ignore [allow-protected] in test
|
|
277
261
|
expect(el.__fieldName).to.equal(el.fieldName);
|
|
278
262
|
});
|
|
279
|
-
|
|
280
263
|
it('supports validation', async () => {
|
|
281
264
|
const el = await fixture(html`
|
|
282
265
|
<${tag}
|
|
@@ -291,7 +274,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
291
274
|
<${optionTag} .choiceValue=${'teal'}>Teal</${optionTag}>
|
|
292
275
|
</${tag}>
|
|
293
276
|
`);
|
|
294
|
-
|
|
295
277
|
expect(el.hasFeedbackFor.includes('error')).to.be.true;
|
|
296
278
|
expect(el.showsFeedbackFor.includes('error')).to.be.false;
|
|
297
279
|
|
|
@@ -299,19 +281,16 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
299
281
|
el.submitted = true;
|
|
300
282
|
await el.updateComplete;
|
|
301
283
|
expect(el.showsFeedbackFor.includes('error')).to.be.true;
|
|
302
|
-
|
|
303
284
|
el.formElements[1].checked = true;
|
|
304
285
|
await el.updateComplete;
|
|
305
286
|
expect(el.hasFeedbackFor.includes('error')).to.be.false;
|
|
306
287
|
expect(el.showsFeedbackFor.includes('error')).to.be.false;
|
|
307
|
-
|
|
308
288
|
el.formElements[0].checked = true;
|
|
309
289
|
await el.updateComplete;
|
|
310
290
|
expect(el.hasFeedbackFor.includes('error')).to.be.true;
|
|
311
291
|
expect(el.showsFeedbackFor.includes('error')).to.be.true;
|
|
312
292
|
});
|
|
313
293
|
});
|
|
314
|
-
|
|
315
294
|
describe('Selection', () => {
|
|
316
295
|
it('supports changing the selection through serializedValue setter', async () => {
|
|
317
296
|
const el = await fixture(html`
|
|
@@ -321,16 +300,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
321
300
|
<${optionTag} .choiceValue=${'teal'}>Teal</${optionTag}>
|
|
322
301
|
</${tag}>
|
|
323
302
|
`);
|
|
324
|
-
|
|
325
303
|
expect(el.checkedIndex).to.equal(-1);
|
|
326
304
|
expect(el.serializedValue).to.equal('');
|
|
327
|
-
|
|
328
305
|
el.serializedValue = 'hotpink';
|
|
329
|
-
|
|
330
306
|
expect(el.checkedIndex).to.equal(1);
|
|
331
307
|
expect(el.serializedValue).to.equal('hotpink');
|
|
332
308
|
});
|
|
333
|
-
|
|
334
309
|
it('scrolls active element into view when necessary, takes into account sticky/fixed elements', async () => {
|
|
335
310
|
const el = await fixture(html`
|
|
336
311
|
<div id="scrolling-element" style="position: relative; overflow-y: scroll; height: 570px;">
|
|
@@ -352,7 +327,7 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
352
327
|
</div>
|
|
353
328
|
</div>
|
|
354
329
|
`);
|
|
355
|
-
const listboxEl = /** @type {LionListbox} */
|
|
330
|
+
const listboxEl = /** @type {LionListbox} */ el.querySelector('#color');
|
|
356
331
|
|
|
357
332
|
// Skip test if listbox cannot receive focus, e.g. in combobox
|
|
358
333
|
// Skip test if the listbox is controlled by overlay system,
|
|
@@ -362,22 +337,19 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
362
337
|
if (listboxEl._listboxReceivesNoFocus || listboxEl._overlayCtrl) {
|
|
363
338
|
return;
|
|
364
339
|
}
|
|
365
|
-
|
|
366
340
|
Object.defineProperty(listboxEl, '_scrollTargetNode', {
|
|
367
341
|
get: () => el,
|
|
368
342
|
});
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
listboxEl.formElements[listboxEl.formElements.length - 1]
|
|
373
|
-
);
|
|
343
|
+
const thirdOption = /** @type {LionOption} */ listboxEl.formElements[2];
|
|
344
|
+
const lastOption =
|
|
345
|
+
/** @type {LionOption} */
|
|
346
|
+
listboxEl.formElements[listboxEl.formElements.length - 1];
|
|
374
347
|
await listboxEl.updateComplete;
|
|
375
348
|
await nextFrame();
|
|
376
349
|
|
|
377
350
|
// Scroll to last option and wait for browser scroll animation (works)
|
|
378
351
|
lastOption.active = true;
|
|
379
352
|
await aTimeout(1000);
|
|
380
|
-
|
|
381
353
|
thirdOption.active = true;
|
|
382
354
|
await aTimeout(1000);
|
|
383
355
|
|
|
@@ -385,7 +357,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
385
357
|
expect(el.scrollTop).to.equal(116);
|
|
386
358
|
});
|
|
387
359
|
});
|
|
388
|
-
|
|
389
360
|
describe('Accessibility', () => {
|
|
390
361
|
it('[axe]: is accessible when opened', async () => {
|
|
391
362
|
const el = await fixture(html`
|
|
@@ -397,7 +368,9 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
397
368
|
await el.updateComplete;
|
|
398
369
|
await el.updateComplete; // need 2 awaits as overlay.show is an async function
|
|
399
370
|
// for more info about why we need the ignoreRules, see: https://lion.js.org/fundamentals/systems/overlays/rationale/#considerations
|
|
400
|
-
await expect(el).to.be.accessible({
|
|
371
|
+
await expect(el).to.be.accessible({
|
|
372
|
+
ignoredRules: ['aria-allowed-role'],
|
|
373
|
+
});
|
|
401
374
|
});
|
|
402
375
|
|
|
403
376
|
// NB: regular listbox is always 'opened', but needed for combobox and select-rich
|
|
@@ -409,14 +382,14 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
409
382
|
</${tag}>
|
|
410
383
|
`);
|
|
411
384
|
// for more info about why we need the ignoreRules, see: https://lion.js.org/fundamentals/systems/overlays/rationale/#considerations
|
|
412
|
-
await expect(el).to.be.accessible({
|
|
385
|
+
await expect(el).to.be.accessible({
|
|
386
|
+
ignoredRules: ['aria-allowed-role'],
|
|
387
|
+
});
|
|
413
388
|
});
|
|
414
|
-
|
|
415
389
|
it('does not have a tabindex', async () => {
|
|
416
390
|
const el = await fixture(html`<${tag}></${tag}>`);
|
|
417
391
|
expect(el.hasAttribute('tabindex')).to.be.false;
|
|
418
392
|
});
|
|
419
|
-
|
|
420
393
|
it('creates unique ids for all children', async () => {
|
|
421
394
|
const el = await fixture(html`
|
|
422
395
|
<${tag}>
|
|
@@ -429,7 +402,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
429
402
|
expect(el.querySelectorAll(cfg.optionTagString)[1].id).to.exist;
|
|
430
403
|
expect(el.querySelectorAll(cfg.optionTagString)[2].id).to.equal('predefined');
|
|
431
404
|
});
|
|
432
|
-
|
|
433
405
|
it('has a reference to the active option', async () => {
|
|
434
406
|
const el = await fixture(html`
|
|
435
407
|
<${tag} opened has-no-default-selected autocomplete="none" show-all-on-empty>
|
|
@@ -438,7 +410,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
438
410
|
</${tag}>
|
|
439
411
|
`);
|
|
440
412
|
const { _activeDescendantOwnerNode } = getListboxMembers(el);
|
|
441
|
-
|
|
442
413
|
expect(_activeDescendantOwnerNode.getAttribute('aria-activedescendant')).to.be.null;
|
|
443
414
|
await el.updateComplete;
|
|
444
415
|
|
|
@@ -450,22 +421,20 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
450
421
|
await el.updateComplete;
|
|
451
422
|
expect(_activeDescendantOwnerNode.getAttribute('aria-activedescendant')).to.equal('second');
|
|
452
423
|
});
|
|
453
|
-
|
|
454
424
|
it('puts "aria-setsize" on all options to indicate the total amount of options', async () => {
|
|
455
|
-
const el =
|
|
425
|
+
const el =
|
|
426
|
+
/** @type {LionListbox} */
|
|
456
427
|
await fixture(html`
|
|
457
428
|
<${tag} autocomplete="none" show-all-on-empty>
|
|
458
429
|
<${optionTag} .choiceValue=${10}>Item 1</${optionTag}>
|
|
459
430
|
<${optionTag} .choiceValue=${20}>Item 2</${optionTag}>
|
|
460
431
|
<${optionTag} .choiceValue=${30}>Item 3</${optionTag}>
|
|
461
432
|
</${tag}>
|
|
462
|
-
`)
|
|
463
|
-
)
|
|
464
|
-
el.formElements.forEach(optionEl => {
|
|
433
|
+
`);
|
|
434
|
+
el.formElements.forEach((optionEl) => {
|
|
465
435
|
expect(optionEl.getAttribute('aria-setsize')).to.equal('3');
|
|
466
436
|
});
|
|
467
437
|
});
|
|
468
|
-
|
|
469
438
|
it('puts "aria-posinset" on all options to indicate their position in the listbox', async () => {
|
|
470
439
|
const el = await fixture(html`
|
|
471
440
|
<${tag} autocomplete="none" show-all-on-empty>
|
|
@@ -479,7 +448,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
479
448
|
});
|
|
480
449
|
});
|
|
481
450
|
});
|
|
482
|
-
|
|
483
451
|
describe('Values', () => {
|
|
484
452
|
// TODO: ChoiceGroup suite?
|
|
485
453
|
it('registers options', async () => {
|
|
@@ -495,7 +463,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
495
463
|
el.querySelectorAll('lion-option')[1],
|
|
496
464
|
]);
|
|
497
465
|
});
|
|
498
|
-
|
|
499
466
|
it('allows null choiceValue', async () => {
|
|
500
467
|
const el = await fixture(html`
|
|
501
468
|
<${tag}>
|
|
@@ -513,7 +480,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
513
480
|
}
|
|
514
481
|
expect(el.modelValue).to.be.null;
|
|
515
482
|
});
|
|
516
|
-
|
|
517
483
|
it('should reset selected value to initial value', async () => {
|
|
518
484
|
const el = await fixture(html`
|
|
519
485
|
<${tag}>
|
|
@@ -527,7 +493,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
527
493
|
el.reset();
|
|
528
494
|
expect(el.modelValue).to.equal('20');
|
|
529
495
|
});
|
|
530
|
-
|
|
531
496
|
it('should reset selected value to "Please select account" with has-no-default-selected attribute', async () => {
|
|
532
497
|
const el = await fixture(html`
|
|
533
498
|
<${tag} has-no-default-selected>
|
|
@@ -540,7 +505,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
540
505
|
el.reset();
|
|
541
506
|
expect(el.modelValue).to.equal('');
|
|
542
507
|
});
|
|
543
|
-
|
|
544
508
|
it('should reset selected value to initial values when multiple-choice', async () => {
|
|
545
509
|
const el = await fixture(html`
|
|
546
510
|
<${tag} multiple-choice has-no-default-selected>
|
|
@@ -554,7 +518,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
554
518
|
el.reset();
|
|
555
519
|
expect(el.modelValue).to.deep.equal(['20', '30']);
|
|
556
520
|
});
|
|
557
|
-
|
|
558
521
|
it('has an activeIndex', async () => {
|
|
559
522
|
const el = await fixture(html`
|
|
560
523
|
<${tag} has-no-default-selected autocomplete="list">
|
|
@@ -563,13 +526,11 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
563
526
|
</${tag}>
|
|
564
527
|
`);
|
|
565
528
|
const options = el.formElements;
|
|
566
|
-
|
|
567
529
|
expect(el.activeIndex).to.equal(-1);
|
|
568
530
|
options[1].active = true;
|
|
569
531
|
expect(options[0].active).to.be.false;
|
|
570
532
|
expect(el.activeIndex).to.equal(1);
|
|
571
533
|
});
|
|
572
|
-
|
|
573
534
|
it('should reset activeIndex value', async () => {
|
|
574
535
|
const el = await fixture(html`
|
|
575
536
|
<${tag} has-no-default-selected>
|
|
@@ -578,14 +539,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
578
539
|
</${tag}>
|
|
579
540
|
`);
|
|
580
541
|
const options = el.formElements;
|
|
581
|
-
|
|
582
542
|
expect(el.activeIndex).to.equal(-1);
|
|
583
543
|
options[1].active = true;
|
|
584
544
|
expect(el.activeIndex).to.equal(1);
|
|
585
545
|
el.reset();
|
|
586
546
|
expect(el.activeIndex).to.equal(-1);
|
|
587
547
|
});
|
|
588
|
-
|
|
589
548
|
it('clears modelValue on clear()', async () => {
|
|
590
549
|
const el = await fixture(html`
|
|
591
550
|
<${tag} has-no-default-selected>
|
|
@@ -593,16 +552,13 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
593
552
|
<${optionTag} .choiceValue=${'20'}>Item 2</${optionTag}>
|
|
594
553
|
</${tag}>
|
|
595
554
|
`);
|
|
596
|
-
|
|
597
555
|
el.setCheckedIndex(0);
|
|
598
556
|
await el.updateComplete;
|
|
599
557
|
expect(el.modelValue).to.deep.equal('10');
|
|
600
|
-
|
|
601
558
|
el.clear();
|
|
602
559
|
await el.updateComplete;
|
|
603
560
|
expect(el.modelValue).to.equal('');
|
|
604
561
|
});
|
|
605
|
-
|
|
606
562
|
it('clears modelValue on clear() when multiple-choice', async () => {
|
|
607
563
|
const el = await fixture(html`
|
|
608
564
|
<${tag} has-no-default-selected multiple-choice>
|
|
@@ -613,11 +569,9 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
613
569
|
el.setCheckedIndex(0);
|
|
614
570
|
await el.updateComplete;
|
|
615
571
|
expect(el.modelValue).to.eql(['10']);
|
|
616
|
-
|
|
617
572
|
el.clear();
|
|
618
573
|
expect(el.modelValue).to.eql([]);
|
|
619
574
|
});
|
|
620
|
-
|
|
621
575
|
it('keeps interaction states on clear()', async () => {
|
|
622
576
|
const el = await fixture(html`
|
|
623
577
|
<${tag} has-no-default-selected>
|
|
@@ -625,62 +579,59 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
625
579
|
<${optionTag} .choiceValue=${'20'}>Item 2</${optionTag}>
|
|
626
580
|
</${tag}>
|
|
627
581
|
`);
|
|
628
|
-
|
|
629
582
|
el.setCheckedIndex(0);
|
|
630
583
|
await el.updateComplete;
|
|
631
584
|
expect(el.dirty).to.equal(true);
|
|
632
|
-
|
|
633
585
|
el.clear();
|
|
634
586
|
await el.updateComplete;
|
|
635
587
|
expect(el.dirty).to.equal(true);
|
|
636
588
|
});
|
|
637
589
|
});
|
|
638
|
-
|
|
639
590
|
describe('Interactions', () => {
|
|
640
591
|
describe('Keyboard navigation', () => {
|
|
641
592
|
describe('Rotate Keyboard Navigation', () => {
|
|
642
593
|
it('stops navigation by default at end of option list', async () => {
|
|
643
|
-
const el =
|
|
594
|
+
const el =
|
|
595
|
+
/** @type {LionListbox} */
|
|
644
596
|
await fixture(html`
|
|
645
597
|
<${tag} opened name="foo" .rotateKeyboardNavigation="${false}">
|
|
646
598
|
<${optionTag} .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
647
599
|
<${optionTag} .choiceValue="${'Bla'}">Bla</${optionTag}>
|
|
648
600
|
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
649
601
|
</${tag}>
|
|
650
|
-
`)
|
|
651
|
-
);
|
|
602
|
+
`);
|
|
652
603
|
const { _listboxNode } = getListboxMembers(el);
|
|
653
604
|
|
|
654
605
|
// Normalize
|
|
655
606
|
el.activeIndex = 0;
|
|
656
607
|
const options = el.formElements;
|
|
657
|
-
|
|
658
608
|
mimicKeyPress(_listboxNode, 'ArrowUp');
|
|
659
|
-
|
|
660
609
|
expect(options[0].active).to.be.true;
|
|
661
610
|
expect(options[1].active).to.be.false;
|
|
662
611
|
expect(options[2].active).to.be.false;
|
|
663
612
|
el.activeIndex = 2;
|
|
664
613
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
665
|
-
|
|
666
614
|
expect(options[0].active).to.be.false;
|
|
667
615
|
expect(options[1].active).to.be.false;
|
|
668
616
|
expect(options[2].active).to.be.true;
|
|
669
617
|
});
|
|
670
|
-
|
|
671
618
|
it('when "rotate-navigation" provided, selects first option after navigated to next from last and vice versa', async () => {
|
|
672
|
-
const el =
|
|
619
|
+
const el =
|
|
620
|
+
/** @type {LionListbox} */
|
|
673
621
|
await fixture(html`
|
|
674
622
|
<${tag} opened name="foo" rotate-keyboard-navigation autocomplete="inline">
|
|
675
623
|
<${optionTag} checked .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
676
624
|
<${optionTag} .choiceValue="${'Bla'}">Bla</${optionTag}>
|
|
677
625
|
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
678
626
|
</${tag}>
|
|
679
|
-
`)
|
|
680
|
-
);
|
|
627
|
+
`);
|
|
681
628
|
const { _inputNode } = getListboxMembers(el);
|
|
682
|
-
|
|
683
|
-
|
|
629
|
+
_inputNode.dispatchEvent(
|
|
630
|
+
new Event('focusin', {
|
|
631
|
+
bubbles: true,
|
|
632
|
+
composed: true,
|
|
633
|
+
}),
|
|
634
|
+
);
|
|
684
635
|
await el.updateComplete;
|
|
685
636
|
// Normalize
|
|
686
637
|
el.activeIndex = 0;
|
|
@@ -688,33 +639,29 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
688
639
|
|
|
689
640
|
// el._inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowUp' }));
|
|
690
641
|
mimicKeyPress(_inputNode, 'ArrowUp');
|
|
691
|
-
|
|
692
642
|
await el.updateComplete;
|
|
693
643
|
expect(el.activeIndex).to.equal(2);
|
|
694
644
|
|
|
695
645
|
// el._inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown' }));
|
|
696
646
|
mimicKeyPress(_inputNode, 'ArrowDown');
|
|
697
|
-
|
|
698
647
|
expect(el.activeIndex).to.equal(0);
|
|
699
648
|
// Extra check: regular navigation
|
|
700
649
|
// el._inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown' }));
|
|
701
650
|
mimicKeyPress(_inputNode, 'ArrowDown');
|
|
702
|
-
|
|
703
651
|
expect(el.activeIndex).to.equal(1);
|
|
704
652
|
});
|
|
705
653
|
});
|
|
706
|
-
|
|
707
654
|
describe('Enter', () => {
|
|
708
655
|
it('[Enter] selects active option', async () => {
|
|
709
|
-
const el =
|
|
656
|
+
const el =
|
|
657
|
+
/** @type {LionListbox} */
|
|
710
658
|
await fixture(html`
|
|
711
659
|
<${tag} opened name="foo" autocomplete="none" show-all-on-empty>
|
|
712
660
|
<${optionTag} .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
713
661
|
<${optionTag} .choiceValue="${'Bla'}">Bla</${optionTag}>
|
|
714
662
|
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
715
663
|
</${tag}>
|
|
716
|
-
`)
|
|
717
|
-
);
|
|
664
|
+
`);
|
|
718
665
|
const { _listboxNode } = getListboxMembers(el);
|
|
719
666
|
|
|
720
667
|
// Normalize suite
|
|
@@ -725,10 +672,10 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
725
672
|
mimicKeyPress(_listboxNode, 'Enter');
|
|
726
673
|
expect(options[1].checked).to.be.true;
|
|
727
674
|
});
|
|
728
|
-
|
|
729
675
|
it('submits form on [Enter] when inputNode is an instance of HTMLInputNode', async () => {
|
|
730
|
-
const submitSpy = sinon.spy(e => e.preventDefault());
|
|
731
|
-
const el =
|
|
676
|
+
const submitSpy = sinon.spy((e) => e.preventDefault());
|
|
677
|
+
const el =
|
|
678
|
+
/** @type {HTMLFormElement} */
|
|
732
679
|
await _fixture(html`
|
|
733
680
|
<form @submit=${submitSpy}>
|
|
734
681
|
<${tag} name="foo">
|
|
@@ -738,9 +685,8 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
738
685
|
</${tag}>
|
|
739
686
|
<button type="submit">submit</button>
|
|
740
687
|
</form>
|
|
741
|
-
`)
|
|
742
|
-
);
|
|
743
|
-
const listbox = /** @type {LionListbox} */ (el.querySelector('[name="foo"]'));
|
|
688
|
+
`);
|
|
689
|
+
const listbox = /** @type {LionListbox} */ el.querySelector('[name="foo"]');
|
|
744
690
|
const { _inputNode } = getListboxMembers(listbox);
|
|
745
691
|
if (!(_inputNode instanceof HTMLInputElement)) {
|
|
746
692
|
return;
|
|
@@ -755,20 +701,19 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
755
701
|
expect(submitSpy.callCount).to.equal(1);
|
|
756
702
|
});
|
|
757
703
|
});
|
|
758
|
-
|
|
759
704
|
describe('Space', () => {
|
|
760
705
|
it('selects active option when "_listboxReceivesNoFocus" is true', async () => {
|
|
761
706
|
// When listbox is not focusable (in case of a combobox), the user should be allowed
|
|
762
707
|
// to enter a space in the focusable element (textbox)
|
|
763
|
-
const el =
|
|
708
|
+
const el =
|
|
709
|
+
/** @type {LionListbox} */
|
|
764
710
|
await fixture(html`
|
|
765
711
|
<${tag} opened name="foo" ._listboxReceivesNoFocus="${false}" autocomplete="none" show-all-on-empty>
|
|
766
712
|
<${optionTag} .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
767
713
|
<${optionTag} .choiceValue="${'Bla'}">Bla</${optionTag}>
|
|
768
714
|
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
769
715
|
</${tag}>
|
|
770
|
-
`)
|
|
771
|
-
);
|
|
716
|
+
`);
|
|
772
717
|
const { _listboxNode } = getListboxMembers(el);
|
|
773
718
|
|
|
774
719
|
// Normalize suite
|
|
@@ -777,14 +722,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
777
722
|
el.checkedIndex = 0;
|
|
778
723
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
779
724
|
mimicKeyPress(_listboxNode, ' ');
|
|
780
|
-
|
|
781
725
|
expect(options[1].checked).to.be.true;
|
|
782
726
|
el.checkedIndex = 0;
|
|
783
727
|
// @ts-ignore allow protected member access in test
|
|
784
728
|
el._listboxReceivesNoFocus = true;
|
|
785
729
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
786
730
|
mimicKeyPress(_listboxNode, ' ');
|
|
787
|
-
|
|
788
731
|
expect(options[1].checked).to.be.false;
|
|
789
732
|
});
|
|
790
733
|
});
|
|
@@ -803,17 +746,14 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
803
746
|
if (el._noTypeAhead) {
|
|
804
747
|
return;
|
|
805
748
|
}
|
|
806
|
-
|
|
807
749
|
const { _listboxNode } = getListboxMembers(el);
|
|
808
750
|
|
|
809
751
|
// Normalize start values between listbox, select and combobox and test interaction below
|
|
810
752
|
el.activeIndex = 0;
|
|
811
|
-
|
|
812
753
|
mimicKeyPress(_listboxNode, 't', 'KeyT');
|
|
813
754
|
// await aTimeout(0);
|
|
814
755
|
expect(el.activeIndex).to.equal(1);
|
|
815
756
|
});
|
|
816
|
-
|
|
817
757
|
it('activates a value with multiple [character] keys', async () => {
|
|
818
758
|
const el = await fixture(html`
|
|
819
759
|
<${tag} opened id="color" name="color" label="Favorite color">
|
|
@@ -826,19 +766,15 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
826
766
|
if (el._noTypeAhead) {
|
|
827
767
|
return;
|
|
828
768
|
}
|
|
829
|
-
|
|
830
769
|
const { _listboxNode } = getListboxMembers(el);
|
|
831
770
|
|
|
832
771
|
// Normalize start values between listbox, select and combobox and test interaction below
|
|
833
772
|
el.activeIndex = 0;
|
|
834
|
-
|
|
835
773
|
mimicKeyPress(_listboxNode, 't', 'KeyT');
|
|
836
774
|
expect(el.activeIndex).to.equal(1);
|
|
837
|
-
|
|
838
775
|
mimicKeyPress(_listboxNode, 'u', 'KeyU');
|
|
839
776
|
expect(el.activeIndex).to.equal(2);
|
|
840
777
|
});
|
|
841
|
-
|
|
842
778
|
it('selects a value with [character] keys and selectionFollowsFocus', async () => {
|
|
843
779
|
const el = await fixture(html`
|
|
844
780
|
<${tag} opened id="color" name="color" label="Favorite color" selection-follows-focus>
|
|
@@ -851,19 +787,15 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
851
787
|
if (el._noTypeAhead) {
|
|
852
788
|
return;
|
|
853
789
|
}
|
|
854
|
-
|
|
855
790
|
const { _listboxNode } = getListboxMembers(el);
|
|
856
791
|
|
|
857
792
|
// Normalize start values between listbox, select and combobox and test interaction below
|
|
858
793
|
el.checkedIndex = 0;
|
|
859
|
-
|
|
860
794
|
mimicKeyPress(_listboxNode, 't', 'KeyT');
|
|
861
795
|
expect(el.checkedIndex).to.equal(1);
|
|
862
|
-
|
|
863
796
|
mimicKeyPress(_listboxNode, 'u', 'KeyU');
|
|
864
797
|
expect(el.checkedIndex).to.equal(2);
|
|
865
798
|
});
|
|
866
|
-
|
|
867
799
|
it('clears typedChars after _typeAheadTimeout', async () => {
|
|
868
800
|
const el = await fixture(html`
|
|
869
801
|
<${tag} opened id="color" name="color" label="Favorite color">
|
|
@@ -876,25 +808,19 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
876
808
|
if (el._noTypeAhead) {
|
|
877
809
|
return;
|
|
878
810
|
}
|
|
879
|
-
|
|
880
811
|
const clock = sinon.useFakeTimers();
|
|
881
812
|
const { _listboxNode } = getListboxMembers(el);
|
|
882
|
-
|
|
883
813
|
mimicKeyPress(_listboxNode, 't', 'KeyT');
|
|
884
814
|
// @ts-ignore [allow-private] in test
|
|
885
815
|
expect(el.__typedChars).to.deep.equal(['t']);
|
|
886
|
-
|
|
887
816
|
mimicKeyPress(_listboxNode, 'u', 'KeyU');
|
|
888
817
|
// @ts-ignore [allow-private] in test
|
|
889
818
|
expect(el.__typedChars).to.deep.equal(['t', 'u']);
|
|
890
|
-
|
|
891
819
|
clock.tick(1000);
|
|
892
820
|
// @ts-ignore [allow-private] in test
|
|
893
821
|
expect(el.__typedChars).to.deep.equal([]);
|
|
894
|
-
|
|
895
822
|
clock.restore();
|
|
896
823
|
});
|
|
897
|
-
|
|
898
824
|
it('clears scheduled timeouts', async () => {
|
|
899
825
|
const el = await fixture(html`
|
|
900
826
|
<${tag} opened id="color" name="color" label="Favorite color">
|
|
@@ -907,7 +833,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
907
833
|
if (el._noTypeAhead) {
|
|
908
834
|
return;
|
|
909
835
|
}
|
|
910
|
-
|
|
911
836
|
const { _listboxNode } = getListboxMembers(el);
|
|
912
837
|
|
|
913
838
|
// Normalize start values between listbox, select and combobox and test interaction below
|
|
@@ -920,7 +845,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
920
845
|
expect(clearTimeoutSpy.args[0][0]).to.equal(pendingClear);
|
|
921
846
|
});
|
|
922
847
|
});
|
|
923
|
-
|
|
924
848
|
it('navigates to first and last option with [Home] and [End] keys', async () => {
|
|
925
849
|
const el = await fixture(html`
|
|
926
850
|
<${tag} opened>
|
|
@@ -936,24 +860,22 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
936
860
|
if (el._listboxReceivesNoFocus) {
|
|
937
861
|
return;
|
|
938
862
|
}
|
|
939
|
-
|
|
940
863
|
el.activeIndex = 2;
|
|
941
864
|
mimicKeyPress(_listboxNode, 'Home');
|
|
942
865
|
expect(el.activeIndex).to.equal(0);
|
|
943
866
|
mimicKeyPress(_listboxNode, 'End');
|
|
944
867
|
expect(el.activeIndex).to.equal(3);
|
|
945
868
|
});
|
|
946
|
-
|
|
947
869
|
it('navigates through open lists with [ArrowDown] [ArrowUp] keys activates the option', async () => {
|
|
948
|
-
const el =
|
|
870
|
+
const el =
|
|
871
|
+
/** @type {LionListbox} */
|
|
949
872
|
await fixture(html`
|
|
950
873
|
<${tag} opened has-no-default-selected autocomplete="none" show-all-on-empty>
|
|
951
874
|
<${optionTag} .choiceValue=${'Item 1'}>Item 1</${optionTag}>
|
|
952
875
|
<${optionTag} .choiceValue=${'Item 2'}>Item 2</${optionTag}>
|
|
953
876
|
<${optionTag} .choiceValue=${'Item 3'}>Item 3</${optionTag}>
|
|
954
877
|
</${tag}>
|
|
955
|
-
`)
|
|
956
|
-
);
|
|
878
|
+
`);
|
|
957
879
|
const { _listboxNode } = getListboxMembers(el);
|
|
958
880
|
|
|
959
881
|
// Normalize across listbox/select-rich/combobox
|
|
@@ -967,82 +889,67 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
967
889
|
expect(el.activeIndex).to.equal(1);
|
|
968
890
|
expect(el.checkedIndex).to.equal(-1);
|
|
969
891
|
mimicKeyPress(_listboxNode, 'ArrowUp');
|
|
970
|
-
|
|
971
892
|
expect(el.activeIndex).to.equal(0);
|
|
972
893
|
expect(el.checkedIndex).to.equal(-1);
|
|
973
894
|
});
|
|
974
895
|
});
|
|
975
|
-
|
|
976
896
|
describe('Orientation', () => {
|
|
977
897
|
it('has a default value of "vertical"', async () => {
|
|
978
|
-
const el =
|
|
898
|
+
const el =
|
|
899
|
+
/** @type {LionListbox} */
|
|
979
900
|
await fixture(html`
|
|
980
901
|
<${tag} opened name="foo" autocomplete="none" show-all-on-empty>
|
|
981
902
|
<${optionTag} .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
982
903
|
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
983
904
|
</${tag}>
|
|
984
|
-
`)
|
|
985
|
-
);
|
|
905
|
+
`);
|
|
986
906
|
const { _listboxNode } = getListboxMembers(el);
|
|
987
|
-
|
|
988
907
|
expect(el.orientation).to.equal('vertical');
|
|
989
908
|
const options = el.formElements;
|
|
990
909
|
// Normalize for suite tests
|
|
991
910
|
el.activeIndex = 0;
|
|
992
|
-
|
|
993
911
|
await el.updateComplete;
|
|
994
912
|
expect(options[0].active).to.be.true;
|
|
995
913
|
expect(options[1].active).to.be.false;
|
|
996
|
-
|
|
997
914
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
998
915
|
expect(options[0].active).to.be.false;
|
|
999
916
|
expect(options[1].active).to.be.true;
|
|
1000
|
-
|
|
1001
917
|
mimicKeyPress(_listboxNode, 'ArrowUp');
|
|
1002
|
-
|
|
1003
918
|
expect(options[0].active).to.be.true;
|
|
1004
919
|
expect(options[1].active).to.be.false;
|
|
1005
920
|
|
|
1006
921
|
// No response to horizontal arrows...
|
|
1007
922
|
mimicKeyPress(_listboxNode, 'ArrowRight');
|
|
1008
|
-
|
|
1009
923
|
expect(options[0].active).to.be.true;
|
|
1010
924
|
expect(options[1].active).to.be.false;
|
|
1011
|
-
|
|
1012
925
|
el.activeIndex = 1;
|
|
1013
926
|
mimicKeyPress(_listboxNode, 'ArrowLeft');
|
|
1014
|
-
|
|
1015
927
|
expect(options[0].active).to.be.false;
|
|
1016
928
|
expect(options[1].active).to.be.true;
|
|
1017
929
|
});
|
|
1018
|
-
|
|
1019
930
|
it('uses [ArrowLeft] and [ArrowRight] keys when "horizontal"', async () => {
|
|
1020
|
-
const el =
|
|
931
|
+
const el =
|
|
932
|
+
/** @type {LionListbox} */
|
|
1021
933
|
await fixture(html`
|
|
1022
934
|
<${tag} ._listboxReceivesNoFocus="${false}" opened name="foo" orientation="horizontal" autocomplete="none" show-all-on-empty>
|
|
1023
935
|
<${optionTag} .choiceValue="${'Artichoke'}">Artichoke</${optionTag}>
|
|
1024
936
|
<${optionTag} .choiceValue="${'Chard'}">Chard</${optionTag}>
|
|
1025
937
|
</${tag}>
|
|
1026
|
-
`)
|
|
1027
|
-
);
|
|
938
|
+
`);
|
|
1028
939
|
const { _listboxNode } = getListboxMembers(el);
|
|
1029
|
-
|
|
1030
940
|
expect(el.orientation).to.equal('horizontal');
|
|
1031
941
|
|
|
1032
942
|
// Normalize for suite tests
|
|
1033
943
|
el.activeIndex = 0;
|
|
1034
944
|
await el.updateComplete;
|
|
1035
|
-
|
|
1036
945
|
mimicKeyPress(_listboxNode, 'ArrowRight');
|
|
1037
946
|
expect(el.activeIndex).to.equal(1);
|
|
1038
|
-
|
|
1039
947
|
mimicKeyPress(_listboxNode, 'ArrowLeft');
|
|
1040
948
|
expect(el.activeIndex).to.equal(0);
|
|
1041
949
|
|
|
1042
950
|
// No response to vertical arrows...
|
|
1043
951
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
1044
952
|
expect(el.activeIndex).to.equal(0);
|
|
1045
|
-
|
|
1046
953
|
el.activeIndex = 1;
|
|
1047
954
|
mimicKeyPress(_listboxNode, 'ArrowUp');
|
|
1048
955
|
expect(el.activeIndex).to.equal(1);
|
|
@@ -1051,11 +958,9 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1051
958
|
el._listboxReceivesNoFocus = true;
|
|
1052
959
|
mimicKeyPress(_listboxNode, 'ArrowLeft');
|
|
1053
960
|
expect(el.activeIndex).to.equal(1);
|
|
1054
|
-
|
|
1055
961
|
mimicKeyPress(_listboxNode, 'ArrowRight');
|
|
1056
962
|
expect(el.activeIndex).to.equal(1);
|
|
1057
963
|
});
|
|
1058
|
-
|
|
1059
964
|
describe('Accessibility', () => {
|
|
1060
965
|
it('adds aria-orientation attribute to listbox node', async () => {
|
|
1061
966
|
const el = await fixture(html`
|
|
@@ -1069,7 +974,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1069
974
|
});
|
|
1070
975
|
});
|
|
1071
976
|
});
|
|
1072
|
-
|
|
1073
977
|
describe('Multiple Choice', () => {
|
|
1074
978
|
it('does not uncheck siblings', async () => {
|
|
1075
979
|
const el = await fixture(html`
|
|
@@ -1086,7 +990,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1086
990
|
expect(options[0].checked).to.equal(true);
|
|
1087
991
|
expect(el.modelValue).to.eql(['Artichoke', 'Chard']);
|
|
1088
992
|
});
|
|
1089
|
-
|
|
1090
993
|
it('works via different interaction mechanisms (click, enter, spaces)', async () => {
|
|
1091
994
|
const el = await fixture(html`
|
|
1092
995
|
<${tag} name="foo" multiple-choice>
|
|
@@ -1144,19 +1047,15 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1144
1047
|
// Space
|
|
1145
1048
|
el.activeIndex = 0;
|
|
1146
1049
|
mimicKeyPress(_listboxNode, ' ');
|
|
1147
|
-
|
|
1148
1050
|
el.activeIndex = 1;
|
|
1149
1051
|
mimicKeyPress(_listboxNode, ' ');
|
|
1150
|
-
|
|
1151
1052
|
expect(options[0].checked).to.equal(true);
|
|
1152
1053
|
expect(el.modelValue).to.eql(['Artichoke', 'Chard']);
|
|
1153
1054
|
// also deselect
|
|
1154
1055
|
mimicKeyPress(_listboxNode, ' ');
|
|
1155
|
-
|
|
1156
1056
|
expect(options[0].checked).to.equal(true);
|
|
1157
1057
|
expect(el.modelValue).to.eql(['Artichoke']);
|
|
1158
1058
|
});
|
|
1159
|
-
|
|
1160
1059
|
describe('Accessibility', () => {
|
|
1161
1060
|
it('adds aria-multiselectable="true" to listbox node', async () => {
|
|
1162
1061
|
const el = await fixture(html`
|
|
@@ -1168,7 +1067,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1168
1067
|
const { _listboxNode } = getListboxMembers(el);
|
|
1169
1068
|
expect(_listboxNode.getAttribute('aria-multiselectable')).to.equal('true');
|
|
1170
1069
|
});
|
|
1171
|
-
|
|
1172
1070
|
it('does not allow "selectionFollowsFocus"', async () => {
|
|
1173
1071
|
const el = await fixture(html`
|
|
1174
1072
|
<${tag} name="foo" multiple-choice>
|
|
@@ -1177,14 +1075,16 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1177
1075
|
</${tag}>
|
|
1178
1076
|
`);
|
|
1179
1077
|
const { _listboxNode, _inputNode } = getListboxMembers(el);
|
|
1180
|
-
|
|
1181
1078
|
_inputNode.focus();
|
|
1182
|
-
_listboxNode.dispatchEvent(
|
|
1079
|
+
_listboxNode.dispatchEvent(
|
|
1080
|
+
new KeyboardEvent('keyup', {
|
|
1081
|
+
key: 'ArrowDown',
|
|
1082
|
+
}),
|
|
1083
|
+
);
|
|
1183
1084
|
expect(_listboxNode.getAttribute('aria-multiselectable')).to.equal('true');
|
|
1184
1085
|
});
|
|
1185
1086
|
});
|
|
1186
1087
|
});
|
|
1187
|
-
|
|
1188
1088
|
describe('Selection Follows Focus', () => {
|
|
1189
1089
|
it('navigates through list with [ArrowDown] [ArrowUp] keys: activates and checks the option', async () => {
|
|
1190
1090
|
/**
|
|
@@ -1200,16 +1100,15 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1200
1100
|
}
|
|
1201
1101
|
});
|
|
1202
1102
|
}
|
|
1203
|
-
const el =
|
|
1103
|
+
const el =
|
|
1104
|
+
/** @type {LionListbox} */
|
|
1204
1105
|
await fixture(html`
|
|
1205
1106
|
<${tag} opened selection-follows-focus autocomplete="none" show-all-on-empty>
|
|
1206
1107
|
<${optionTag} .choiceValue=${10}>Item 1</${optionTag}>
|
|
1207
1108
|
<${optionTag} .choiceValue=${20}>Item 2</${optionTag}>
|
|
1208
1109
|
<${optionTag} .choiceValue=${30}>Item 3</${optionTag}>
|
|
1209
1110
|
</${tag}>
|
|
1210
|
-
`)
|
|
1211
|
-
);
|
|
1212
|
-
|
|
1111
|
+
`);
|
|
1213
1112
|
const { _listboxNode } = getListboxMembers(el);
|
|
1214
1113
|
const options = el.formElements;
|
|
1215
1114
|
// Normalize start values between listbox, select and combobox and test interaction below
|
|
@@ -1223,12 +1122,10 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1223
1122
|
expect(el.checkedIndex).to.equal(1);
|
|
1224
1123
|
expectOnlyGivenOneOptionToBeChecked(options, 1);
|
|
1225
1124
|
mimicKeyPress(_listboxNode, 'ArrowUp');
|
|
1226
|
-
|
|
1227
1125
|
expect(el.activeIndex).to.equal(0);
|
|
1228
1126
|
expect(el.checkedIndex).to.equal(0);
|
|
1229
1127
|
expectOnlyGivenOneOptionToBeChecked(options, 0);
|
|
1230
1128
|
});
|
|
1231
|
-
|
|
1232
1129
|
it('navigates through list with [ArrowLeft] [ArrowRight] keys when horizontal: activates and checks the option', async () => {
|
|
1233
1130
|
/**
|
|
1234
1131
|
* @param {LionOption[]} options
|
|
@@ -1243,16 +1140,15 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1243
1140
|
}
|
|
1244
1141
|
});
|
|
1245
1142
|
}
|
|
1246
|
-
const el =
|
|
1143
|
+
const el =
|
|
1144
|
+
/** @type {LionListbox} */
|
|
1247
1145
|
await fixture(html`
|
|
1248
1146
|
<${tag} ._listboxReceivesNoFocus="${false}" opened selection-follows-focus orientation="horizontal" autocomplete="none" show-all-on-empty>
|
|
1249
1147
|
<${optionTag} .choiceValue=${10}>Item 1</${optionTag}>
|
|
1250
1148
|
<${optionTag} .choiceValue=${20}>Item 2</${optionTag}>
|
|
1251
1149
|
<${optionTag} .choiceValue=${30}>Item 3</${optionTag}>
|
|
1252
1150
|
</${tag}>
|
|
1253
|
-
`)
|
|
1254
|
-
);
|
|
1255
|
-
|
|
1151
|
+
`);
|
|
1256
1152
|
const { _listboxNode } = getListboxMembers(el);
|
|
1257
1153
|
const options = el.formElements;
|
|
1258
1154
|
// Normalize start values between listbox, slect and combobox and test interaction below
|
|
@@ -1262,12 +1158,10 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1262
1158
|
expect(el.checkedIndex).to.equal(0);
|
|
1263
1159
|
expectOnlyGivenOneOptionToBeChecked(options, 0);
|
|
1264
1160
|
mimicKeyPress(_listboxNode, 'ArrowRight');
|
|
1265
|
-
|
|
1266
1161
|
expect(el.activeIndex).to.equal(1);
|
|
1267
1162
|
expect(el.checkedIndex).to.equal(1);
|
|
1268
1163
|
expectOnlyGivenOneOptionToBeChecked(options, 1);
|
|
1269
1164
|
mimicKeyPress(_listboxNode, 'ArrowLeft');
|
|
1270
|
-
|
|
1271
1165
|
expect(el.activeIndex).to.equal(0);
|
|
1272
1166
|
expect(el.checkedIndex).to.equal(0);
|
|
1273
1167
|
expectOnlyGivenOneOptionToBeChecked(options, 0);
|
|
@@ -1287,7 +1181,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1287
1181
|
if (el._listboxReceivesNoFocus) {
|
|
1288
1182
|
return;
|
|
1289
1183
|
}
|
|
1290
|
-
|
|
1291
1184
|
expect(el.modelValue).to.equal('30');
|
|
1292
1185
|
mimicKeyPress(_listboxNode, 'Home');
|
|
1293
1186
|
expect(el.modelValue).to.equal('10');
|
|
@@ -1295,7 +1188,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1295
1188
|
expect(el.modelValue).to.equal('40');
|
|
1296
1189
|
});
|
|
1297
1190
|
});
|
|
1298
|
-
|
|
1299
1191
|
describe('Disabled Host', () => {
|
|
1300
1192
|
it('cannot be navigated with keyboard if disabled', async () => {
|
|
1301
1193
|
const el = await fixture(html`
|
|
@@ -1305,13 +1197,11 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1305
1197
|
</${tag}>
|
|
1306
1198
|
`);
|
|
1307
1199
|
const { _listboxNode } = getListboxMembers(el);
|
|
1308
|
-
|
|
1309
1200
|
await el.updateComplete;
|
|
1310
1201
|
const { checkedIndex } = el;
|
|
1311
1202
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
1312
1203
|
expect(el.checkedIndex).to.equal(checkedIndex);
|
|
1313
1204
|
});
|
|
1314
|
-
|
|
1315
1205
|
it('sync its disabled state to all options', async () => {
|
|
1316
1206
|
const el = await fixture(html`
|
|
1317
1207
|
<${tag} opened>
|
|
@@ -1324,13 +1214,11 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1324
1214
|
await el.updateComplete;
|
|
1325
1215
|
expect(options[0].disabled).to.be.true;
|
|
1326
1216
|
expect(options[1].disabled).to.be.true;
|
|
1327
|
-
|
|
1328
1217
|
el.disabled = false;
|
|
1329
1218
|
await el.updateComplete;
|
|
1330
1219
|
expect(options[0].disabled).to.be.true;
|
|
1331
1220
|
expect(options[1].disabled).to.be.false;
|
|
1332
1221
|
});
|
|
1333
|
-
|
|
1334
1222
|
it('can be enabled (incl. its options) even if it starts as disabled', async () => {
|
|
1335
1223
|
const el = await fixture(html`
|
|
1336
1224
|
<${tag} disabled>
|
|
@@ -1341,14 +1229,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1341
1229
|
const options = el.formElements;
|
|
1342
1230
|
expect(options[0].disabled).to.be.true;
|
|
1343
1231
|
expect(options[1].disabled).to.be.true;
|
|
1344
|
-
|
|
1345
1232
|
el.disabled = false;
|
|
1346
1233
|
await el.updateComplete;
|
|
1347
1234
|
expect(options[0].disabled).to.be.true;
|
|
1348
1235
|
expect(options[1].disabled).to.be.false;
|
|
1349
1236
|
});
|
|
1350
1237
|
});
|
|
1351
|
-
|
|
1352
1238
|
describe('Disabled Options', () => {
|
|
1353
1239
|
it('does not skip disabled options but prevents checking them', async () => {
|
|
1354
1240
|
const el = await fixture(html`
|
|
@@ -1358,15 +1244,12 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1358
1244
|
<${optionTag} .choiceValue=${'Item 3'}>Item 3</${optionTag}>
|
|
1359
1245
|
</${tag}>
|
|
1360
1246
|
`);
|
|
1361
|
-
|
|
1362
1247
|
const { _listboxNode } = getListboxMembers(el);
|
|
1363
1248
|
|
|
1364
1249
|
// Normalize activeIndex across multiple implementers of ListboxMixinSuite
|
|
1365
1250
|
el.activeIndex = 0;
|
|
1366
|
-
|
|
1367
1251
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
1368
1252
|
expect(el.activeIndex).to.equal(1);
|
|
1369
|
-
|
|
1370
1253
|
expect(el.checkedIndex).to.equal(0);
|
|
1371
1254
|
mimicKeyPress(_listboxNode, 'Enter');
|
|
1372
1255
|
// Checked index stays where it was
|
|
@@ -1380,22 +1263,18 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1380
1263
|
<${optionTag} .choiceValue=${'Item 3'}>Item 3</${optionTag}>
|
|
1381
1264
|
</${tag}>
|
|
1382
1265
|
`);
|
|
1383
|
-
|
|
1384
1266
|
const { _listboxNode } = getListboxMembers(el);
|
|
1385
1267
|
|
|
1386
1268
|
// Normalize activeIndex across multiple implementers of ListboxMixinSuite
|
|
1387
1269
|
el.activeIndex = 0;
|
|
1388
|
-
|
|
1389
1270
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
1390
1271
|
expect(el.activeIndex).to.equal(1);
|
|
1391
1272
|
expect(el.checkedIndex).to.equal(-1);
|
|
1392
|
-
|
|
1393
1273
|
mimicKeyPress(_listboxNode, 'ArrowDown');
|
|
1394
1274
|
expect(el.activeIndex).to.equal(2);
|
|
1395
1275
|
expect(el.checkedIndex).to.equal(2);
|
|
1396
1276
|
});
|
|
1397
1277
|
});
|
|
1398
|
-
|
|
1399
1278
|
describe('Programmatic interaction', () => {
|
|
1400
1279
|
it('can set active state', async () => {
|
|
1401
1280
|
const el = await fixture(html`
|
|
@@ -1405,12 +1284,10 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1405
1284
|
</${tag}>
|
|
1406
1285
|
`);
|
|
1407
1286
|
const { _activeDescendantOwnerNode } = getListboxMembers(el);
|
|
1408
|
-
|
|
1409
1287
|
const opt = el.formElements[1];
|
|
1410
1288
|
opt.active = true;
|
|
1411
1289
|
expect(_activeDescendantOwnerNode.getAttribute('aria-activedescendant')).to.equal('myId');
|
|
1412
1290
|
});
|
|
1413
|
-
|
|
1414
1291
|
it('can set checked state', async () => {
|
|
1415
1292
|
const el = await fixture(html`
|
|
1416
1293
|
<${tag}>
|
|
@@ -1422,7 +1299,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1422
1299
|
option.checked = true;
|
|
1423
1300
|
expect(el.modelValue).to.equal(20);
|
|
1424
1301
|
});
|
|
1425
|
-
|
|
1426
1302
|
it('does not allow to set checkedIndex or activeIndex to be out of bound', async () => {
|
|
1427
1303
|
const el = await fixture(html`
|
|
1428
1304
|
<${tag} has-no-default-selected autocomplete="list">
|
|
@@ -1438,7 +1314,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1438
1314
|
expect(el.checkedIndex).to.equal(-1);
|
|
1439
1315
|
expect(el.activeIndex).to.equal(-1);
|
|
1440
1316
|
});
|
|
1441
|
-
|
|
1442
1317
|
it('unsets checked on other options when option becomes checked', async () => {
|
|
1443
1318
|
const el = await fixture(html`
|
|
1444
1319
|
<${tag}>
|
|
@@ -1454,7 +1329,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1454
1329
|
expect(options[0].checked).to.be.false;
|
|
1455
1330
|
expect(options[1].checked).to.be.true;
|
|
1456
1331
|
});
|
|
1457
|
-
|
|
1458
1332
|
it('unsets active on other options when option becomes active', async () => {
|
|
1459
1333
|
const el = await fixture(html`
|
|
1460
1334
|
<${tag}>
|
|
@@ -1478,12 +1352,10 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1478
1352
|
<${optionTag} .choiceValue=${20}>Item 2</${optionTag}>
|
|
1479
1353
|
</${tag}>
|
|
1480
1354
|
`);
|
|
1481
|
-
|
|
1482
1355
|
expect(el.dirty).to.be.false;
|
|
1483
1356
|
el.modelValue = 20;
|
|
1484
1357
|
expect(el.dirty).to.be.true;
|
|
1485
1358
|
});
|
|
1486
|
-
|
|
1487
1359
|
it('is prefilled if there is a value on init', async () => {
|
|
1488
1360
|
const el = await fixture(html`
|
|
1489
1361
|
<${tag}>
|
|
@@ -1491,7 +1363,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1491
1363
|
</${tag}>
|
|
1492
1364
|
`);
|
|
1493
1365
|
expect(el.prefilled).to.be.true;
|
|
1494
|
-
|
|
1495
1366
|
const elEmpty = await fixture(html`
|
|
1496
1367
|
<${tag}>
|
|
1497
1368
|
<${optionTag} .choiceValue=${null}>Please select a value</${optionTag}>
|
|
@@ -1511,11 +1382,9 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1511
1382
|
<${optionTag} .choiceValue=${20}>Item 2</${optionTag}>
|
|
1512
1383
|
</${tag}>
|
|
1513
1384
|
`);
|
|
1514
|
-
|
|
1515
1385
|
expect(el.hasFeedbackFor).to.include('error');
|
|
1516
1386
|
expect(el.validationStates).to.have.a.property('error');
|
|
1517
1387
|
expect(el.validationStates.error).to.have.a.property('Required');
|
|
1518
|
-
|
|
1519
1388
|
el.modelValue = 20;
|
|
1520
1389
|
expect(el.hasFeedbackFor).not.to.include('error');
|
|
1521
1390
|
expect(el.validationStates).to.have.a.property('error');
|
|
@@ -1523,18 +1392,30 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1523
1392
|
});
|
|
1524
1393
|
});
|
|
1525
1394
|
});
|
|
1526
|
-
|
|
1527
1395
|
describe('Complex Data', () => {
|
|
1528
1396
|
it('works for complex array data', async () => {
|
|
1529
1397
|
const objs = [
|
|
1530
|
-
{
|
|
1531
|
-
|
|
1398
|
+
{
|
|
1399
|
+
type: 'mastercard',
|
|
1400
|
+
label: 'Master Card',
|
|
1401
|
+
amount: 12000,
|
|
1402
|
+
active: true,
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
type: 'visacard',
|
|
1406
|
+
label: 'Visa Card',
|
|
1407
|
+
amount: 0,
|
|
1408
|
+
active: false,
|
|
1409
|
+
},
|
|
1532
1410
|
];
|
|
1533
1411
|
const el = await fixture(html`
|
|
1534
1412
|
<${tag} label="Favorite color" name="color">
|
|
1535
1413
|
${objs.map(
|
|
1536
|
-
obj => html`
|
|
1537
|
-
<${optionTag} .modelValue=${{
|
|
1414
|
+
(obj) => html`
|
|
1415
|
+
<${optionTag} .modelValue=${{
|
|
1416
|
+
value: obj,
|
|
1417
|
+
checked: false,
|
|
1418
|
+
}}
|
|
1538
1419
|
>${obj.label}</${optionTag}
|
|
1539
1420
|
>
|
|
1540
1421
|
`,
|
|
@@ -1548,7 +1429,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1548
1429
|
amount: 12000,
|
|
1549
1430
|
active: true,
|
|
1550
1431
|
});
|
|
1551
|
-
|
|
1552
1432
|
el.setCheckedIndex(1);
|
|
1553
1433
|
expect(el.modelValue).to.deep.equal({
|
|
1554
1434
|
type: 'visacard',
|
|
@@ -1558,11 +1438,9 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1558
1438
|
});
|
|
1559
1439
|
});
|
|
1560
1440
|
});
|
|
1561
|
-
|
|
1562
1441
|
describe('Instantiation methods', () => {
|
|
1563
1442
|
it('can be instantiated via "document.createElement"', async () => {
|
|
1564
1443
|
let properlyInstantiated = false;
|
|
1565
|
-
|
|
1566
1444
|
try {
|
|
1567
1445
|
const el = document.createElement(cfg.tagString);
|
|
1568
1446
|
const optionsEl = document.createElement('lion-options');
|
|
@@ -1572,12 +1450,10 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1572
1450
|
el.appendChild(optionsEl);
|
|
1573
1451
|
properlyInstantiated = true;
|
|
1574
1452
|
} catch (e) {
|
|
1575
|
-
throw Error(/** @type {Error} */
|
|
1453
|
+
throw Error(/** @type {Error} */ e.message);
|
|
1576
1454
|
}
|
|
1577
|
-
|
|
1578
1455
|
expect(properlyInstantiated).to.be.true;
|
|
1579
1456
|
});
|
|
1580
|
-
|
|
1581
1457
|
it('can be instantiated without options', async () => {
|
|
1582
1458
|
const el = await fixture(html`
|
|
1583
1459
|
<${tag} name="foo">
|
|
@@ -1586,21 +1462,18 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1586
1462
|
</${tag}>
|
|
1587
1463
|
`);
|
|
1588
1464
|
const { _listboxNode } = getListboxMembers(el);
|
|
1589
|
-
|
|
1590
1465
|
expect(_listboxNode).to.exist;
|
|
1591
1466
|
expect(_listboxNode).to.be.instanceOf(LionOptions);
|
|
1592
1467
|
expect(el.querySelector('[role=listbox]')).to.equal(_listboxNode);
|
|
1593
|
-
|
|
1594
1468
|
expect(el.formElements.length).to.equal(2);
|
|
1595
1469
|
// When we use ScopedStylesController, lisboxNode can have style tag along with options
|
|
1596
1470
|
const childrenOtherThanStyle = Array.from(_listboxNode.children).filter(
|
|
1597
|
-
child => child.nodeName !== 'STYLE',
|
|
1471
|
+
(child) => child.nodeName !== 'STYLE',
|
|
1598
1472
|
);
|
|
1599
1473
|
expect(childrenOtherThanStyle.length).to.equal(2);
|
|
1600
1474
|
expect(childrenOtherThanStyle[0].tagName).to.equal(cfg.optionTagString.toUpperCase());
|
|
1601
1475
|
});
|
|
1602
1476
|
});
|
|
1603
|
-
|
|
1604
1477
|
describe('Href Options', () => {
|
|
1605
1478
|
it('allows anchors to be clicked when a [href] attribute is present', async () => {
|
|
1606
1479
|
const el = await fixture(html`
|
|
@@ -1609,19 +1482,15 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1609
1482
|
<${optionTag} .href=${'https://duckduckgo.com'}>DuckDuck Go</${optionTag}>
|
|
1610
1483
|
</${tag}>
|
|
1611
1484
|
`);
|
|
1612
|
-
|
|
1613
1485
|
const { _listboxNode } = getListboxMembers(el);
|
|
1614
|
-
|
|
1615
1486
|
el.activeIndex = 1;
|
|
1616
1487
|
|
|
1617
1488
|
// Allow options that behave like anchors (think of Google Search) to trigger the anchor behavior
|
|
1618
1489
|
const activeOption = el.formElements[1];
|
|
1619
1490
|
const clickSpy = sinon.spy(activeOption, 'click');
|
|
1620
1491
|
mimicKeyPress(_listboxNode, 'Enter');
|
|
1621
|
-
|
|
1622
1492
|
expect(clickSpy).to.have.been.calledOnce;
|
|
1623
1493
|
});
|
|
1624
|
-
|
|
1625
1494
|
it('does not allow anchors to be clicked when a [href] attribute is not present', async () => {
|
|
1626
1495
|
const el = await fixture(html`
|
|
1627
1496
|
<${tag}>
|
|
@@ -1629,20 +1498,14 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1629
1498
|
<${optionTag} .href=${'https://duckduckgo.com'}>DuckDuck Go</${optionTag}>
|
|
1630
1499
|
</${tag}>
|
|
1631
1500
|
`);
|
|
1632
|
-
|
|
1633
1501
|
const { _listboxNode } = getListboxMembers(el);
|
|
1634
|
-
|
|
1635
1502
|
el.activeIndex = 0;
|
|
1636
|
-
|
|
1637
1503
|
const activeOption = el.formElements[0];
|
|
1638
1504
|
const clickSpy = sinon.spy(activeOption, 'click');
|
|
1639
|
-
|
|
1640
1505
|
mimicKeyPress(_listboxNode, 'Enter');
|
|
1641
|
-
|
|
1642
1506
|
expect(clickSpy).to.not.have.been.called;
|
|
1643
1507
|
});
|
|
1644
1508
|
});
|
|
1645
|
-
|
|
1646
1509
|
describe('Dynamically adding options', () => {
|
|
1647
1510
|
class MyEl extends LitElement {
|
|
1648
1511
|
constructor() {
|
|
@@ -1650,39 +1513,31 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1650
1513
|
/** @type {string[]} */
|
|
1651
1514
|
this.options = ['option 1', 'option 2'];
|
|
1652
1515
|
}
|
|
1653
|
-
|
|
1654
1516
|
clearOptions() {
|
|
1655
1517
|
/** @type {string[]} */
|
|
1656
1518
|
this.options = [];
|
|
1657
1519
|
this.requestUpdate();
|
|
1658
1520
|
}
|
|
1659
|
-
|
|
1660
1521
|
addOption() {
|
|
1661
1522
|
this.options.push(`option ${this.options.length + 1}`);
|
|
1662
1523
|
this.requestUpdate();
|
|
1663
1524
|
}
|
|
1664
|
-
|
|
1665
1525
|
get withMap() {
|
|
1666
|
-
return /** @type {LionListbox} */
|
|
1526
|
+
return /** @type {LionListbox} */ this.shadowRoot?.querySelector('#withMap');
|
|
1667
1527
|
}
|
|
1668
|
-
|
|
1669
1528
|
get withRepeat() {
|
|
1670
|
-
return /** @type {LionListbox} */
|
|
1529
|
+
return /** @type {LionListbox} */ this.shadowRoot?.querySelector('#withRepeat');
|
|
1671
1530
|
}
|
|
1672
|
-
|
|
1673
1531
|
get registrationComplete() {
|
|
1674
1532
|
return Promise.all([
|
|
1675
1533
|
this.withMap.registrationComplete,
|
|
1676
1534
|
this.withRepeat.registrationComplete,
|
|
1677
1535
|
]);
|
|
1678
1536
|
}
|
|
1679
|
-
|
|
1680
1537
|
render() {
|
|
1681
1538
|
return html`
|
|
1682
1539
|
<${tag} id="withMap">
|
|
1683
|
-
${this.options.map(
|
|
1684
|
-
option => html` <lion-option .choiceValue="${option}">${option}</lion-option> `,
|
|
1685
|
-
)}
|
|
1540
|
+
${this.options.map((option) => html` <lion-option .choiceValue="${option}">${option}</lion-option> `)}
|
|
1686
1541
|
</${tag}>
|
|
1687
1542
|
<${tag} id="withRepeat">
|
|
1688
1543
|
${repeat(
|
|
@@ -1698,24 +1553,20 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1698
1553
|
}
|
|
1699
1554
|
const tagName = defineCE(MyEl);
|
|
1700
1555
|
const wrappingTag = unsafeStatic(tagName);
|
|
1701
|
-
|
|
1702
1556
|
it('works with array map and repeat directive', async () => {
|
|
1703
1557
|
const choiceVals = (/** @type {LionListbox} */ elm) =>
|
|
1704
|
-
elm.formElements.map(fel => fel.choiceValue);
|
|
1558
|
+
elm.formElements.map((fel) => fel.choiceValue);
|
|
1705
1559
|
const insideListboxNode = (/** @type {LionListbox} */ elm) =>
|
|
1706
1560
|
// @ts-ignore [allow-protected] in test
|
|
1707
|
-
elm.formElements.filter(fel => elm._listboxNode.contains(fel)).length ===
|
|
1561
|
+
elm.formElements.filter((fel) => elm._listboxNode.contains(fel)).length ===
|
|
1708
1562
|
elm.formElements.length;
|
|
1709
|
-
|
|
1710
|
-
const el = /** @type {MyEl} */ (await _fixture(html`<${wrappingTag}></${wrappingTag}>`));
|
|
1711
|
-
|
|
1563
|
+
const el = /** @type {MyEl} */ await _fixture(html`<${wrappingTag}></${wrappingTag}>`);
|
|
1712
1564
|
expect(choiceVals(el.withMap)).to.eql(el.options);
|
|
1713
1565
|
expect(el.withMap.formElements.length).to.equal(2);
|
|
1714
1566
|
expect(insideListboxNode(el.withMap)).to.be.true;
|
|
1715
1567
|
expect(choiceVals(el.withRepeat)).to.eql(el.options);
|
|
1716
1568
|
expect(el.withRepeat.formElements.length).to.equal(2);
|
|
1717
1569
|
expect(insideListboxNode(el.withRepeat)).to.be.true;
|
|
1718
|
-
|
|
1719
1570
|
el.addOption();
|
|
1720
1571
|
await el.updateComplete;
|
|
1721
1572
|
expect(choiceVals(el.withMap)).to.eql(el.options);
|
|
@@ -1724,7 +1575,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1724
1575
|
expect(choiceVals(el.withRepeat)).to.eql(el.options);
|
|
1725
1576
|
expect(el.withRepeat.formElements.length).to.equal(3);
|
|
1726
1577
|
expect(insideListboxNode(el.withRepeat)).to.be.true;
|
|
1727
|
-
|
|
1728
1578
|
el.clearOptions();
|
|
1729
1579
|
await el.updateComplete;
|
|
1730
1580
|
expect(choiceVals(el.withMap)).to.eql(el.options);
|
|
@@ -1735,7 +1585,6 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1735
1585
|
expect(insideListboxNode(el.withRepeat)).to.be.true;
|
|
1736
1586
|
});
|
|
1737
1587
|
});
|
|
1738
|
-
|
|
1739
1588
|
describe('Subclassers', () => {
|
|
1740
1589
|
class MyEl extends LitElement {
|
|
1741
1590
|
constructor() {
|
|
@@ -1743,37 +1592,30 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1743
1592
|
/** @type {string[]} */
|
|
1744
1593
|
this.options = ['option 1', 'option 2'];
|
|
1745
1594
|
}
|
|
1746
|
-
|
|
1747
1595
|
clearOptions() {
|
|
1748
1596
|
/** @type {string[]} */
|
|
1749
1597
|
this.options = [];
|
|
1750
1598
|
this.requestUpdate();
|
|
1751
1599
|
}
|
|
1752
|
-
|
|
1753
1600
|
addOption() {
|
|
1754
1601
|
this.options.push(`option ${this.options.length + 1}`);
|
|
1755
1602
|
this.requestUpdate();
|
|
1756
1603
|
}
|
|
1757
|
-
|
|
1758
1604
|
get listbox() {
|
|
1759
|
-
return /** @type {LionListbox} */
|
|
1605
|
+
return /** @type {LionListbox} */ this.shadowRoot?.querySelector('#listbox');
|
|
1760
1606
|
}
|
|
1761
|
-
|
|
1762
1607
|
render() {
|
|
1763
1608
|
return html`
|
|
1764
1609
|
<${tag} id="listbox">
|
|
1765
|
-
${this.options.map(
|
|
1766
|
-
option => html` <lion-option .choiceValue="${option}">${option}</lion-option> `,
|
|
1767
|
-
)}
|
|
1610
|
+
${this.options.map((option) => html` <lion-option .choiceValue="${option}">${option}</lion-option> `)}
|
|
1768
1611
|
</${tag}>
|
|
1769
1612
|
`;
|
|
1770
1613
|
}
|
|
1771
1614
|
}
|
|
1772
1615
|
const tagName = defineCE(MyEl);
|
|
1773
1616
|
const wrappingTag = unsafeStatic(tagName);
|
|
1774
|
-
|
|
1775
1617
|
it('calls "_onListboxContentChanged" after externally changing options', async () => {
|
|
1776
|
-
const el = /** @type {MyEl} */
|
|
1618
|
+
const el = /** @type {MyEl} */ await _fixture(html`<${wrappingTag}></${wrappingTag}>`);
|
|
1777
1619
|
await el.listbox.registrationComplete;
|
|
1778
1620
|
// @ts-ignore [allow-protected] in test
|
|
1779
1621
|
const spy = sinon.spy(el.listbox, '_onListboxContentChanged');
|
|
@@ -1784,18 +1626,16 @@ export function runListboxMixinSuite(customConfig = {}) {
|
|
|
1784
1626
|
await el.updateComplete;
|
|
1785
1627
|
expect(spy).to.have.been.calledTwice;
|
|
1786
1628
|
});
|
|
1787
|
-
|
|
1788
1629
|
it('does not calls "_onListboxContentChanged" during connect and disconnected', async () => {
|
|
1789
|
-
const renderEl = /** @param {import('lit/directives/ref.js').Ref<any>} refObj */ refObj =>
|
|
1630
|
+
const renderEl = /** @param {import('lit/directives/ref.js').Ref<any>} refObj */ (refObj) =>
|
|
1790
1631
|
html`<${wrappingTag} ${ref(refObj)}></${wrappingTag}>`;
|
|
1791
1632
|
const { el, show, hide } = await getCachedFixture(renderEl);
|
|
1792
|
-
const typedEl = /** @type {MyEl} */
|
|
1633
|
+
const typedEl = /** @type {MyEl} */ el;
|
|
1793
1634
|
await typedEl?.listbox.registrationComplete;
|
|
1794
1635
|
// @ts-ignore [allow-protected] in test
|
|
1795
1636
|
const spy = sinon.spy(typedEl.listbox, '_onListboxContentChanged');
|
|
1796
1637
|
await hide();
|
|
1797
1638
|
await show();
|
|
1798
|
-
|
|
1799
1639
|
expect(spy).not.to.have.been.called;
|
|
1800
1640
|
});
|
|
1801
1641
|
});
|