@lion/ui 0.3.0 → 0.3.1
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 +2 -2
- package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +6 -0
- package/components/checkbox-group/{test/lion-checkbox-indeterminate.test.js → test-suites/CheckboxIndeterminate.suite.js} +209 -187
- package/components/combobox/src/LionCombobox.js +3 -1
- package/components/combobox/test/lion-combobox.test.js +52 -0
- package/components/listbox/src/ListboxMixin.js +3 -2
- package/components/listbox/test-suites/ListboxMixin.suite.js +31 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.js +22 -0
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.js +64 -0
- package/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.js +13 -7
- package/components/localize/test/number/formatNumber.test.js +6 -28
- package/custom-elements.json +358 -201
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts +12 -0
- package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts.map +1 -0
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/combobox/test/lion-combobox.test.d.ts.map +1 -1
- package/dist-types/components/listbox/src/ListboxMixin.d.ts.map +1 -1
- package/dist-types/components/listbox/test-suites/ListboxMixin.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.d.ts +14 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceNoSpaceBetweenCurrencySymbolAndNumber.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts +20 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceSymbols.d.ts.map +1 -0
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/normalizeIntl.d.ts.map +1 -1
- package/dist-types/exports/checkbox-group-test-suites.d.ts +2 -0
- package/dist-types/exports/checkbox-group-test-suites.d.ts.map +1 -0
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +9 -10
- package/docs/components/checkbox-group/use-cases.md +110 -142
- 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/form/overview.md +3 -3
- 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 +2 -2
- package/docs/components/input-stepper/overview.md +1 -1
- 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/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/how-to/get-started.md +28 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/exports/checkbox-group-test-suites.js +1 -0
- package/package.json +1 -1
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.js +0 -25
- package/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.js +0 -15
- package/dist-types/components/checkbox-group/test/lion-checkbox-indeterminate.test.d.ts +0 -4
- package/dist-types/components/checkbox-group/test/lion-checkbox-indeterminate.test.d.ts.map +0 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.d.ts +0 -14
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceENAUSymbols.d.ts.map +0 -1
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.d.ts +0 -9
- package/dist-types/components/localize/src/number/utils/normalize-format-number-to-parts/forceYenSymbol.d.ts.map +0 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { expect, fixture } from '@open-wc/testing';
|
|
2
|
-
import { html } from 'lit/static-html.js';
|
|
1
|
+
import { expect, fixture, html, unsafeStatic } from '@open-wc/testing';
|
|
3
2
|
import { getFormControlMembers } from '@lion/ui/form-core-test-helpers.js';
|
|
4
|
-
import '@lion/ui/define/lion-checkbox.js';
|
|
5
|
-
import '@lion/ui/define/lion-checkbox-group.js';
|
|
6
|
-
import '@lion/ui/define/lion-checkbox-indeterminate.js';
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* @typedef {import('../src/LionCheckbox.js').LionCheckbox} LionCheckbox
|
|
@@ -25,54 +21,81 @@ function getCheckboxIndeterminateMembers(el) {
|
|
|
25
21
|
};
|
|
26
22
|
}
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
/**
|
|
25
|
+
* @param {{tagString?: string, groupTagString?: string, childTagString?: string}} [customConfig]
|
|
26
|
+
*/
|
|
27
|
+
export function runCheckboxIndeterminateSuite(customConfig) {
|
|
28
|
+
const cfg = {
|
|
29
|
+
tagString: null,
|
|
30
|
+
groupTagString: null,
|
|
31
|
+
childTagString: null,
|
|
32
|
+
...customConfig,
|
|
33
|
+
};
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
/** @type {{_$litStatic$: any}} */
|
|
36
|
+
let tag;
|
|
37
|
+
/** @type {{_$litStatic$: any}} */
|
|
38
|
+
let groupTag;
|
|
39
|
+
/** @type {{_$litStatic$: any}} */
|
|
40
|
+
let childTag;
|
|
41
|
+
|
|
42
|
+
before(async () => {
|
|
43
|
+
tag = unsafeStatic(cfg.tagString);
|
|
44
|
+
groupTag = unsafeStatic(cfg.groupTagString);
|
|
45
|
+
childTag = unsafeStatic(cfg.childTagString);
|
|
40
46
|
});
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const el = await fixture(html`
|
|
45
|
-
<lion-checkbox-group name="scientists[]">
|
|
46
|
-
<lion-checkbox-indeterminate label="Favorite scientists">
|
|
47
|
-
<lion-checkbox slot="checkbox" label="Archimedes"></lion-checkbox>
|
|
48
|
-
<lion-checkbox slot="checkbox" label="Francis Bacon"></lion-checkbox>
|
|
49
|
-
<lion-checkbox slot="checkbox" label="Marie Curie"></lion-checkbox>
|
|
50
|
-
</lion-checkbox-indeterminate>
|
|
51
|
-
</lion-checkbox-group>
|
|
52
|
-
`);
|
|
53
|
-
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
54
|
-
el.querySelector('lion-checkbox-indeterminate')
|
|
55
|
-
);
|
|
48
|
+
describe('CheckboxIndeterminate', async () => {
|
|
49
|
+
/** @type {{_$litStatic$: any}} */
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
it('should have type = checkbox', async () => {
|
|
52
|
+
// Arrange
|
|
53
|
+
const el = await fixture(html`
|
|
54
|
+
<${tag}
|
|
55
|
+
name="checkbox"
|
|
56
|
+
.choiceValue="${'male'}"
|
|
57
|
+
></${tag}>
|
|
58
|
+
`);
|
|
59
|
+
|
|
60
|
+
// Assert
|
|
61
|
+
expect(el.getAttribute('type')).to.equal('checkbox');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should not be indeterminate by default if all children are unchecked', async () => {
|
|
65
|
+
// Arrange
|
|
66
|
+
const el = await fixture(html`
|
|
67
|
+
<${groupTag} name="scientists[]">
|
|
68
|
+
<${tag} label="Favorite scientists">
|
|
69
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
70
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
71
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
72
|
+
</${tag}>
|
|
73
|
+
</${groupTag}>
|
|
74
|
+
`);
|
|
75
|
+
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
76
|
+
el.querySelector(`${cfg.tagString}`)
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// Assert
|
|
80
|
+
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.false;
|
|
81
|
+
});
|
|
59
82
|
});
|
|
60
83
|
|
|
61
84
|
it('should be indeterminate if one child is checked', async () => {
|
|
62
85
|
// Arrange
|
|
63
86
|
const el = /** @type {LionCheckboxGroup} */ await fixture(html`
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
<${groupTag} name="scientists[]">
|
|
88
|
+
<${tag} label="Favorite scientists">
|
|
89
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
90
|
+
<${childTag} label="Francis Bacon" checked></${childTag}>
|
|
91
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
92
|
+
</${tag}>
|
|
93
|
+
</${groupTag}>
|
|
71
94
|
`);
|
|
95
|
+
|
|
72
96
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
73
|
-
el.querySelector(
|
|
97
|
+
el.querySelector(`${cfg.tagString}`)
|
|
74
98
|
);
|
|
75
|
-
|
|
76
99
|
// Assert
|
|
77
100
|
expect(elIndeterminate?.hasAttribute('indeterminate')).to.be.true;
|
|
78
101
|
});
|
|
@@ -81,17 +104,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
81
104
|
// Arrange
|
|
82
105
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
83
106
|
await fixture(html`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
<${groupTag} name="scientists[]">
|
|
108
|
+
<${tag} label="Favorite scientists">
|
|
109
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
110
|
+
<${childTag} label="Francis Bacon" checked></${childTag}>
|
|
111
|
+
<${childTag} label="Marie Curie" checked></${childTag}>
|
|
112
|
+
</${tag}>
|
|
113
|
+
</${groupTag}>
|
|
91
114
|
`)
|
|
92
115
|
);
|
|
93
116
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
94
|
-
el.querySelector(
|
|
117
|
+
el.querySelector(`${cfg.tagString}`)
|
|
95
118
|
);
|
|
96
119
|
|
|
97
120
|
// Assert
|
|
@@ -103,17 +126,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
103
126
|
// Arrange
|
|
104
127
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
105
128
|
await fixture(html`
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
129
|
+
<${groupTag} name="scientists[]">
|
|
130
|
+
<${tag} label="Favorite scientists">
|
|
131
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
132
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
133
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
134
|
+
</${tag}>
|
|
135
|
+
</${groupTag}>
|
|
113
136
|
`)
|
|
114
137
|
);
|
|
115
138
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
116
|
-
el.querySelector(
|
|
139
|
+
el.querySelector(`${cfg.tagString}`)
|
|
117
140
|
);
|
|
118
141
|
|
|
119
142
|
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
@@ -130,17 +153,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
130
153
|
// Arrange
|
|
131
154
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
132
155
|
await fixture(html`
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
156
|
+
<${groupTag} name="scientists[]">
|
|
157
|
+
<${tag} label="Favorite scientists">
|
|
158
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
159
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
160
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
161
|
+
</${tag}>
|
|
162
|
+
</${groupTag}>
|
|
140
163
|
`)
|
|
141
164
|
);
|
|
142
165
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
143
|
-
el.querySelector(
|
|
166
|
+
el.querySelector(`${cfg.tagString}`)
|
|
144
167
|
);
|
|
145
168
|
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
146
169
|
|
|
@@ -159,17 +182,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
159
182
|
// Arrange
|
|
160
183
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
161
184
|
await fixture(html`
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
185
|
+
<${groupTag} name="scientists[]">
|
|
186
|
+
<${tag} label="Favorite scientists">
|
|
187
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
188
|
+
<${childTag} label="Francis Bacon" disabled></${childTag}>
|
|
189
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
190
|
+
</${tag}>
|
|
191
|
+
</${groupTag}>
|
|
169
192
|
`)
|
|
170
193
|
);
|
|
171
194
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
172
|
-
el.querySelector(
|
|
195
|
+
el.querySelector(`${cfg.tagString}`)
|
|
173
196
|
);
|
|
174
197
|
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
175
198
|
|
|
@@ -187,17 +210,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
187
210
|
// Arrange
|
|
188
211
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
189
212
|
await fixture(html`
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
213
|
+
<${groupTag} name="scientists[]">
|
|
214
|
+
<${tag} label="Favorite scientists">
|
|
215
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
216
|
+
<${childTag} label="Francis Bacon" checked></${childTag}>
|
|
217
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
218
|
+
</${tag}>
|
|
219
|
+
</${groupTag}>
|
|
197
220
|
`)
|
|
198
221
|
);
|
|
199
222
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
200
|
-
el.querySelector(
|
|
223
|
+
el.querySelector(`${cfg.tagString}`)
|
|
201
224
|
);
|
|
202
225
|
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
203
226
|
|
|
@@ -216,17 +239,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
216
239
|
// Arrange
|
|
217
240
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
218
241
|
await fixture(html`
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
242
|
+
<${groupTag} name="scientists[]">
|
|
243
|
+
<${tag} label="Favorite scientists">
|
|
244
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
245
|
+
<${childTag} label="Francis Bacon" disabled></${childTag}>
|
|
246
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
247
|
+
</${tag}>
|
|
248
|
+
</${groupTag}>
|
|
226
249
|
`)
|
|
227
250
|
);
|
|
228
251
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
229
|
-
el.querySelector(
|
|
252
|
+
el.querySelector(`${cfg.tagString}`)
|
|
230
253
|
);
|
|
231
254
|
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
232
255
|
|
|
@@ -245,17 +268,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
245
268
|
// Arrange
|
|
246
269
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
247
270
|
await fixture(html`
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
271
|
+
<${groupTag} name="scientists[]">
|
|
272
|
+
<${tag} label="Favorite scientists">
|
|
273
|
+
<${childTag} label="Archimedes" disabled></${childTag}>
|
|
274
|
+
<${childTag} label="Francis Bacon" disabled></${childTag}>
|
|
275
|
+
<${childTag} label="Marie Curie" disabled></${childTag}>
|
|
276
|
+
</${tag}>
|
|
277
|
+
</${groupTag}>
|
|
255
278
|
`)
|
|
256
279
|
);
|
|
257
280
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
258
|
-
el.querySelector(
|
|
281
|
+
el.querySelector(`${cfg.tagString}`)
|
|
259
282
|
);
|
|
260
283
|
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
261
284
|
|
|
@@ -275,17 +298,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
275
298
|
// Arrange
|
|
276
299
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
277
300
|
await fixture(html`
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
301
|
+
<${groupTag} name="scientists[]">
|
|
302
|
+
<${tag} label="Favorite scientists">
|
|
303
|
+
<${childTag} label="Archimedes" disabled checked></${childTag}>
|
|
304
|
+
<${childTag} label="Francis Bacon" disabled checked></${childTag}>
|
|
305
|
+
<${childTag} label="Marie Curie" disabled checked></${childTag}>
|
|
306
|
+
</${tag}>
|
|
307
|
+
</${groupTag}>
|
|
285
308
|
`)
|
|
286
309
|
);
|
|
287
310
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
288
|
-
el.querySelector(
|
|
311
|
+
el.querySelector(`${cfg.tagString}`)
|
|
289
312
|
);
|
|
290
313
|
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
291
314
|
|
|
@@ -305,17 +328,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
305
328
|
// Arrange
|
|
306
329
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
307
330
|
await fixture(html`
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
331
|
+
<${groupTag} name="scientists[]">
|
|
332
|
+
<${tag} label="Favorite scientists">
|
|
333
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
334
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
335
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
336
|
+
</${tag}>
|
|
337
|
+
</${groupTag}>
|
|
315
338
|
`)
|
|
316
339
|
);
|
|
317
340
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
318
|
-
el.querySelector(
|
|
341
|
+
el.querySelector(`${cfg.tagString}`)
|
|
319
342
|
);
|
|
320
343
|
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
321
344
|
|
|
@@ -334,17 +357,17 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
334
357
|
// Arrange
|
|
335
358
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
336
359
|
await fixture(html`
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
360
|
+
<${groupTag} name="scientists[]">
|
|
361
|
+
<${tag} label="Favorite scientists">
|
|
362
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
363
|
+
<${childTag} label="Francis Bacon" checked></${childTag}>
|
|
364
|
+
<${childTag} label="Marie Curie" checked></${childTag}>
|
|
365
|
+
</${tag}>
|
|
366
|
+
</${groupTag}>
|
|
344
367
|
`)
|
|
345
368
|
);
|
|
346
369
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
347
|
-
el.querySelector(
|
|
370
|
+
el.querySelector(`${cfg.tagString}`)
|
|
348
371
|
);
|
|
349
372
|
const { _subCheckboxes, _inputNode } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
350
373
|
|
|
@@ -363,39 +386,39 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
363
386
|
// Arrange
|
|
364
387
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
365
388
|
await fixture(html`
|
|
366
|
-
|
|
367
|
-
|
|
389
|
+
<${groupTag} name="scientists[]" label="Favorite scientists">
|
|
390
|
+
<${tag}
|
|
368
391
|
label="Old Greek scientists"
|
|
369
392
|
id="first-checkbox-indeterminate"
|
|
370
393
|
>
|
|
371
|
-
|
|
394
|
+
<${childTag}
|
|
372
395
|
slot="checkbox"
|
|
373
396
|
label="Archimedes"
|
|
374
397
|
.choiceValue=${'Archimedes'}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
398
|
+
></${childTag}>
|
|
399
|
+
<${childTag} label="Plato" .choiceValue=${'Plato'}></${childTag}>
|
|
400
|
+
<${childTag}
|
|
378
401
|
slot="checkbox"
|
|
379
402
|
label="Pythagoras"
|
|
380
403
|
.choiceValue=${'Pythagoras'}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
404
|
+
></${childTag}>
|
|
405
|
+
</${tag}>
|
|
406
|
+
<${tag}
|
|
384
407
|
label="17th Century scientists"
|
|
385
408
|
id="second-checkbox-indeterminate"
|
|
386
409
|
>
|
|
387
|
-
|
|
410
|
+
<${childTag}
|
|
388
411
|
slot="checkbox"
|
|
389
412
|
label="Isaac Newton"
|
|
390
413
|
.choiceValue=${'Isaac Newton'}
|
|
391
|
-
|
|
392
|
-
|
|
414
|
+
></${childTag}>
|
|
415
|
+
<${childTag}
|
|
393
416
|
slot="checkbox"
|
|
394
417
|
label="Galileo Galilei"
|
|
395
418
|
.choiceValue=${'Galileo Galilei'}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
419
|
+
></${childTag}>
|
|
420
|
+
</${tag}>
|
|
421
|
+
</${groupTag}>
|
|
399
422
|
`)
|
|
400
423
|
);
|
|
401
424
|
const elFirstIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
@@ -429,37 +452,37 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
429
452
|
// Arrange
|
|
430
453
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
431
454
|
await fixture(html`
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
455
|
+
<${groupTag} name="scientists[]" label="Favorite scientists">
|
|
456
|
+
<${tag} label="Scientists" id="parent-checkbox-indeterminate">
|
|
457
|
+
<${childTag}
|
|
435
458
|
slot="checkbox"
|
|
436
459
|
label="Isaac Newton"
|
|
437
460
|
.choiceValue=${'Isaac Newton'}
|
|
438
|
-
|
|
439
|
-
|
|
461
|
+
></${childTag}>
|
|
462
|
+
<${childTag}
|
|
440
463
|
slot="checkbox"
|
|
441
464
|
label="Galileo Galilei"
|
|
442
465
|
.choiceValue=${'Galileo Galilei'}
|
|
443
|
-
|
|
444
|
-
|
|
466
|
+
></${childTag}>
|
|
467
|
+
<${tag}
|
|
445
468
|
slot="checkbox"
|
|
446
469
|
label="Old Greek scientists"
|
|
447
470
|
id="nested-checkbox-indeterminate"
|
|
448
471
|
>
|
|
449
|
-
|
|
472
|
+
<${childTag}
|
|
450
473
|
slot="checkbox"
|
|
451
474
|
label="Archimedes"
|
|
452
475
|
.choiceValue=${'Archimedes'}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
476
|
+
></${childTag}>
|
|
477
|
+
<${childTag} label="Plato" .choiceValue=${'Plato'}></${childTag}>
|
|
478
|
+
<${childTag}
|
|
456
479
|
slot="checkbox"
|
|
457
480
|
label="Pythagoras"
|
|
458
481
|
.choiceValue=${'Pythagoras'}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
482
|
+
></${childTag}>
|
|
483
|
+
</${tag}>
|
|
484
|
+
</${tag}>
|
|
485
|
+
</${groupTag}>
|
|
463
486
|
`)
|
|
464
487
|
);
|
|
465
488
|
const elNestedIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
@@ -517,24 +540,24 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
517
540
|
// Arrange
|
|
518
541
|
const el = /** @type {LionCheckboxGroup} */ (
|
|
519
542
|
await fixture(html`
|
|
520
|
-
|
|
543
|
+
<${groupTag} name="scientists[]">
|
|
521
544
|
<div>
|
|
522
545
|
Let's have some fun
|
|
523
546
|
<div>Hello I'm a div</div>
|
|
524
|
-
|
|
547
|
+
<${tag} label="Favorite scientists">
|
|
525
548
|
<div>useless div</div>
|
|
526
|
-
|
|
527
|
-
|
|
549
|
+
<${childTag} label="Archimedes"></${childTag}>
|
|
550
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
528
551
|
<div>absolutely useless</div>
|
|
529
|
-
|
|
530
|
-
|
|
552
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
553
|
+
</${tag}>
|
|
531
554
|
</div>
|
|
532
555
|
<div>Too much fun, stop it !</div>
|
|
533
|
-
|
|
556
|
+
</${groupTag}>
|
|
534
557
|
`)
|
|
535
558
|
);
|
|
536
559
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
537
|
-
el.querySelector(
|
|
560
|
+
el.querySelector(`${cfg.tagString}`)
|
|
538
561
|
);
|
|
539
562
|
const { _subCheckboxes } = getCheckboxIndeterminateMembers(elIndeterminate);
|
|
540
563
|
|
|
@@ -553,16 +576,16 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
553
576
|
describe('mixed-state', () => {
|
|
554
577
|
it('can have a mixed-state (using mixed-state attribute), none -> indeterminate -> all, cycling through', async () => {
|
|
555
578
|
const el = await fixture(html`
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
579
|
+
<${groupTag} name="scientists[]">
|
|
580
|
+
<${tag} mixed-state label="Favorite scientists">
|
|
581
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
582
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
583
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
584
|
+
</${tag}>
|
|
585
|
+
</${groupTag}>
|
|
563
586
|
`);
|
|
564
587
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
565
|
-
el.querySelector(
|
|
588
|
+
el.querySelector(`${cfg.tagString}`)
|
|
566
589
|
);
|
|
567
590
|
|
|
568
591
|
expect(elIndeterminate.mixedState).to.be.true;
|
|
@@ -590,19 +613,19 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
590
613
|
|
|
591
614
|
it('should reset to old child checkbox states when reaching indeterminate state', async () => {
|
|
592
615
|
const el = await fixture(html`
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
616
|
+
<${groupTag} name="scientists[]">
|
|
617
|
+
<${tag} mixed-state label="Favorite scientists">
|
|
618
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
619
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
620
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
621
|
+
</${tag}>
|
|
622
|
+
</${groupTag}>
|
|
600
623
|
`);
|
|
601
624
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
602
|
-
el.querySelector(
|
|
625
|
+
el.querySelector(`${cfg.tagString}`)
|
|
603
626
|
);
|
|
604
627
|
const checkboxEls = /** @type {LionCheckbox[]} */ (
|
|
605
|
-
Array.from(el.querySelectorAll(
|
|
628
|
+
Array.from(el.querySelectorAll(`${cfg.childTagString}`))
|
|
606
629
|
);
|
|
607
630
|
|
|
608
631
|
expect(checkboxEls.map(checkboxEl => checkboxEl.checked)).to.eql([true, false, false]);
|
|
@@ -625,19 +648,19 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
625
648
|
|
|
626
649
|
it('should no longer reach indeterminate state if the child boxes are all checked or all unchecked during indeterminate state', async () => {
|
|
627
650
|
const el = await fixture(html`
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
651
|
+
<${groupTag} name="scientists[]">
|
|
652
|
+
<${tag} mixed-state label="Favorite scientists">
|
|
653
|
+
<${childTag} label="Archimedes" checked></${childTag}>
|
|
654
|
+
<${childTag} label="Francis Bacon"></${childTag}>
|
|
655
|
+
<${childTag} label="Marie Curie"></${childTag}>
|
|
656
|
+
</${tag}>
|
|
657
|
+
</${groupTag}>
|
|
635
658
|
`);
|
|
636
659
|
const elIndeterminate = /** @type {LionCheckboxIndeterminate} */ (
|
|
637
|
-
el.querySelector(
|
|
660
|
+
el.querySelector(`${cfg.tagString}`)
|
|
638
661
|
);
|
|
639
662
|
const checkboxEls = /** @type {LionCheckbox[]} */ (
|
|
640
|
-
Array.from(el.querySelectorAll(
|
|
663
|
+
Array.from(el.querySelectorAll(`${cfg.childTagString}`))
|
|
641
664
|
);
|
|
642
665
|
|
|
643
666
|
// Check when all child boxes in indeterminate state are unchecked
|
|
@@ -671,7 +694,6 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
671
694
|
// @ts-ignore for testing purposes, we access this protected getter
|
|
672
695
|
elIndeterminate._inputNode.click(); // unchecked
|
|
673
696
|
await elIndeterminate.updateComplete;
|
|
674
|
-
|
|
675
697
|
for (const checkEl of checkboxEls) {
|
|
676
698
|
// @ts-ignore for testing purposes, we access this protected getter
|
|
677
699
|
checkEl._inputNode.click();
|
|
@@ -697,4 +719,4 @@ describe('<lion-checkbox-indeterminate>', () => {
|
|
|
697
719
|
expect(elIndeterminate.indeterminate).to.be.false;
|
|
698
720
|
});
|
|
699
721
|
});
|
|
700
|
-
}
|
|
722
|
+
}
|
|
@@ -406,7 +406,6 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(LionListbox)) {
|
|
|
406
406
|
* @protected
|
|
407
407
|
*/
|
|
408
408
|
this._ariaVersion = browserDetection.isChromium ? '1.1' : '1.0';
|
|
409
|
-
|
|
410
409
|
/**
|
|
411
410
|
* @configure ListboxMixin
|
|
412
411
|
* @protected
|
|
@@ -1072,6 +1071,9 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(LionListbox)) {
|
|
|
1072
1071
|
this._setTextboxValue('');
|
|
1073
1072
|
break;
|
|
1074
1073
|
case 'Enter':
|
|
1074
|
+
if (this.multipleChoice && this.opened) {
|
|
1075
|
+
ev.preventDefault();
|
|
1076
|
+
}
|
|
1075
1077
|
if (!this.formElements[this.activeIndex]) {
|
|
1076
1078
|
return;
|
|
1077
1079
|
}
|