@lion/ui 0.6.0-alpha.2 → 0.6.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/checkbox-group/src/LionCheckboxIndeterminate.js +17 -2
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +3 -0
- package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +435 -396
- package/components/core/src/ScopedElementsMixin.js +2 -0
- package/components/core/src/types.ts +19 -0
- package/components/form/src/LionForm.js +24 -0
- package/components/form/test/lion-form.test.js +66 -2
- package/components/form-core/src/FormControlMixin.js +17 -1
- package/components/form-core/src/form-group/FormGroupMixin.js +5 -6
- package/components/form-core/test/FormControlMixin.test.js +39 -20
- package/components/form-core/test-suites/form-group/FormGroupMixin-input.suite.js +0 -47
- package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +21 -3
- package/components/input-range/src/LionInputRange.js +36 -4
- package/components/input-range/src/localizeNamespaceLoader.js +75 -0
- package/components/input-range/test/lion-input-range.test.js +6 -6
- package/components/input-range/translations/bg-BG.js +5 -0
- package/components/input-range/translations/bg.js +4 -0
- package/components/input-range/translations/cs-CZ.js +5 -0
- package/components/input-range/translations/cs.js +4 -0
- package/components/input-range/translations/de-DE.js +5 -0
- package/components/input-range/translations/de.js +4 -0
- package/components/input-range/translations/en-AU.js +5 -0
- package/components/input-range/translations/en-GB.js +5 -0
- package/components/input-range/translations/en-PH.js +5 -0
- package/components/input-range/translations/en-US.js +5 -0
- package/components/input-range/translations/en.js +4 -0
- package/components/input-range/translations/es-ES.js +5 -0
- package/components/input-range/translations/es.js +4 -0
- package/components/input-range/translations/fr-BE.js +5 -0
- package/components/input-range/translations/fr-FR.js +5 -0
- package/components/input-range/translations/fr.js +4 -0
- package/components/input-range/translations/hu-HU.js +5 -0
- package/components/input-range/translations/hu.js +4 -0
- package/components/input-range/translations/it-IT.js +5 -0
- package/components/input-range/translations/it.js +4 -0
- package/components/input-range/translations/nl-BE.js +5 -0
- package/components/input-range/translations/nl-NL.js +5 -0
- package/components/input-range/translations/nl.js +4 -0
- package/components/input-range/translations/pl-PL.js +5 -0
- package/components/input-range/translations/pl.js +4 -0
- package/components/input-range/translations/ro-RO.js +5 -0
- package/components/input-range/translations/ro.js +4 -0
- package/components/input-range/translations/ru-RU.js +5 -0
- package/components/input-range/translations/ru.js +4 -0
- package/components/input-range/translations/sk-SK.js +5 -0
- package/components/input-range/translations/sk.js +4 -0
- package/components/input-range/translations/uk-UA.js +5 -0
- package/components/input-range/translations/uk.js +4 -0
- package/components/input-range/translations/zh-CN.js +5 -0
- package/components/input-range/translations/zh.js +4 -0
- package/components/input-stepper/src/LionInputStepper.js +56 -33
- package/components/input-stepper/src/localizeNamespaceLoader.js +75 -0
- package/components/input-stepper/test/lion-input-stepper.test.js +61 -8
- package/components/input-stepper/translations/bg-BG.js +5 -0
- package/components/input-stepper/translations/bg.js +4 -0
- package/components/input-stepper/translations/cs-CZ.js +5 -0
- package/components/input-stepper/translations/cs.js +4 -0
- package/components/input-stepper/translations/de-DE.js +5 -0
- package/components/input-stepper/translations/de.js +4 -0
- package/components/input-stepper/translations/en-AU.js +5 -0
- package/components/input-stepper/translations/en-GB.js +5 -0
- package/components/input-stepper/translations/en-US.js +5 -0
- package/components/input-stepper/translations/en.js +4 -0
- package/components/input-stepper/translations/es-ES.js +5 -0
- package/components/input-stepper/translations/es.js +4 -0
- package/components/input-stepper/translations/fr-BE.js +5 -0
- package/components/input-stepper/translations/fr-FR.js +5 -0
- package/components/input-stepper/translations/fr.js +4 -0
- package/components/input-stepper/translations/hu-HU.js +5 -0
- package/components/input-stepper/translations/hu.js +4 -0
- package/components/input-stepper/translations/it-IT.js +5 -0
- package/components/input-stepper/translations/it.js +4 -0
- package/components/input-stepper/translations/nl-BE.js +5 -0
- package/components/input-stepper/translations/nl-NL.js +5 -0
- package/components/input-stepper/translations/nl.js +4 -0
- package/components/input-stepper/translations/pl-PL.js +5 -0
- package/components/input-stepper/translations/pl.js +4 -0
- package/components/input-stepper/translations/ro-RO.js +5 -0
- package/components/input-stepper/translations/ro.js +4 -0
- package/components/input-stepper/translations/ru-RU.js +5 -0
- package/components/input-stepper/translations/ru.js +4 -0
- package/components/input-stepper/translations/sk-SK.js +5 -0
- package/components/input-stepper/translations/sk.js +4 -0
- package/components/input-stepper/translations/uk-UA.js +5 -0
- package/components/input-stepper/translations/uk.js +4 -0
- package/components/input-stepper/translations/zh.js +4 -0
- package/custom-elements.json +1538 -12
- package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts +7 -1
- package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts.map +1 -1
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts.map +1 -1
- package/dist-types/components/core/src/ScopedElementsMixin.d.ts +3 -352
- package/dist-types/components/core/src/ScopedElementsMixin.d.ts.map +1 -1
- package/dist-types/components/core/src/types.d.ts +15 -0
- package/dist-types/components/core/src/types.d.ts.map +1 -0
- package/dist-types/components/form/src/LionForm.d.ts +6 -0
- package/dist-types/components/form/src/LionForm.d.ts.map +1 -1
- package/dist-types/components/form-core/src/FormControlMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/src/form-group/FormGroupMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/form-group/FormGroupMixin-input.suite.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/form-group/FormGroupMixin.suite.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +1 -356
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
- package/dist-types/components/input-file/src/LionInputFile.d.ts +1 -349
- package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -1
- package/dist-types/components/input-file/src/LionSelectedFileList.d.ts +1 -345
- package/dist-types/components/input-file/src/LionSelectedFileList.d.ts.map +1 -1
- package/dist-types/components/input-range/src/LionInputRange.d.ts +7 -1
- package/dist-types/components/input-range/src/LionInputRange.d.ts.map +1 -1
- package/dist-types/components/input-range/src/localizeNamespaceLoader.d.ts +2 -0
- package/dist-types/components/input-range/src/localizeNamespaceLoader.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/bg-BG.d.ts +6 -0
- package/dist-types/components/input-range/translations/bg-BG.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/bg.d.ts +6 -0
- package/dist-types/components/input-range/translations/bg.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/cs-CZ.d.ts +6 -0
- package/dist-types/components/input-range/translations/cs-CZ.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/cs.d.ts +6 -0
- package/dist-types/components/input-range/translations/cs.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/de-DE.d.ts +6 -0
- package/dist-types/components/input-range/translations/de-DE.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/de.d.ts +6 -0
- package/dist-types/components/input-range/translations/de.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/en-AU.d.ts +6 -0
- package/dist-types/components/input-range/translations/en-AU.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/en-GB.d.ts +6 -0
- package/dist-types/components/input-range/translations/en-GB.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/en-PH.d.ts +6 -0
- package/dist-types/components/input-range/translations/en-PH.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/en-US.d.ts +6 -0
- package/dist-types/components/input-range/translations/en-US.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/en.d.ts +6 -0
- package/dist-types/components/input-range/translations/en.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/es-ES.d.ts +6 -0
- package/dist-types/components/input-range/translations/es-ES.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/es.d.ts +6 -0
- package/dist-types/components/input-range/translations/es.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/fr-BE.d.ts +6 -0
- package/dist-types/components/input-range/translations/fr-BE.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/fr-FR.d.ts +6 -0
- package/dist-types/components/input-range/translations/fr-FR.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/fr.d.ts +6 -0
- package/dist-types/components/input-range/translations/fr.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/hu-HU.d.ts +6 -0
- package/dist-types/components/input-range/translations/hu-HU.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/hu.d.ts +6 -0
- package/dist-types/components/input-range/translations/hu.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/it-IT.d.ts +6 -0
- package/dist-types/components/input-range/translations/it-IT.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/it.d.ts +6 -0
- package/dist-types/components/input-range/translations/it.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/nl-BE.d.ts +6 -0
- package/dist-types/components/input-range/translations/nl-BE.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/nl-NL.d.ts +6 -0
- package/dist-types/components/input-range/translations/nl-NL.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/nl.d.ts +6 -0
- package/dist-types/components/input-range/translations/nl.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/pl-PL.d.ts +6 -0
- package/dist-types/components/input-range/translations/pl-PL.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/pl.d.ts +6 -0
- package/dist-types/components/input-range/translations/pl.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/ro-RO.d.ts +6 -0
- package/dist-types/components/input-range/translations/ro-RO.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/ro.d.ts +6 -0
- package/dist-types/components/input-range/translations/ro.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/ru-RU.d.ts +6 -0
- package/dist-types/components/input-range/translations/ru-RU.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/ru.d.ts +6 -0
- package/dist-types/components/input-range/translations/ru.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/sk-SK.d.ts +6 -0
- package/dist-types/components/input-range/translations/sk-SK.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/sk.d.ts +6 -0
- package/dist-types/components/input-range/translations/sk.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/uk-UA.d.ts +6 -0
- package/dist-types/components/input-range/translations/uk-UA.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/uk.d.ts +6 -0
- package/dist-types/components/input-range/translations/uk.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/zh-CN.d.ts +6 -0
- package/dist-types/components/input-range/translations/zh-CN.d.ts.map +1 -0
- package/dist-types/components/input-range/translations/zh.d.ts +6 -0
- package/dist-types/components/input-range/translations/zh.d.ts.map +1 -0
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +22 -3
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
- package/dist-types/components/input-stepper/src/localizeNamespaceLoader.d.ts +2 -0
- package/dist-types/components/input-stepper/src/localizeNamespaceLoader.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/bg-BG.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/bg-BG.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/bg.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/bg.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/cs-CZ.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/cs-CZ.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/cs.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/cs.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/de-DE.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/de-DE.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/de.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/de.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/en-AU.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/en-AU.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/en-GB.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/en-GB.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/en-US.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/en-US.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/en.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/en.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/es-ES.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/es-ES.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/es.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/es.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/fr-BE.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/fr-BE.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/fr-FR.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/fr-FR.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/fr.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/fr.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/hu-HU.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/hu-HU.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/hu.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/hu.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/it-IT.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/it-IT.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/it.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/it.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/nl-BE.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/nl-BE.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/nl-NL.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/nl-NL.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/nl.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/nl.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/pl-PL.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/pl-PL.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/pl.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/pl.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/ro-RO.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/ro-RO.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/ro.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/ro.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/ru-RU.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/ru-RU.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/ru.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/ru.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/sk-SK.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/sk-SK.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/sk.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/sk.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/uk-UA.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/uk-UA.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/uk.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/uk.d.ts.map +1 -0
- package/dist-types/components/input-stepper/translations/zh.d.ts +6 -0
- package/dist-types/components/input-stepper/translations/zh.d.ts.map +1 -0
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +1 -345
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
- package/dist-types/components/switch/src/LionSwitch.d.ts +2 -348
- package/dist-types/components/switch/src/LionSwitch.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/fieldset/use-cases.md +0 -1
- package/docs/components/form/overview.md +22 -11
- package/docs/components/form/use-cases.md +10 -14
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +4 -6
- package/docs/components/input-range/use-cases.md +40 -48
- package/docs/components/input-stepper/overview.md +8 -8
- package/docs/components/input-stepper/use-cases.md +30 -21
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/use-cases.md +16 -5
- package/docs/fundamentals/systems/form/validate.md +1 -1
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +3 -1
|
@@ -79,11 +79,10 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
79
79
|
// Assert
|
|
80
80
|
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
81
81
|
});
|
|
82
|
-
});
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
it('should be indeterminate if one child is checked', async () => {
|
|
84
|
+
// Arrange
|
|
85
|
+
const el = /** @type {LionCheckboxGroup} */ await fixture(html`
|
|
87
86
|
<${groupTag} name="scientists[]">
|
|
88
87
|
<${tag} label="Favorite scientists">
|
|
89
88
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -93,17 +92,17 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
93
92
|
</${groupTag}>
|
|
94
93
|
`);
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
96
|
+
el.querySelector(`${cfg.tagString}`)
|
|
97
|
+
);
|
|
98
|
+
// Assert
|
|
99
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
100
|
+
});
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
it('should be checked if all children are checked', async () => {
|
|
103
|
+
// Arrange
|
|
104
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
105
|
+
await fixture(html`
|
|
107
106
|
<${groupTag} name="scientists[]">
|
|
108
107
|
<${tag} label="Favorite scientists">
|
|
109
108
|
<${childTag} label="Archimedes" checked></${childTag}>
|
|
@@ -112,20 +111,20 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
112
111
|
</${tag}>
|
|
113
112
|
</${groupTag}>
|
|
114
113
|
`)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// Assert
|
|
121
|
-
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
122
|
-
expect(elIndeterminate?.checked).to.be.true;
|
|
123
|
-
});
|
|
114
|
+
);
|
|
115
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
116
|
+
el.querySelector(`${cfg.tagString}`)
|
|
117
|
+
);
|
|
124
118
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
// Assert
|
|
120
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
121
|
+
expect(elIndeterminate?.checked).to.be.true;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should become indeterminate if one child is checked', async () => {
|
|
125
|
+
// Arrange
|
|
126
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
127
|
+
await fixture(html`
|
|
129
128
|
<${groupTag} name="scientists[]">
|
|
130
129
|
<${tag} label="Favorite scientists">
|
|
131
130
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -134,25 +133,25 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
134
133
|
</${tag}>
|
|
135
134
|
</${groupTag}>
|
|
136
135
|
`)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
);
|
|
137
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
138
|
+
el.querySelector(`${cfg.tagString}`)
|
|
139
|
+
);
|
|
141
140
|
|
|
142
|
-
|
|
141
|
+
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
// Act
|
|
144
|
+
_subCheckboxes[0].checked = true;
|
|
145
|
+
await el.updateComplete;
|
|
147
146
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
// Assert
|
|
148
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
149
|
+
});
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
it('should become checked if all children are checked', async () => {
|
|
152
|
+
// Arrange
|
|
153
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
154
|
+
await fixture(html`
|
|
156
155
|
<${groupTag} name="scientists[]">
|
|
157
156
|
<${tag} label="Favorite scientists">
|
|
158
157
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -161,27 +160,27 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
161
160
|
</${tag}>
|
|
162
161
|
</${groupTag}>
|
|
163
162
|
`)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// Assert
|
|
177
|
-
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
178
|
-
expect(elIndeterminate?.checked).to.be.true;
|
|
179
|
-
});
|
|
163
|
+
);
|
|
164
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
165
|
+
el.querySelector(`${cfg.tagString}`)
|
|
166
|
+
);
|
|
167
|
+
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
168
|
+
|
|
169
|
+
// Act
|
|
170
|
+
_subCheckboxes[0].checked = true;
|
|
171
|
+
_subCheckboxes[1].checked = true;
|
|
172
|
+
_subCheckboxes[2].checked = true;
|
|
173
|
+
await el.updateComplete;
|
|
180
174
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
175
|
+
// Assert
|
|
176
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
177
|
+
expect(elIndeterminate?.checked).to.be.true;
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('should become indeterminate if all children except disabled ones are checked', async () => {
|
|
181
|
+
// Arrange
|
|
182
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
183
|
+
await fixture(html`
|
|
185
184
|
<${groupTag} name="scientists[]">
|
|
186
185
|
<${tag} label="Favorite scientists">
|
|
187
186
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -190,26 +189,26 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
190
189
|
</${tag}>
|
|
191
190
|
</${groupTag}>
|
|
192
191
|
`)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
// Act
|
|
200
|
-
_subCheckboxes[0].checked = true;
|
|
201
|
-
_subCheckboxes[2].checked = true;
|
|
202
|
-
await el.updateComplete;
|
|
203
|
-
|
|
204
|
-
// Assert
|
|
205
|
-
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
206
|
-
expect(elIndeterminate?.checked).to.be.false;
|
|
207
|
-
});
|
|
192
|
+
);
|
|
193
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
194
|
+
el.querySelector(`${cfg.tagString}`)
|
|
195
|
+
);
|
|
196
|
+
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
208
197
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
await
|
|
198
|
+
// Act
|
|
199
|
+
_subCheckboxes[0].checked = true;
|
|
200
|
+
_subCheckboxes[2].checked = true;
|
|
201
|
+
await el.updateComplete;
|
|
202
|
+
|
|
203
|
+
// Assert
|
|
204
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
205
|
+
expect(elIndeterminate?.checked).to.be.false;
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should sync all children when parent is checked (from indeterminate to checked)', async () => {
|
|
209
|
+
// Arrange
|
|
210
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
211
|
+
await fixture(html`
|
|
213
212
|
<${groupTag} name="scientists[]">
|
|
214
213
|
<${tag} label="Favorite scientists">
|
|
215
214
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -218,27 +217,27 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
218
217
|
</${tag}>
|
|
219
218
|
</${groupTag}>
|
|
220
219
|
`)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// Assert
|
|
232
|
-
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
233
|
-
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
234
|
-
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.true;
|
|
235
|
-
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
236
|
-
});
|
|
220
|
+
);
|
|
221
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
222
|
+
el.querySelector(`${cfg.tagString}`)
|
|
223
|
+
);
|
|
224
|
+
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
225
|
+
|
|
226
|
+
// Act
|
|
227
|
+
_inputNode.click();
|
|
228
|
+
await elIndeterminate.updateComplete;
|
|
237
229
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
230
|
+
// Assert
|
|
231
|
+
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
232
|
+
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
233
|
+
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.true;
|
|
234
|
+
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('should not sync any disabled children when parent is checked (from indeterminate to checked)', async () => {
|
|
238
|
+
// Arrange
|
|
239
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
240
|
+
await fixture(html`
|
|
242
241
|
<${groupTag} name="scientists[]">
|
|
243
242
|
<${tag} label="Favorite scientists">
|
|
244
243
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -247,27 +246,27 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
247
246
|
</${tag}>
|
|
248
247
|
</${groupTag}>
|
|
249
248
|
`)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
249
|
+
);
|
|
250
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
251
|
+
el.querySelector(`${cfg.tagString}`)
|
|
252
|
+
);
|
|
253
|
+
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
254
|
+
|
|
255
|
+
// Act
|
|
256
|
+
_inputNode.click();
|
|
257
|
+
await elIndeterminate.updateComplete;
|
|
258
|
+
|
|
259
|
+
// Assert
|
|
260
|
+
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.true;
|
|
261
|
+
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
262
|
+
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.false;
|
|
263
|
+
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
264
|
+
});
|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
it('should remain unchecked when parent is clicked and all children are disabled', async () => {
|
|
267
|
+
// Arrange
|
|
268
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
269
|
+
await fixture(html`
|
|
271
270
|
<${groupTag} name="scientists[]">
|
|
272
271
|
<${tag} label="Favorite scientists">
|
|
273
272
|
<${childTag} label="Archimedes" disabled></${childTag}>
|
|
@@ -276,28 +275,28 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
276
275
|
</${tag}>
|
|
277
276
|
</${groupTag}>
|
|
278
277
|
`)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
278
|
+
);
|
|
279
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
280
|
+
el.querySelector(`${cfg.tagString}`)
|
|
281
|
+
);
|
|
282
|
+
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
283
|
+
|
|
284
|
+
// Act
|
|
285
|
+
_inputNode.click();
|
|
286
|
+
await elIndeterminate.updateComplete;
|
|
287
|
+
|
|
288
|
+
// Assert
|
|
289
|
+
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
290
|
+
expect(elIndeterminate.hasAttribute('checked')).to.be.false;
|
|
291
|
+
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.false;
|
|
292
|
+
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.false;
|
|
293
|
+
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.false;
|
|
294
|
+
});
|
|
296
295
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
it('should remain checked when parent is clicked and all children are disabled and checked', async () => {
|
|
297
|
+
// Arrange
|
|
298
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
299
|
+
await fixture(html`
|
|
301
300
|
<${groupTag} name="scientists[]">
|
|
302
301
|
<${tag} label="Favorite scientists">
|
|
303
302
|
<${childTag} label="Archimedes" disabled checked></${childTag}>
|
|
@@ -306,28 +305,28 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
306
305
|
</${tag}>
|
|
307
306
|
</${groupTag}>
|
|
308
307
|
`)
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
308
|
+
);
|
|
309
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
310
|
+
el.querySelector(`${cfg.tagString}`)
|
|
311
|
+
);
|
|
312
|
+
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
313
|
+
|
|
314
|
+
// Act
|
|
315
|
+
_inputNode.click();
|
|
316
|
+
await elIndeterminate.updateComplete;
|
|
317
|
+
|
|
318
|
+
// Assert
|
|
319
|
+
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
320
|
+
expect(elIndeterminate.hasAttribute('checked')).to.be.true;
|
|
321
|
+
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
322
|
+
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.true;
|
|
323
|
+
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
324
|
+
});
|
|
326
325
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
326
|
+
it('should sync all children when parent is checked (from unchecked to checked)', async () => {
|
|
327
|
+
// Arrange
|
|
328
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
329
|
+
await fixture(html`
|
|
331
330
|
<${groupTag} name="scientists[]">
|
|
332
331
|
<${tag} label="Favorite scientists">
|
|
333
332
|
<${childTag} label="Archimedes"></${childTag}>
|
|
@@ -336,27 +335,27 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
336
335
|
</${tag}>
|
|
337
336
|
</${groupTag}>
|
|
338
337
|
`)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
// Act
|
|
346
|
-
_inputNode.click();
|
|
347
|
-
await elIndeterminate.updateComplete;
|
|
348
|
-
|
|
349
|
-
// Assert
|
|
350
|
-
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
351
|
-
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
352
|
-
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.true;
|
|
353
|
-
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
354
|
-
});
|
|
338
|
+
);
|
|
339
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
340
|
+
el.querySelector(`${cfg.tagString}`)
|
|
341
|
+
);
|
|
342
|
+
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
355
343
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
344
|
+
// Act
|
|
345
|
+
_inputNode.click();
|
|
346
|
+
await elIndeterminate.updateComplete;
|
|
347
|
+
|
|
348
|
+
// Assert
|
|
349
|
+
expect(elIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
350
|
+
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
351
|
+
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.true;
|
|
352
|
+
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('should sync all children when parent is checked (from checked to unchecked)', async () => {
|
|
356
|
+
// Arrange
|
|
357
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
358
|
+
await fixture(html`
|
|
360
359
|
<${groupTag} name="scientists[]">
|
|
361
360
|
<${tag} label="Favorite scientists">
|
|
362
361
|
<${childTag} label="Archimedes" checked></${childTag}>
|
|
@@ -365,27 +364,27 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
365
364
|
</${tag}>
|
|
366
365
|
</${groupTag}>
|
|
367
366
|
`)
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
// Act
|
|
375
|
-
_inputNode.click();
|
|
376
|
-
await elIndeterminate.updateComplete;
|
|
377
|
-
|
|
378
|
-
// Assert
|
|
379
|
-
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
380
|
-
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.false;
|
|
381
|
-
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.false;
|
|
382
|
-
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.false;
|
|
383
|
-
});
|
|
367
|
+
);
|
|
368
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
369
|
+
el.querySelector(`${cfg.tagString}`)
|
|
370
|
+
);
|
|
371
|
+
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
384
372
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
373
|
+
// Act
|
|
374
|
+
_inputNode.click();
|
|
375
|
+
await elIndeterminate.updateComplete;
|
|
376
|
+
|
|
377
|
+
// Assert
|
|
378
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
379
|
+
expect(_subCheckboxes[0].hasAttribute('checked')).to.be.false;
|
|
380
|
+
expect(_subCheckboxes[1].hasAttribute('checked')).to.be.false;
|
|
381
|
+
expect(_subCheckboxes[2].hasAttribute('checked')).to.be.false;
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
it('should work as expected with siblings checkbox-indeterminate', async () => {
|
|
385
|
+
// Arrange
|
|
386
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
387
|
+
await fixture(html`
|
|
389
388
|
<${groupTag} name="scientists[]" label="Favorite scientists">
|
|
390
389
|
<${tag}
|
|
391
390
|
label="Old Greek scientists"
|
|
@@ -420,38 +419,38 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
420
419
|
</${tag}>
|
|
421
420
|
</${groupTag}>
|
|
422
421
|
`)
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
422
|
+
);
|
|
423
|
+
const elFirstIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
424
|
+
el.querySelector('#first-checkbox-indeterminate')
|
|
425
|
+
);
|
|
427
426
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
427
|
+
const elSecondIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
428
|
+
el.querySelector('#second-checkbox-indeterminate')
|
|
429
|
+
);
|
|
431
430
|
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
const elFirstSubCheckboxes = getCheckboxIndeterminateMembers(elFirstIndeterminate);
|
|
432
|
+
const elSecondSubCheckboxes = getCheckboxIndeterminateMembers(elSecondIndeterminate);
|
|
434
433
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
434
|
+
// Act - check the first sibling
|
|
435
|
+
elFirstSubCheckboxes._inputNode.click();
|
|
436
|
+
await elFirstIndeterminate.updateComplete;
|
|
437
|
+
await elSecondIndeterminate.updateComplete;
|
|
439
438
|
|
|
440
|
-
|
|
439
|
+
// Assert - the second sibling should not be affected
|
|
441
440
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
441
|
+
expect(elFirstIndeterminate.hasAttribute('indeterminate')).to.be.false;
|
|
442
|
+
expect(elFirstSubCheckboxes._subCheckboxes[0].hasAttribute('checked')).to.be.true;
|
|
443
|
+
expect(elFirstSubCheckboxes._subCheckboxes[1].hasAttribute('checked')).to.be.true;
|
|
444
|
+
expect(elFirstSubCheckboxes._subCheckboxes[2].hasAttribute('checked')).to.be.true;
|
|
446
445
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
446
|
+
expect(elSecondSubCheckboxes._subCheckboxes[0].hasAttribute('checked')).to.be.false;
|
|
447
|
+
expect(elSecondSubCheckboxes._subCheckboxes[1].hasAttribute('checked')).to.be.false;
|
|
448
|
+
});
|
|
450
449
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
450
|
+
it('should work as expected with nested indeterminate checkboxes', async () => {
|
|
451
|
+
// Arrange
|
|
452
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
453
|
+
await fixture(html`
|
|
455
454
|
<${groupTag} name="scientists[]" label="Favorite scientists">
|
|
456
455
|
<${tag} label="Scientists" id="parent-checkbox-indeterminate">
|
|
457
456
|
<${childTag}
|
|
@@ -484,62 +483,62 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
484
483
|
</${tag}>
|
|
485
484
|
</${groupTag}>
|
|
486
485
|
`)
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
// @ts-ignore [allow-protected] in test
|
|
510
|
-
if (elNestedIndeterminate) elNestedSubCheckboxes._subCheckboxes[1]._inputNode.click();
|
|
511
|
-
// @ts-ignore [allow-protected] in test
|
|
512
|
-
if (elNestedIndeterminate) elNestedSubCheckboxes._subCheckboxes[2]._inputNode.click();
|
|
513
|
-
await el.updateComplete;
|
|
514
|
-
|
|
515
|
-
// Assert
|
|
516
|
-
expect(elNestedIndeterminate?.hasAttribute('checked')).to.be.true;
|
|
517
|
-
expect(elNestedIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
518
|
-
expect(elParentIndeterminate?.hasAttribute('checked')).to.be.false;
|
|
519
|
-
expect(elParentIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
520
|
-
|
|
521
|
-
// Act - finally check all remaining checkbox
|
|
522
|
-
if (elParentIndeterminate) {
|
|
486
|
+
);
|
|
487
|
+
const elNestedIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
488
|
+
el.querySelector('#nested-checkbox-indeterminate')
|
|
489
|
+
);
|
|
490
|
+
const elParentIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
491
|
+
el.querySelector('#parent-checkbox-indeterminate')
|
|
492
|
+
);
|
|
493
|
+
const elNestedSubCheckboxes = getCheckboxIndeterminateMembers(elNestedIndeterminate);
|
|
494
|
+
const elParentSubCheckboxes = getCheckboxIndeterminateMembers(elParentIndeterminate);
|
|
495
|
+
|
|
496
|
+
// Act - check a nested checkbox
|
|
497
|
+
if (elNestedIndeterminate) {
|
|
498
|
+
// @ts-ignore [allow-protected] in test
|
|
499
|
+
elNestedSubCheckboxes._subCheckboxes[0]._inputNode.click();
|
|
500
|
+
}
|
|
501
|
+
await el.updateComplete;
|
|
502
|
+
|
|
503
|
+
// Assert
|
|
504
|
+
expect(elNestedIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
505
|
+
expect(elParentIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
506
|
+
|
|
507
|
+
// Act - check all nested checkbox
|
|
523
508
|
// @ts-ignore [allow-protected] in test
|
|
524
|
-
|
|
525
|
-
}
|
|
526
|
-
if (elParentIndeterminate) {
|
|
509
|
+
if (elNestedIndeterminate) elNestedSubCheckboxes._subCheckboxes[1]._inputNode.click();
|
|
527
510
|
// @ts-ignore [allow-protected] in test
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
await el.updateComplete;
|
|
531
|
-
|
|
532
|
-
// Assert
|
|
533
|
-
expect(elNestedIndeterminate?.hasAttribute('checked')).to.be.true;
|
|
534
|
-
expect(elNestedIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
535
|
-
expect(elParentIndeterminate?.hasAttribute('checked')).to.be.true;
|
|
536
|
-
expect(elParentIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
537
|
-
});
|
|
511
|
+
if (elNestedIndeterminate) elNestedSubCheckboxes._subCheckboxes[2]._inputNode.click();
|
|
512
|
+
await el.updateComplete;
|
|
538
513
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
514
|
+
// Assert
|
|
515
|
+
expect(elNestedIndeterminate?.hasAttribute('checked')).to.be.true;
|
|
516
|
+
expect(elNestedIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
517
|
+
expect(elParentIndeterminate?.hasAttribute('checked')).to.be.false;
|
|
518
|
+
expect(elParentIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
519
|
+
|
|
520
|
+
// Act - finally check all remaining checkbox
|
|
521
|
+
if (elParentIndeterminate) {
|
|
522
|
+
// @ts-ignore [allow-protected] in test
|
|
523
|
+
elParentSubCheckboxes._subCheckboxes[0]._inputNode.click();
|
|
524
|
+
}
|
|
525
|
+
if (elParentIndeterminate) {
|
|
526
|
+
// @ts-ignore [allow-protected] in test
|
|
527
|
+
elParentSubCheckboxes._subCheckboxes[1]._inputNode.click();
|
|
528
|
+
}
|
|
529
|
+
await el.updateComplete;
|
|
530
|
+
|
|
531
|
+
// Assert
|
|
532
|
+
expect(elNestedIndeterminate?.hasAttribute('checked')).to.be.true;
|
|
533
|
+
expect(elNestedIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
534
|
+
expect(elParentIndeterminate?.hasAttribute('checked')).to.be.true;
|
|
535
|
+
expect(elParentIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
it('should work as expected if extra html', async () => {
|
|
539
|
+
// Arrange
|
|
540
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
541
|
+
await fixture(html`
|
|
543
542
|
<${groupTag} name="scientists[]">
|
|
544
543
|
<div>
|
|
545
544
|
Let's have some fun
|
|
@@ -555,27 +554,27 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
555
554
|
<div>Too much fun, stop it !</div>
|
|
556
555
|
</${groupTag}>
|
|
557
556
|
`)
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
// Act
|
|
565
|
-
_subCheckboxes[0].checked = true;
|
|
566
|
-
_subCheckboxes[1].checked = true;
|
|
567
|
-
_subCheckboxes[2].checked = true;
|
|
568
|
-
await el.updateComplete;
|
|
569
|
-
|
|
570
|
-
// Assert
|
|
571
|
-
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
572
|
-
expect(elIndeterminate?.checked).to.be.true;
|
|
573
|
-
});
|
|
557
|
+
);
|
|
558
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
559
|
+
el.querySelector(`${cfg.tagString}`)
|
|
560
|
+
);
|
|
561
|
+
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
574
562
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
563
|
+
// Act
|
|
564
|
+
_subCheckboxes[0].checked = true;
|
|
565
|
+
_subCheckboxes[1].checked = true;
|
|
566
|
+
_subCheckboxes[2].checked = true;
|
|
567
|
+
await el.updateComplete;
|
|
568
|
+
|
|
569
|
+
// Assert
|
|
570
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
571
|
+
expect(elIndeterminate?.checked).to.be.true;
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// https://www.w3.org/TR/wai-aria-practices-1.1/examples/checkbox/checkbox-2/checkbox-2.html
|
|
575
|
+
describe('mixed-state', () => {
|
|
576
|
+
it('can have a mixed-state (using mixed-state attribute), none -> indeterminate -> all, cycling through', async () => {
|
|
577
|
+
const el = await fixture(html`
|
|
579
578
|
<${groupTag} name="scientists[]">
|
|
580
579
|
<${tag} mixed-state label="Favorite scientists">
|
|
581
580
|
<${childTag} label="Archimedes" checked></${childTag}>
|
|
@@ -584,35 +583,35 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
584
583
|
</${tag}>
|
|
585
584
|
</${groupTag}>
|
|
586
585
|
`);
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
586
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
587
|
+
el.querySelector(`${cfg.tagString}`)
|
|
588
|
+
);
|
|
590
589
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
590
|
+
expect(elIndeterminate.mixedState).to.be.true;
|
|
591
|
+
expect(elIndeterminate.checked).to.be.false;
|
|
592
|
+
expect(elIndeterminate.indeterminate).to.be.true;
|
|
594
593
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
594
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
595
|
+
elIndeterminate._inputNode.click();
|
|
596
|
+
await elIndeterminate.updateComplete;
|
|
597
|
+
expect(elIndeterminate.checked).to.be.true;
|
|
598
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
600
599
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
600
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
601
|
+
elIndeterminate._inputNode.click();
|
|
602
|
+
await elIndeterminate.updateComplete;
|
|
603
|
+
expect(elIndeterminate.checked).to.be.false;
|
|
604
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
606
605
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
606
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
607
|
+
elIndeterminate._inputNode.click();
|
|
608
|
+
await elIndeterminate.updateComplete;
|
|
609
|
+
expect(elIndeterminate.checked).to.be.false;
|
|
610
|
+
expect(elIndeterminate.indeterminate).to.be.true;
|
|
611
|
+
});
|
|
613
612
|
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
it('should reset to old child checkbox states when reaching indeterminate state', async () => {
|
|
614
|
+
const el = await fixture(html`
|
|
616
615
|
<${groupTag} name="scientists[]">
|
|
617
616
|
<${tag} mixed-state label="Favorite scientists">
|
|
618
617
|
<${childTag} label="Archimedes" checked></${childTag}>
|
|
@@ -621,33 +620,33 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
621
620
|
</${tag}>
|
|
622
621
|
</${groupTag}>
|
|
623
622
|
`);
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
624
|
+
el.querySelector(`${cfg.tagString}`)
|
|
625
|
+
);
|
|
626
|
+
const checkboxEls = /** @type {LionCheckbox[]} */ (
|
|
627
|
+
Array.from(el.querySelectorAll(`${cfg.childTagString}`))
|
|
628
|
+
);
|
|
630
629
|
|
|
631
|
-
|
|
630
|
+
expect(checkboxEls.map(checkboxEl => checkboxEl.checked)).to.eql([true, false, false]);
|
|
632
631
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
632
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
633
|
+
elIndeterminate._inputNode.click();
|
|
634
|
+
await elIndeterminate.updateComplete;
|
|
635
|
+
expect(checkboxEls.map(checkboxEl => checkboxEl.checked)).to.eql([true, true, true]);
|
|
637
636
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
637
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
638
|
+
elIndeterminate._inputNode.click();
|
|
639
|
+
await elIndeterminate.updateComplete;
|
|
640
|
+
expect(checkboxEls.map(checkboxEl => checkboxEl.checked)).to.eql([false, false, false]);
|
|
642
641
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
642
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
643
|
+
elIndeterminate._inputNode.click();
|
|
644
|
+
await elIndeterminate.updateComplete;
|
|
645
|
+
expect(checkboxEls.map(checkboxEl => checkboxEl.checked)).to.eql([true, false, false]);
|
|
646
|
+
});
|
|
648
647
|
|
|
649
|
-
|
|
650
|
-
|
|
648
|
+
it('should no longer reach indeterminate state if the child boxes are all checked or all unchecked during indeterminate state', async () => {
|
|
649
|
+
const el = await fixture(html`
|
|
651
650
|
<${groupTag} name="scientists[]">
|
|
652
651
|
<${tag} mixed-state label="Favorite scientists">
|
|
653
652
|
<${childTag} label="Archimedes" checked></${childTag}>
|
|
@@ -656,67 +655,107 @@ export function runCheckboxIndeterminateSuite(customConfig) {
|
|
|
656
655
|
</${tag}>
|
|
657
656
|
</${groupTag}>
|
|
658
657
|
`);
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
658
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
659
|
+
el.querySelector(`${cfg.tagString}`)
|
|
660
|
+
);
|
|
661
|
+
const checkboxEls = /** @type {LionCheckbox[]} */ (
|
|
662
|
+
Array.from(el.querySelectorAll(`${cfg.childTagString}`))
|
|
663
|
+
);
|
|
665
664
|
|
|
666
|
-
|
|
667
|
-
|
|
665
|
+
// Check when all child boxes in indeterminate state are unchecked
|
|
666
|
+
// we don't have a tri-state, but a duo-state.
|
|
668
667
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
668
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
669
|
+
checkboxEls[0]._inputNode.click();
|
|
670
|
+
await elIndeterminate.updateComplete;
|
|
672
671
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
672
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
673
|
+
elIndeterminate._inputNode.click();
|
|
674
|
+
await elIndeterminate.updateComplete;
|
|
675
|
+
expect(elIndeterminate.checked).to.be.true;
|
|
676
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
678
677
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
678
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
679
|
+
elIndeterminate._inputNode.click();
|
|
680
|
+
await elIndeterminate.updateComplete;
|
|
681
|
+
expect(elIndeterminate.checked).to.be.false;
|
|
682
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
684
683
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
684
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
685
|
+
elIndeterminate._inputNode.click();
|
|
686
|
+
await elIndeterminate.updateComplete;
|
|
687
|
+
expect(elIndeterminate.checked).to.be.true;
|
|
688
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
690
689
|
|
|
691
|
-
|
|
692
|
-
|
|
690
|
+
// Check when all child boxes in indeterminate state are getting checked
|
|
691
|
+
// we also don't have a tri-state, but a duo-state.
|
|
693
692
|
|
|
694
|
-
// @ts-ignore for testing purposes, we access this protected getter
|
|
695
|
-
elIndeterminate._inputNode.click(); // unchecked
|
|
696
|
-
await elIndeterminate.updateComplete;
|
|
697
|
-
for (const checkEl of checkboxEls) {
|
|
698
693
|
// @ts-ignore for testing purposes, we access this protected getter
|
|
699
|
-
|
|
700
|
-
// Give each checking of the sub checkbox a chance to finish updating
|
|
701
|
-
// This means indeterminate state will be true for a bit and the state gets stored
|
|
702
|
-
await checkEl.updateComplete;
|
|
694
|
+
elIndeterminate._inputNode.click(); // unchecked
|
|
703
695
|
await elIndeterminate.updateComplete;
|
|
704
|
-
|
|
696
|
+
for (const checkEl of checkboxEls) {
|
|
697
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
698
|
+
checkEl._inputNode.click();
|
|
699
|
+
// Give each checking of the sub checkbox a chance to finish updating
|
|
700
|
+
// This means indeterminate state will be true for a bit and the state gets stored
|
|
701
|
+
await checkEl.updateComplete;
|
|
702
|
+
await elIndeterminate.updateComplete;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
expect(elIndeterminate.checked).to.be.true;
|
|
706
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
705
707
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
709
|
+
elIndeterminate._inputNode.click();
|
|
710
|
+
await elIndeterminate.updateComplete;
|
|
711
|
+
expect(elIndeterminate.checked).to.be.false;
|
|
712
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
708
713
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
+
// @ts-ignore for testing purposes, we access this protected getter
|
|
715
|
+
elIndeterminate._inputNode.click();
|
|
716
|
+
await elIndeterminate.updateComplete;
|
|
717
|
+
expect(elIndeterminate.checked).to.be.true;
|
|
718
|
+
expect(elIndeterminate.indeterminate).to.be.false;
|
|
719
|
+
});
|
|
720
|
+
});
|
|
714
721
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
722
|
+
describe('accessibility', () => {
|
|
723
|
+
it('is accessible', async () => {
|
|
724
|
+
const el = /** @type {LionCheckboxGroup} */ (
|
|
725
|
+
await fixture(html`
|
|
726
|
+
<${groupTag} name="scientists[]">
|
|
727
|
+
<${tag} label="Favorite scientists">
|
|
728
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
729
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
730
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
731
|
+
</${tag}>
|
|
732
|
+
</${groupTag}>
|
|
733
|
+
`)
|
|
734
|
+
);
|
|
735
|
+
await expect(el).to.be.accessible();
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
it('has role="list" and its children role="listitem"', async () => {
|
|
739
|
+
const el = await fixture(html`
|
|
740
|
+
<${groupTag} name="scientists[]">
|
|
741
|
+
<${tag} label="Favorite scientists">
|
|
742
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
743
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
744
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
745
|
+
</${tag}>
|
|
746
|
+
</${groupTag}>
|
|
747
|
+
`);
|
|
748
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
749
|
+
el.querySelector(`${cfg.tagString}`)
|
|
750
|
+
);
|
|
751
|
+
|
|
752
|
+
expect(
|
|
753
|
+
elIndeterminate.shadowRoot
|
|
754
|
+
?.querySelector('.choice-field__nested-checkboxes')
|
|
755
|
+
?.getAttribute('role'),
|
|
756
|
+
).to.equal('list');
|
|
757
|
+
expect(elIndeterminate.children[0].getAttribute('role')).to.equal('listitem');
|
|
758
|
+
});
|
|
720
759
|
});
|
|
721
760
|
});
|
|
722
761
|
}
|