@lion/ui 0.23.0 → 0.24.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 +40 -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 +7 -6
- 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 +4 -1
- 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 +166 -151
- package/components/overlays/src/OverlayMixin.js +61 -63
- 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 +375 -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/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 +20 -43
- 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 +191 -56
- 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/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/OverlaysManager.d.ts.map +1 -1
- package/dist-types/components/overlays/src/overlayDocumentStyle.d.ts.map +1 -1
- 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 +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/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/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/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/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 +32 -10
- 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
|
@@ -4,7 +4,6 @@ import { parseDate } from '@lion/ui/localize-no-side-effects.js';
|
|
|
4
4
|
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
|
5
5
|
import { LitElement } from 'lit';
|
|
6
6
|
import sinon from 'sinon';
|
|
7
|
-
|
|
8
7
|
const isLionInputStepper = (/** @type {FormatClass} */ el) => 'valueTextMapping' in el;
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -14,19 +13,16 @@ const isLionInputStepper = (/** @type {FormatClass} */ el) => 'valueTextMapping'
|
|
|
14
13
|
|
|
15
14
|
class FormatClass extends FormatMixin(LitElement) {
|
|
16
15
|
get _inputNode() {
|
|
17
|
-
return /** @type {HTMLInputElement} */
|
|
16
|
+
return /** @type {HTMLInputElement} */ super._inputNode; // casts type
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
render() {
|
|
21
19
|
return html`<slot name="input"></slot>`;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
set value(newValue) {
|
|
25
22
|
if (this._inputNode) {
|
|
26
23
|
this._inputNode.value = newValue;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
get value() {
|
|
31
27
|
if (this._inputNode) {
|
|
32
28
|
return this._inputNode.value;
|
|
@@ -85,7 +81,13 @@ function createDefaultValueToggler(modelValueType) {
|
|
|
85
81
|
if (viewValue) {
|
|
86
82
|
return !toggleValue ? '{"value": 1}' : '{"value": 2}';
|
|
87
83
|
}
|
|
88
|
-
return !toggleValue
|
|
84
|
+
return !toggleValue
|
|
85
|
+
? {
|
|
86
|
+
value: 1,
|
|
87
|
+
}
|
|
88
|
+
: {
|
|
89
|
+
value: 2,
|
|
90
|
+
};
|
|
89
91
|
};
|
|
90
92
|
}
|
|
91
93
|
if (modelValueType === Boolean) {
|
|
@@ -250,46 +252,41 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
250
252
|
}
|
|
251
253
|
expect(actual).to.equal(expected, message);
|
|
252
254
|
}
|
|
253
|
-
|
|
254
255
|
describe('FormatMixin', async () => {
|
|
255
256
|
/** @type {{_$litStatic$: any}} */
|
|
256
257
|
let tag;
|
|
257
258
|
/** @type {FormatClass} */
|
|
258
259
|
let fooFormat;
|
|
259
|
-
|
|
260
260
|
before(async () => {
|
|
261
261
|
if (!cfg.tagString) {
|
|
262
262
|
cfg.tagString = defineCE(FormatClass);
|
|
263
263
|
}
|
|
264
264
|
tag = unsafeStatic(cfg.tagString);
|
|
265
|
-
|
|
266
265
|
fooFormat = await fixture(html`
|
|
267
266
|
<${tag}
|
|
268
|
-
.formatter="${/** @param {string} value */ value => `foo: ${value}`}"
|
|
267
|
+
.formatter="${/** @param {string} value */ (value) => `foo: ${value}`}"
|
|
269
268
|
.parser="${parser}"
|
|
270
|
-
.serializer="${/** @param {string} value */ value => `[foo] ${value}`}"
|
|
271
|
-
.deserializer="${/** @param {string} value */ value => value.replace('[foo] ', '')}"
|
|
269
|
+
.serializer="${/** @param {string} value */ (value) => `[foo] ${value}`}"
|
|
270
|
+
.deserializer="${/** @param {string} value */ (value) => value.replace('[foo] ', '')}"
|
|
272
271
|
>
|
|
273
272
|
<input slot="input">
|
|
274
273
|
</${tag}>
|
|
275
274
|
`);
|
|
276
275
|
});
|
|
277
|
-
|
|
278
276
|
it('has modelValue, formattedValue and serializedValue which are computed synchronously', async () => {
|
|
279
|
-
const nonFormat =
|
|
277
|
+
const nonFormat =
|
|
278
|
+
/** @type {FormatClass} */
|
|
280
279
|
await fixture(html`
|
|
281
280
|
<${tag}
|
|
282
|
-
.formatter="${/** @param {any} v */ v => v}"
|
|
283
|
-
.parser="${/** @param {string} v */ v => v}"
|
|
284
|
-
.serializer="${/** @param {any} v */ v => v}"
|
|
285
|
-
.deserializer="${/** @param {string} v */ v => v}"
|
|
281
|
+
.formatter="${/** @param {any} v */ (v) => v}"
|
|
282
|
+
.parser="${/** @param {string} v */ (v) => v}"
|
|
283
|
+
.serializer="${/** @param {any} v */ (v) => v}"
|
|
284
|
+
.deserializer="${/** @param {string} v */ (v) => v}"
|
|
286
285
|
>
|
|
287
286
|
<input slot="input">
|
|
288
287
|
</${tag}>
|
|
289
|
-
`)
|
|
290
|
-
);
|
|
288
|
+
`);
|
|
291
289
|
await nonFormat.updateComplete;
|
|
292
|
-
|
|
293
290
|
expectValue(
|
|
294
291
|
nonFormat.modelValue,
|
|
295
292
|
generateExpectedInitialModelValue(nonFormat),
|
|
@@ -305,7 +302,6 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
305
302
|
generateExpectedInitialSerializedValue(nonFormat),
|
|
306
303
|
'serializedValue initially',
|
|
307
304
|
);
|
|
308
|
-
|
|
309
305
|
const generatedValue = generateValueBasedOnType();
|
|
310
306
|
nonFormat.modelValue = generatedValue;
|
|
311
307
|
expectValue(nonFormat.modelValue, generatedValue, 'modelValue as provided');
|
|
@@ -319,20 +315,19 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
319
315
|
*/
|
|
320
316
|
describe('ModelValue', () => {
|
|
321
317
|
it('fires `model-value-changed` for every programmatic modelValue change', async () => {
|
|
322
|
-
const el =
|
|
323
|
-
|
|
324
|
-
|
|
318
|
+
const el =
|
|
319
|
+
/** @type {FormatClass} */
|
|
320
|
+
await fixture(html`<${tag}><input slot="input"></${tag}>`);
|
|
325
321
|
let counter = 0;
|
|
326
322
|
let isTriggeredByUser = false;
|
|
327
|
-
|
|
328
|
-
el.addEventListener('model-value-changed', event => {
|
|
323
|
+
el.addEventListener('model-value-changed', (event) => {
|
|
329
324
|
counter += 1;
|
|
330
|
-
isTriggeredByUser = /** @type {CustomEvent} */
|
|
325
|
+
isTriggeredByUser = /** @type {CustomEvent} */ event.detail.isTriggeredByUser;
|
|
331
326
|
});
|
|
332
|
-
|
|
333
327
|
const valueOne = generateValueBasedOnType();
|
|
334
|
-
const valueTwo = generateValueBasedOnType({
|
|
335
|
-
|
|
328
|
+
const valueTwo = generateValueBasedOnType({
|
|
329
|
+
toggleValue: true,
|
|
330
|
+
});
|
|
336
331
|
el.modelValue = valueOne;
|
|
337
332
|
expect(counter).to.equal(1);
|
|
338
333
|
expect(isTriggeredByUser).to.be.false;
|
|
@@ -340,124 +335,119 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
340
335
|
// no change means no event
|
|
341
336
|
el.modelValue = valueOne;
|
|
342
337
|
expect(counter).to.equal(1);
|
|
343
|
-
|
|
344
338
|
el.modelValue = valueTwo;
|
|
345
339
|
expect(counter).to.equal(2);
|
|
346
340
|
});
|
|
347
|
-
|
|
348
341
|
it('fires `model-value-changed` for every user input, adding `isTriggeredByUser` in event detail', async () => {
|
|
349
|
-
const formatEl =
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
342
|
+
const formatEl =
|
|
343
|
+
/** @type {FormatClass} */
|
|
344
|
+
await fixture(html`<${tag}><input slot="input"></${tag}>`);
|
|
353
345
|
let counter = 0;
|
|
354
346
|
let isTriggeredByUser = false;
|
|
355
347
|
formatEl.addEventListener(
|
|
356
348
|
'model-value-changed',
|
|
357
349
|
(/** @param {CustomEvent} event */ event) => {
|
|
358
350
|
counter += 1;
|
|
359
|
-
isTriggeredByUser = /** @type {CustomEvent} */
|
|
351
|
+
isTriggeredByUser = /** @type {CustomEvent} */ event.detail.isTriggeredByUser;
|
|
360
352
|
},
|
|
361
353
|
);
|
|
362
|
-
|
|
363
|
-
|
|
354
|
+
mimicUserInput(
|
|
355
|
+
formatEl,
|
|
356
|
+
generateValueBasedOnType({
|
|
357
|
+
viewValue: true,
|
|
358
|
+
}),
|
|
359
|
+
);
|
|
364
360
|
expect(counter).to.equal(1);
|
|
365
361
|
expect(isTriggeredByUser).to.be.true;
|
|
366
362
|
|
|
367
363
|
// All value comparison logic is the responsibility of consuming components
|
|
368
364
|
const counterOffset = valueChangeCounterOffset;
|
|
369
|
-
|
|
370
|
-
|
|
365
|
+
mimicUserInput(
|
|
366
|
+
formatEl,
|
|
367
|
+
generateValueBasedOnType({
|
|
368
|
+
viewValue: true,
|
|
369
|
+
}),
|
|
370
|
+
);
|
|
371
371
|
expect(counter).to.equal(1 + counterOffset);
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
mimicUserInput(
|
|
373
|
+
formatEl,
|
|
374
|
+
generateValueBasedOnType({
|
|
375
|
+
toggleValue: true,
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
374
378
|
expect(counter).to.equal(2 + counterOffset);
|
|
375
379
|
});
|
|
376
|
-
|
|
377
380
|
it('synchronizes _inputNode.value as a fallback mechanism on init (when no modelValue provided)', async () => {
|
|
378
381
|
// Note that in lion-field, the attribute would be put on <lion-field>, not on <input>
|
|
379
|
-
const formatElem =
|
|
382
|
+
const formatElem =
|
|
383
|
+
/** @type {FormatClass} */
|
|
380
384
|
await fixture(html`
|
|
381
385
|
<${tag}
|
|
382
386
|
value="string"
|
|
383
|
-
.formatter=${/** @param {string} value */ value => `foo: ${value}`}
|
|
387
|
+
.formatter=${/** @param {string} value */ (value) => `foo: ${value}`}
|
|
384
388
|
.parser=${parser}
|
|
385
|
-
.serializer=${/** @param {string} value */ value => `[foo] ${value}`}
|
|
386
|
-
.deserializer=${/** @param {string} value */ value => value.replace('[foo] ', '')}
|
|
389
|
+
.serializer=${/** @param {string} value */ (value) => `[foo] ${value}`}
|
|
390
|
+
.deserializer=${/** @param {string} value */ (value) => value.replace('[foo] ', '')}
|
|
387
391
|
>
|
|
388
392
|
<input slot="input" value="string" />
|
|
389
393
|
</${tag}>
|
|
390
|
-
`)
|
|
391
|
-
);
|
|
394
|
+
`);
|
|
392
395
|
// Now check if the format/parse/serialize loop has been triggered
|
|
393
396
|
await formatElem.updateComplete;
|
|
394
397
|
const expectedFormattedValue = `foo: ${formatElem.modelValue}`;
|
|
395
398
|
const expectedSerializedValue = `[foo] ${formatElem.modelValue}`;
|
|
396
|
-
|
|
397
399
|
expect(formatElem.formattedValue).to.equal(expectedFormattedValue);
|
|
398
|
-
|
|
399
400
|
expect(formatElem._inputNode.value).to.equal(expectedFormattedValue);
|
|
400
|
-
|
|
401
401
|
expect(formatElem.serializedValue).to.equal(expectedSerializedValue);
|
|
402
402
|
});
|
|
403
|
-
|
|
404
403
|
describe('Unparseable values', () => {
|
|
405
404
|
it('converts to Unparseable when wrong value inputted by user', async () => {
|
|
406
|
-
const el =
|
|
405
|
+
const el =
|
|
406
|
+
/** @type {FormatClass} */
|
|
407
407
|
await fixture(html`
|
|
408
|
-
<${tag} .parser=${
|
|
409
|
-
/** @param {string} viewValue */ viewValue => Number(viewValue) || undefined
|
|
410
|
-
}
|
|
408
|
+
<${tag} .parser=${/** @param {string} viewValue */ (viewValue) => Number(viewValue) || undefined}
|
|
411
409
|
>
|
|
412
410
|
<input slot="input">
|
|
413
411
|
</${tag}>
|
|
414
|
-
`)
|
|
415
|
-
);
|
|
412
|
+
`);
|
|
416
413
|
mimicUserInput(el, 'test');
|
|
417
414
|
expect(el.modelValue).to.be.an.instanceof(Unparseable);
|
|
418
415
|
});
|
|
419
|
-
|
|
420
416
|
it('preserves the viewValue when unparseable', async () => {
|
|
421
|
-
const el =
|
|
417
|
+
const el =
|
|
418
|
+
/** @type {FormatClass} */
|
|
422
419
|
await fixture(html`
|
|
423
420
|
<${tag}
|
|
424
|
-
.parser=${
|
|
425
|
-
/** @param {string} viewValue */ viewValue => Number(viewValue) || undefined
|
|
426
|
-
}
|
|
421
|
+
.parser=${/** @param {string} viewValue */ (viewValue) => Number(viewValue) || undefined}
|
|
427
422
|
>
|
|
428
423
|
<input slot="input">
|
|
429
424
|
</${tag}>
|
|
430
|
-
`)
|
|
431
|
-
);
|
|
425
|
+
`);
|
|
432
426
|
mimicUserInput(el, 'test');
|
|
433
427
|
expect(el.formattedValue).to.equal('test');
|
|
434
428
|
expect(el.value).to.equal('test');
|
|
435
429
|
});
|
|
436
|
-
|
|
437
430
|
it('displays the viewValue when modelValue is of type Unparseable', async () => {
|
|
438
|
-
const el =
|
|
431
|
+
const el =
|
|
432
|
+
/** @type {FormatClass} */
|
|
439
433
|
await fixture(html`
|
|
440
434
|
<${tag}
|
|
441
|
-
.parser=${
|
|
442
|
-
/** @param {string} viewValue */ viewValue => Number(viewValue) || undefined
|
|
443
|
-
}
|
|
435
|
+
.parser=${/** @param {string} viewValue */ (viewValue) => Number(viewValue) || undefined}
|
|
444
436
|
>
|
|
445
437
|
<input slot="input">
|
|
446
438
|
</${tag}>
|
|
447
|
-
`)
|
|
448
|
-
);
|
|
439
|
+
`);
|
|
449
440
|
el.modelValue = new Unparseable('foo');
|
|
450
441
|
expect(el.value).to.equal('foo');
|
|
451
442
|
});
|
|
452
|
-
|
|
453
443
|
it('empty strings are not Unparseable', async () => {
|
|
454
|
-
const el =
|
|
444
|
+
const el =
|
|
445
|
+
/** @type {FormatClass} */
|
|
455
446
|
await fixture(html`
|
|
456
447
|
<${tag}>
|
|
457
448
|
<input slot="input" value="string">
|
|
458
449
|
</${tag}>
|
|
459
|
-
`)
|
|
460
|
-
);
|
|
450
|
+
`);
|
|
461
451
|
// This could happen when the user erases the input value
|
|
462
452
|
mimicUserInput(el, '');
|
|
463
453
|
expectValue(
|
|
@@ -468,7 +458,6 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
468
458
|
});
|
|
469
459
|
});
|
|
470
460
|
});
|
|
471
|
-
|
|
472
461
|
describe('View value', () => {
|
|
473
462
|
it('has an input node (like <input>/<textarea>) which holds the formatted (view) value', async () => {
|
|
474
463
|
const { _inputNode } = getFormControlMembers(fooFormat);
|
|
@@ -477,46 +466,47 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
477
466
|
expect(fooFormat.value).to.equal('foo: string');
|
|
478
467
|
expect(_inputNode.value).to.equal('foo: string');
|
|
479
468
|
});
|
|
480
|
-
|
|
481
469
|
it('works if there is no underlying _inputNode', async () => {
|
|
482
470
|
const tagNoInputString = defineCE(class extends FormatMixin(LitElement) {});
|
|
483
471
|
const tagNoInput = unsafeStatic(tagNoInputString);
|
|
484
472
|
expect(async () => {
|
|
485
|
-
/** @type {FormatClass} */
|
|
473
|
+
/** @type {FormatClass} */ await fixture(html`<${tagNoInput}></${tagNoInput}>`);
|
|
486
474
|
}).to.not.throw();
|
|
487
475
|
});
|
|
488
|
-
|
|
489
476
|
describe('Presenting value to end user', () => {
|
|
490
477
|
it('reflects back formatted value to user on leave', async () => {
|
|
491
|
-
const formatEl =
|
|
478
|
+
const formatEl =
|
|
479
|
+
/** @type {FormatClass} */
|
|
492
480
|
await fixture(html`
|
|
493
|
-
<${tag} .formatter="${/** @param {string} value */ value => `foo: ${value}`}">
|
|
481
|
+
<${tag} .formatter="${/** @param {string} value */ (value) => `foo: ${value}`}">
|
|
494
482
|
<input slot="input" />
|
|
495
483
|
</${tag}>
|
|
496
|
-
`)
|
|
497
|
-
);
|
|
484
|
+
`);
|
|
498
485
|
const { _inputNode } = getFormControlMembers(formatEl);
|
|
499
|
-
|
|
500
|
-
|
|
486
|
+
const generatedViewValue = generateValueBasedOnType({
|
|
487
|
+
viewValue: true,
|
|
488
|
+
});
|
|
501
489
|
const generatedModelValue = generateValueBasedOnType();
|
|
502
490
|
mimicUserInput(formatEl, generatedViewValue);
|
|
503
491
|
expect(_inputNode.value).to.not.equal(`foo: ${generatedModelValue}`);
|
|
504
492
|
|
|
505
493
|
// user leaves field
|
|
506
|
-
_inputNode.dispatchEvent(
|
|
494
|
+
_inputNode.dispatchEvent(
|
|
495
|
+
new CustomEvent(formatEl.formatOn, {
|
|
496
|
+
bubbles: true,
|
|
497
|
+
}),
|
|
498
|
+
);
|
|
507
499
|
await aTimeout(0);
|
|
508
500
|
expect(_inputNode.value).to.equal(`foo: ${generatedModelValue}`);
|
|
509
501
|
});
|
|
510
|
-
|
|
511
502
|
it('reflects back .formattedValue immediately when .modelValue changed imperatively', async () => {
|
|
512
|
-
const el =
|
|
503
|
+
const el =
|
|
504
|
+
/** @type {FormatClass} */
|
|
513
505
|
await fixture(html`
|
|
514
|
-
<${tag} .formatter="${/** @param {string} value */ value => `foo: ${value}`}">
|
|
506
|
+
<${tag} .formatter="${/** @param {string} value */ (value) => `foo: ${value}`}">
|
|
515
507
|
<input slot="input" />
|
|
516
508
|
</${tag}>
|
|
517
|
-
`)
|
|
518
|
-
);
|
|
519
|
-
|
|
509
|
+
`);
|
|
520
510
|
const { _inputNode } = getFormControlMembers(el);
|
|
521
511
|
|
|
522
512
|
// The FormatMixin can be used in conjunction with the ValidateMixin, in which case
|
|
@@ -533,14 +523,14 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
533
523
|
});
|
|
534
524
|
});
|
|
535
525
|
});
|
|
536
|
-
|
|
537
526
|
describe('Parser / formatter / serializer / preprocessor', () => {
|
|
538
527
|
it('calls the parser|formatter|serializer|preprocessor provided by user', async () => {
|
|
539
|
-
const formatterSpy = sinon.spy(value => `foo: ${value}`);
|
|
540
|
-
const parserSpy = sinon.spy(value => value.replace('foo: ', ''));
|
|
541
|
-
const serializerSpy = sinon.spy(value => `[foo] ${value}`);
|
|
542
|
-
const preprocessorSpy = sinon.spy(value => value.replace('bar', ''));
|
|
543
|
-
const el =
|
|
528
|
+
const formatterSpy = sinon.spy((value) => `foo: ${value}`);
|
|
529
|
+
const parserSpy = sinon.spy((value) => value.replace('foo: ', ''));
|
|
530
|
+
const serializerSpy = sinon.spy((value) => `[foo] ${value}`);
|
|
531
|
+
const preprocessorSpy = sinon.spy((value) => value.replace('bar', ''));
|
|
532
|
+
const el =
|
|
533
|
+
/** @type {FormatClass} */
|
|
544
534
|
await fixture(html`
|
|
545
535
|
<${tag}
|
|
546
536
|
.formatter=${formatterSpy}
|
|
@@ -551,66 +541,57 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
551
541
|
>
|
|
552
542
|
<input slot="input">
|
|
553
543
|
</${tag}>
|
|
554
|
-
`)
|
|
555
|
-
);
|
|
544
|
+
`);
|
|
556
545
|
expect(formatterSpy.called).to.be.true;
|
|
557
546
|
expect(serializerSpy.called).to.be.true;
|
|
558
|
-
|
|
559
547
|
el.formattedValue = 'raw';
|
|
560
548
|
expect(parserSpy.called).to.be.true;
|
|
561
549
|
el.dispatchEvent(new CustomEvent('user-input-changed'));
|
|
562
550
|
expect(preprocessorSpy.called).to.be.true;
|
|
563
551
|
});
|
|
564
|
-
|
|
565
552
|
describe('Value conversions', () => {
|
|
566
553
|
it('converts modelValue => formattedValue (via this.formatter)', async () => {
|
|
567
554
|
fooFormat.modelValue = 'string';
|
|
568
555
|
expect(fooFormat.formattedValue).to.equal('foo: string');
|
|
569
556
|
expect(fooFormat.serializedValue).to.equal('[foo] string');
|
|
570
557
|
});
|
|
571
|
-
|
|
572
558
|
it('converts modelValue => serializedValue (via this.serializer)', async () => {
|
|
573
559
|
fooFormat.modelValue = 'string';
|
|
574
560
|
expect(fooFormat.serializedValue).to.equal('[foo] string');
|
|
575
561
|
});
|
|
576
|
-
|
|
577
562
|
it('converts formattedValue => modelValue (via this.parser)', async () => {
|
|
578
563
|
fooFormat.formattedValue = 'foo: string';
|
|
579
564
|
expect(fooFormat.modelValue).to.equal('string');
|
|
580
565
|
});
|
|
581
|
-
|
|
582
566
|
it('converts serializedValue => modelValue (via this.deserializer)', async () => {
|
|
583
567
|
fooFormat.serializedValue = '[foo] string';
|
|
584
568
|
expect(fooFormat.modelValue).to.equal('string');
|
|
585
569
|
});
|
|
586
570
|
});
|
|
587
|
-
|
|
588
571
|
describe('Formatter', () => {
|
|
589
572
|
it('only calls the formatter for valid values on `user-input-changed` ', async () => {
|
|
590
573
|
if (cfg.modelValueType === Object) {
|
|
591
574
|
return;
|
|
592
575
|
}
|
|
593
|
-
|
|
594
|
-
const formatterSpy = sinon.spy(value => `foo: ${value}`);
|
|
595
|
-
|
|
576
|
+
const formatterSpy = sinon.spy((value) => `foo: ${value}`);
|
|
596
577
|
const generatedModelValue = generateValueBasedOnType();
|
|
597
578
|
/** @type {any} */
|
|
598
|
-
const generatedViewValue = generateValueBasedOnType({
|
|
579
|
+
const generatedViewValue = generateValueBasedOnType({
|
|
580
|
+
viewValue: true,
|
|
581
|
+
});
|
|
599
582
|
/** @type {any} */
|
|
600
583
|
const generatedViewValueAlt = generateValueBasedOnType({
|
|
601
584
|
viewValue: true,
|
|
602
585
|
toggleValue: true,
|
|
603
586
|
});
|
|
604
|
-
|
|
605
|
-
|
|
587
|
+
const el =
|
|
588
|
+
/** @type {FormatClass} */
|
|
606
589
|
await fixture(html`
|
|
607
590
|
<${tag} .formatter=${formatterSpy}>
|
|
608
591
|
<input slot="input" .value="${generatedViewValue}">
|
|
609
592
|
</${tag}>
|
|
610
|
-
`)
|
|
611
|
-
);
|
|
593
|
+
`);
|
|
612
594
|
expect(formatterSpy.callCount).to.equal(1);
|
|
613
|
-
|
|
614
595
|
el.hasFeedbackFor.push('error');
|
|
615
596
|
// Ensure hasError is always true by putting a validator on it that always returns false.
|
|
616
597
|
// Setting hasError = true is not enough if the element has errorValidators (uses ValidateMixin)
|
|
@@ -620,37 +601,34 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
620
601
|
static get validatorName() {
|
|
621
602
|
return 'AlwaysInvalid';
|
|
622
603
|
}
|
|
623
|
-
|
|
624
604
|
execute() {
|
|
625
605
|
return true;
|
|
626
606
|
}
|
|
627
607
|
};
|
|
628
|
-
|
|
629
608
|
el.validators = [new AlwaysInvalid()];
|
|
630
609
|
mimicUserInput(el, generatedViewValueAlt);
|
|
631
|
-
|
|
632
610
|
expect(formatterSpy.callCount).to.equal(1);
|
|
633
611
|
// Due to hasError, the formatter should not have ran.
|
|
634
612
|
expect(el.formattedValue).to.equal(generatedViewValueAlt);
|
|
635
|
-
|
|
636
|
-
el.hasFeedbackFor.filter(/** @param {string} type */ type => type !== 'error');
|
|
613
|
+
el.hasFeedbackFor.filter(/** @param {string} type */ (type) => type !== 'error');
|
|
637
614
|
el.validators = [];
|
|
638
615
|
mimicUserInput(el, generatedViewValue);
|
|
639
616
|
expect(formatterSpy.callCount).to.equal(2);
|
|
640
|
-
|
|
641
617
|
expect(el.formattedValue).to.equal(`foo: ${generatedModelValue}`);
|
|
642
618
|
});
|
|
643
|
-
|
|
644
619
|
it('has formatOptions available in formatter', async () => {
|
|
645
|
-
const formatterSpy = sinon.spy(value => `foo: ${value}`);
|
|
646
|
-
const generatedViewValue =
|
|
620
|
+
const formatterSpy = sinon.spy((value) => `foo: ${value}`);
|
|
621
|
+
const generatedViewValue =
|
|
622
|
+
/** @type {string} */
|
|
647
623
|
generateValueBasedOnType({
|
|
648
624
|
viewValue: true,
|
|
649
|
-
})
|
|
650
|
-
);
|
|
625
|
+
});
|
|
651
626
|
await fixture(html`
|
|
652
627
|
<${tag} value="${generatedViewValue}" .formatter="${formatterSpy}"
|
|
653
|
-
.formatOptions="${{
|
|
628
|
+
.formatOptions="${{
|
|
629
|
+
locale: 'en-GB',
|
|
630
|
+
decimalSeparator: '-',
|
|
631
|
+
}}">
|
|
654
632
|
<input slot="input" .value="${generatedViewValue}">
|
|
655
633
|
</${tag}>
|
|
656
634
|
`);
|
|
@@ -661,7 +639,6 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
661
639
|
expect(spyArg.locale).to.equal('en-GB');
|
|
662
640
|
expect(spyArg.decimalSeparator).to.equal('-');
|
|
663
641
|
});
|
|
664
|
-
|
|
665
642
|
describe('On paste', () => {
|
|
666
643
|
class ReflectOnPaste extends FormatClass {
|
|
667
644
|
_reflectBackOn() {
|
|
@@ -677,36 +654,42 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
677
654
|
function mimicPaste(el, val = 'lorem') {
|
|
678
655
|
const { _inputNode } = getFormControlMembers(el);
|
|
679
656
|
_inputNode.value = val;
|
|
680
|
-
_inputNode.dispatchEvent(
|
|
681
|
-
|
|
657
|
+
_inputNode.dispatchEvent(
|
|
658
|
+
new ClipboardEvent('paste', {
|
|
659
|
+
bubbles: true,
|
|
660
|
+
}),
|
|
661
|
+
);
|
|
662
|
+
_inputNode.dispatchEvent(
|
|
663
|
+
new Event('input', {
|
|
664
|
+
bubbles: true,
|
|
665
|
+
}),
|
|
666
|
+
);
|
|
682
667
|
}
|
|
683
|
-
|
|
684
668
|
it('sets formatOptions.mode to "pasted" (and restores to "auto")', async () => {
|
|
685
|
-
const el =
|
|
669
|
+
const el =
|
|
670
|
+
/** @type {FormatClass} */
|
|
686
671
|
await fixture(html`
|
|
687
672
|
<${reflectingTag}><input slot="input"></${reflectingTag}>
|
|
688
|
-
`)
|
|
689
|
-
);
|
|
673
|
+
`);
|
|
690
674
|
const formatterSpy = sinon.spy(el, 'formatter');
|
|
691
675
|
mimicPaste(el);
|
|
692
676
|
expect(formatterSpy).to.be.called;
|
|
693
|
-
expect(/** @type {{mode: string}} */
|
|
677
|
+
expect(/** @type {{mode: string}} */ formatterSpy.lastCall.args[1].mode).to.equal(
|
|
694
678
|
'pasted',
|
|
695
679
|
);
|
|
696
680
|
// give microtask of _isPasting chance to reset
|
|
697
681
|
await aTimeout(0);
|
|
698
682
|
el.modelValue = 'foo';
|
|
699
|
-
expect(/** @type {{mode: string}} */
|
|
683
|
+
expect(/** @type {{mode: string}} */ formatterSpy.lastCall.args[1].mode).to.equal(
|
|
700
684
|
'auto',
|
|
701
685
|
);
|
|
702
686
|
});
|
|
703
|
-
|
|
704
687
|
it('sets protected value "_isPasting" for Subclassers', async () => {
|
|
705
|
-
const el =
|
|
688
|
+
const el =
|
|
689
|
+
/** @type {FormatClass} */
|
|
706
690
|
await fixture(html`
|
|
707
691
|
<${reflectingTag}><input slot="input"></${reflectingTag}>
|
|
708
|
-
`)
|
|
709
|
-
);
|
|
692
|
+
`);
|
|
710
693
|
const formatterSpy = sinon.spy(el, 'formatter');
|
|
711
694
|
mimicPaste(el);
|
|
712
695
|
expect(formatterSpy).to.have.been.called;
|
|
@@ -716,57 +699,49 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
716
699
|
// @ts-ignore [allow-protected] in test
|
|
717
700
|
expect(el._isPasting).to.be.false;
|
|
718
701
|
});
|
|
719
|
-
|
|
720
702
|
it('calls formatter and "_reflectBackOn()"', async () => {
|
|
721
|
-
const el =
|
|
703
|
+
const el =
|
|
704
|
+
/** @type {FormatClass} */
|
|
722
705
|
await fixture(html`
|
|
723
706
|
<${tag}><input slot="input"></${tag}>
|
|
724
|
-
`)
|
|
725
|
-
);
|
|
707
|
+
`);
|
|
726
708
|
// @ts-ignore [allow-protected] in test
|
|
727
709
|
const reflectBackSpy = sinon.spy(el, '_reflectBackOn');
|
|
728
710
|
mimicPaste(el);
|
|
729
711
|
expect(reflectBackSpy).to.have.been.called;
|
|
730
712
|
});
|
|
731
|
-
|
|
732
713
|
it(`updates viewValue when "_reflectBackOn()" configured to reflect`, async () => {
|
|
733
|
-
const el =
|
|
714
|
+
const el =
|
|
715
|
+
/** @type {FormatClass} */
|
|
734
716
|
await fixture(html`
|
|
735
717
|
<${reflectingTag}><input slot="input"></${reflectingTag}>
|
|
736
|
-
`)
|
|
737
|
-
);
|
|
718
|
+
`);
|
|
738
719
|
// @ts-ignore [allow-protected] in test
|
|
739
720
|
const reflectBackSpy = sinon.spy(el, '_reflectBackOn');
|
|
740
721
|
mimicPaste(el);
|
|
741
722
|
expect(reflectBackSpy).to.have.been.called;
|
|
742
723
|
});
|
|
743
724
|
});
|
|
744
|
-
|
|
745
725
|
describe('On user input', () => {
|
|
746
726
|
it('adjusts formatOptions.mode to "user-edited" for parser when user changes value', async () => {
|
|
747
|
-
const el =
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
727
|
+
const el =
|
|
728
|
+
/** @type {FormatClass} */
|
|
729
|
+
await fixture(html`<${tag}><input slot="input"></${tag}>`);
|
|
751
730
|
const parserSpy = sinon.spy(el, 'parser');
|
|
752
731
|
|
|
753
732
|
// Here we get auto as we start from '' (so there was no value to edit)
|
|
754
733
|
mimicUserInput(el, 'some val');
|
|
755
|
-
expect(/** @type {{mode: string}} */
|
|
756
|
-
'auto',
|
|
757
|
-
);
|
|
734
|
+
expect(/** @type {{mode: string}} */ parserSpy.lastCall.args[1].mode).to.equal('auto');
|
|
758
735
|
await el.updateComplete;
|
|
759
|
-
|
|
760
736
|
mimicUserInput(el, 'some other val');
|
|
761
|
-
expect(/** @type {{mode: string}} */
|
|
737
|
+
expect(/** @type {{mode: string}} */ parserSpy.lastCall.args[1].mode).to.equal(
|
|
762
738
|
'user-edited',
|
|
763
739
|
);
|
|
764
740
|
});
|
|
765
|
-
|
|
766
741
|
it('adjusts formatOptions.viewValueStates when user already formatted value', async () => {
|
|
767
|
-
const el =
|
|
768
|
-
|
|
769
|
-
|
|
742
|
+
const el =
|
|
743
|
+
/** @type {FormatClass} */
|
|
744
|
+
await fixture(html`<${tag}><input slot="input"></${tag}>`);
|
|
770
745
|
|
|
771
746
|
// Neutralize config, so that we know for sure that the user has formatted the value
|
|
772
747
|
// when this suite is run on extended classes
|
|
@@ -777,19 +752,16 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
777
752
|
// avoid non-formatted values due to validators in extended classes
|
|
778
753
|
el.defaultValidators = [];
|
|
779
754
|
// avoid Unparseable due to parsers in extended classes
|
|
780
|
-
el.parser = v => v;
|
|
755
|
+
el.parser = (v) => v;
|
|
781
756
|
// @ts-expect-error
|
|
782
|
-
el.formatter = v => v;
|
|
783
|
-
|
|
757
|
+
el.formatter = (v) => v;
|
|
784
758
|
const parserSpy = sinon.spy(el, 'parser');
|
|
785
759
|
const formatterSpy = sinon.spy(el, 'formatter');
|
|
786
|
-
|
|
787
760
|
mimicUserInput(el, 'some val');
|
|
788
761
|
expect(parserSpy.lastCall.args[1].viewValueStates).to.not.include('formatted');
|
|
789
762
|
// @ts-expect-error
|
|
790
763
|
expect(formatterSpy.lastCall.args[1].viewValueStates).to.not.include('formatted');
|
|
791
764
|
await el.updateComplete;
|
|
792
|
-
|
|
793
765
|
mimicUserInput(el, 'some other val');
|
|
794
766
|
expect(parserSpy.lastCall.args[1].viewValueStates).to.include('formatted');
|
|
795
767
|
// @ts-expect-error
|
|
@@ -797,20 +769,18 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
797
769
|
});
|
|
798
770
|
});
|
|
799
771
|
});
|
|
800
|
-
|
|
801
772
|
describe('Parser', () => {
|
|
802
773
|
it('only calls the parser for defined values', async () => {
|
|
803
774
|
/** @type {any} */
|
|
804
775
|
const generatedValue = generateValueBasedOnType();
|
|
805
776
|
const parserSpy = sinon.spy();
|
|
806
|
-
const el =
|
|
777
|
+
const el =
|
|
778
|
+
/** @type {FormatClass} */
|
|
807
779
|
await fixture(html`
|
|
808
780
|
<${tag} .parser="${parserSpy}">
|
|
809
781
|
<input slot="input" .value="${generatedValue}">
|
|
810
782
|
</${tag}>
|
|
811
|
-
`)
|
|
812
|
-
);
|
|
813
|
-
|
|
783
|
+
`);
|
|
814
784
|
const initialParserCallCount = parserSpy.callCount;
|
|
815
785
|
// This could happen for instance in a reset
|
|
816
786
|
el.modelValue = undefined;
|
|
@@ -820,51 +790,47 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
820
790
|
expect(parserSpy.callCount).to.equal(initialParserCallCount);
|
|
821
791
|
});
|
|
822
792
|
});
|
|
823
|
-
|
|
824
793
|
describe('Preprocessor', () => {
|
|
825
794
|
it('changes `.value` on keyup, before passing on to parser', async () => {
|
|
826
|
-
const val =
|
|
795
|
+
const val =
|
|
796
|
+
generateValueBasedOnType({
|
|
797
|
+
viewValue: true,
|
|
798
|
+
}) || 'init-value';
|
|
827
799
|
if (typeof val !== 'string') {
|
|
828
800
|
return;
|
|
829
801
|
}
|
|
830
|
-
|
|
831
802
|
const toBeCorrectedVal = `${val}$`;
|
|
832
|
-
const preprocessorSpy = sinon.spy(v => v.replace(/\$$/g, ''));
|
|
833
|
-
|
|
834
|
-
|
|
803
|
+
const preprocessorSpy = sinon.spy((v) => v.replace(/\$$/g, ''));
|
|
804
|
+
const el =
|
|
805
|
+
/** @type {FormatClass} */
|
|
835
806
|
await fixture(html`
|
|
836
807
|
<${tag} .preprocessor=${preprocessorSpy}>
|
|
837
808
|
<input slot="input">
|
|
838
809
|
</${tag}>
|
|
839
|
-
`)
|
|
840
|
-
);
|
|
841
|
-
|
|
810
|
+
`);
|
|
842
811
|
const { _inputNode } = getFormControlMembers(el);
|
|
843
|
-
|
|
844
812
|
const initialPreprocessorCallCount = preprocessorSpy.callCount;
|
|
845
|
-
|
|
846
813
|
const parserSpy = sinon.spy(el, 'parser');
|
|
847
814
|
mimicUserInput(el, toBeCorrectedVal);
|
|
848
|
-
|
|
849
815
|
expect(preprocessorSpy.callCount).to.equal(initialPreprocessorCallCount + 1);
|
|
850
816
|
expect(parserSpy.lastCall.args[0]).to.equal(val);
|
|
851
817
|
expect(_inputNode.value).to.equal(val);
|
|
852
818
|
});
|
|
853
|
-
|
|
854
819
|
it('does only calculate derived values as consequence of user input when preprocessed value is different from previous view value', async () => {
|
|
855
820
|
if (cfg.modelValueType === Object) return;
|
|
856
|
-
|
|
857
|
-
|
|
821
|
+
const val =
|
|
822
|
+
generateValueBasedOnType({
|
|
823
|
+
viewValue: true,
|
|
824
|
+
}) || 'init-value';
|
|
858
825
|
if (typeof val !== 'string') return;
|
|
859
|
-
|
|
860
|
-
const
|
|
861
|
-
|
|
826
|
+
const preprocessorSpy = sinon.spy((v) => v.replace(/\$$/g, ''));
|
|
827
|
+
const el =
|
|
828
|
+
/** @type {FormatClass} */
|
|
862
829
|
await fixture(html`
|
|
863
830
|
<${tag} .preprocessor=${preprocessorSpy}>
|
|
864
831
|
<input slot="input" .value="${val}">
|
|
865
832
|
</${tag}>
|
|
866
|
-
`)
|
|
867
|
-
);
|
|
833
|
+
`);
|
|
868
834
|
|
|
869
835
|
// TODO: find out why we need to skip this for lion-input-stepper
|
|
870
836
|
if (isLionInputStepper(el)) return;
|
|
@@ -874,8 +840,7 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
874
840
|
* @param {sinon.SinonSpyCall} call
|
|
875
841
|
* @returns {boolean}
|
|
876
842
|
*/
|
|
877
|
-
const isCalculateCallAfterUserInput = call => call.args[0]?.length === 0;
|
|
878
|
-
|
|
843
|
+
const isCalculateCallAfterUserInput = (call) => call.args[0]?.length === 0;
|
|
879
844
|
const didRecalculateAfterUserInput = (/** @type {sinon.SinonSpy<any[], any>} */ spy) =>
|
|
880
845
|
spy.callCount > 1 && !spy.getCalls().find(isCalculateCallAfterUserInput);
|
|
881
846
|
|
|
@@ -889,74 +854,84 @@ export function runFormatMixinSuite(customConfig) {
|
|
|
889
854
|
mimicUserInput(el, `${val}ue$`);
|
|
890
855
|
expect(didRecalculateAfterUserInput(calcValuesSpy)).to.be.true;
|
|
891
856
|
});
|
|
892
|
-
|
|
893
857
|
it('does not preprocess during composition', async () => {
|
|
894
|
-
const el =
|
|
858
|
+
const el =
|
|
859
|
+
/** @type {FormatClass} */
|
|
895
860
|
await fixture(html`
|
|
896
861
|
<${tag} .preprocessor=${(/** @type {string} */ v) => v.replace(/\$$/g, '')}>
|
|
897
862
|
<input slot="input">
|
|
898
863
|
</${tag}>
|
|
899
|
-
`)
|
|
900
|
-
);
|
|
901
|
-
|
|
864
|
+
`);
|
|
902
865
|
const { _inputNode } = getFormControlMembers(el);
|
|
903
|
-
|
|
904
866
|
const preprocessorSpy = sinon.spy(el, 'preprocessor');
|
|
905
|
-
_inputNode.dispatchEvent(
|
|
867
|
+
_inputNode.dispatchEvent(
|
|
868
|
+
new Event('compositionstart', {
|
|
869
|
+
bubbles: true,
|
|
870
|
+
}),
|
|
871
|
+
);
|
|
906
872
|
mimicUserInput(el, '`');
|
|
907
873
|
expect(preprocessorSpy.callCount).to.equal(0);
|
|
908
874
|
// "à" would be sent by the browser after pressing "option + `", followed by "a"
|
|
909
875
|
mimicUserInput(el, 'à');
|
|
910
|
-
_inputNode.dispatchEvent(
|
|
876
|
+
_inputNode.dispatchEvent(
|
|
877
|
+
new Event('compositionend', {
|
|
878
|
+
bubbles: true,
|
|
879
|
+
}),
|
|
880
|
+
);
|
|
911
881
|
expect(preprocessorSpy.callCount).to.equal(1);
|
|
912
882
|
});
|
|
913
|
-
|
|
914
883
|
describe('Live Formatters', () => {
|
|
915
884
|
it('receives meta object with { prevViewValue: string; currentCaretIndex: number; }', async () => {
|
|
916
885
|
const spy = sinon.spy();
|
|
917
|
-
|
|
918
886
|
const valInitial = generateValueBasedOnType();
|
|
919
|
-
const el =
|
|
887
|
+
const el =
|
|
888
|
+
/** @type {FormatClass} */
|
|
920
889
|
await fixture(
|
|
921
890
|
html`<${tag} .modelValue="${valInitial}" .preprocessor=${spy}><input slot="input"></${tag}>`,
|
|
922
|
-
)
|
|
923
|
-
);
|
|
891
|
+
);
|
|
924
892
|
const viewValInitial = el.value;
|
|
925
|
-
const valToggled = generateValueBasedOnType({
|
|
926
|
-
|
|
927
|
-
|
|
893
|
+
const valToggled = generateValueBasedOnType({
|
|
894
|
+
toggleValue: true,
|
|
895
|
+
});
|
|
896
|
+
mimicUserInput(el, valToggled, {
|
|
897
|
+
caretIndex: 1,
|
|
898
|
+
});
|
|
928
899
|
expect(spy.args[0][0]).to.equal(el.value);
|
|
929
900
|
const formatOptions = spy.args[0][1];
|
|
930
901
|
expect(formatOptions.prevViewValue).to.equal(viewValInitial);
|
|
931
902
|
expect(formatOptions.currentCaretIndex).to.equal(1);
|
|
932
903
|
});
|
|
933
|
-
|
|
934
904
|
it('updates return viewValue and caretIndex', async () => {
|
|
935
905
|
/**
|
|
936
906
|
* @param {string} viewValue
|
|
937
907
|
* @param {{ prevViewValue: string; currentCaretIndex: number; }} meta
|
|
938
908
|
*/
|
|
939
909
|
function myPreprocessor(viewValue, { currentCaretIndex }) {
|
|
940
|
-
return {
|
|
910
|
+
return {
|
|
911
|
+
viewValue: `${viewValue}q`,
|
|
912
|
+
caretIndex: currentCaretIndex + 1,
|
|
913
|
+
};
|
|
941
914
|
}
|
|
942
|
-
const el =
|
|
915
|
+
const el =
|
|
916
|
+
/** @type {FormatClass} */
|
|
943
917
|
await fixture(
|
|
944
918
|
html`<${tag} .modelValue="${'xyz'}" .preprocessor=${myPreprocessor}><input slot="input"></${tag}>`,
|
|
945
|
-
)
|
|
946
|
-
|
|
947
|
-
|
|
919
|
+
);
|
|
920
|
+
mimicUserInput(el, 'wxyz', {
|
|
921
|
+
caretIndex: 1,
|
|
922
|
+
});
|
|
948
923
|
expect(el._inputNode.value).to.equal('wxyzq');
|
|
949
924
|
expect(el._inputNode.selectionStart).to.equal(2);
|
|
950
925
|
});
|
|
951
|
-
|
|
952
926
|
it('does not update when undefined is returned', async () => {
|
|
953
|
-
const el =
|
|
927
|
+
const el =
|
|
928
|
+
/** @type {FormatClass} */
|
|
954
929
|
await fixture(
|
|
955
|
-
html`<${tag} .modelValue="${'xyz'}" live-format .liveFormatter=${() =>
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
930
|
+
html`<${tag} .modelValue="${'xyz'}" live-format .liveFormatter=${() => undefined}><input slot="input"></${tag}>`,
|
|
931
|
+
);
|
|
932
|
+
mimicUserInput(el, 'wxyz', {
|
|
933
|
+
caretIndex: 1,
|
|
934
|
+
});
|
|
960
935
|
expect(el._inputNode.value).to.equal('wxyz');
|
|
961
936
|
// Make sure we do not put our already existing value back, because caret index would be lost
|
|
962
937
|
expect(el._inputNode.selectionStart).to.equal(1);
|