@crowdstrike/glide-core 0.12.2 → 0.12.3
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/dist/checkbox-group.styles.js +1 -1
- package/dist/dropdown.d.ts +4 -1
- package/dist/dropdown.js +107 -55
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +4 -2
- package/dist/dropdown.option.test.interactions.multiple.js +2 -2
- package/dist/dropdown.option.test.interactions.single.js +2 -2
- package/dist/dropdown.styles.js +108 -13
- package/dist/dropdown.test.basics.filterable.js +11 -54
- package/dist/dropdown.test.basics.js +24 -244
- package/dist/dropdown.test.basics.multiple.js +13 -60
- package/dist/dropdown.test.basics.single.js +2 -8
- package/dist/dropdown.test.events.filterable.js +12 -54
- package/dist/dropdown.test.events.js +75 -49
- package/dist/dropdown.test.events.multiple.js +17 -87
- package/dist/dropdown.test.events.single.js +12 -60
- package/dist/dropdown.test.focus.filterable.js +11 -58
- package/dist/dropdown.test.focus.js +62 -9
- package/dist/dropdown.test.focus.multiple.js +22 -38
- package/dist/dropdown.test.focus.single.js +22 -17
- package/dist/dropdown.test.interactions.filterable.js +83 -69
- package/dist/dropdown.test.interactions.js +225 -243
- package/dist/dropdown.test.interactions.multiple.js +78 -274
- package/dist/dropdown.test.interactions.single.js +20 -85
- package/dist/dropdown.test.validity.js +12 -49
- package/dist/label.js +1 -1
- package/dist/label.styles.js +7 -3
- package/dist/radio-group.styles.js +1 -1
- package/dist/tab.group.styles.js +0 -6
- package/dist/tab.panel.styles.js +0 -3
- package/dist/textarea.styles.js +1 -1
- package/package.json +1 -1
@@ -6,60 +6,17 @@ import GlideCoreDropdownOption from './dropdown.option.js';
|
|
6
6
|
GlideCoreDropdown.shadowRootOptions.mode = 'open';
|
7
7
|
GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
|
8
8
|
const defaultSlot = html `
|
9
|
-
<glide-core-dropdown-option
|
10
|
-
|
11
|
-
|
12
|
-
></glide-core-dropdown-option>
|
13
|
-
|
14
|
-
<glide-core-dropdown-option
|
15
|
-
|
16
|
-
|
17
|
-
></glide-core-dropdown-option>
|
18
|
-
|
19
|
-
<glide-core-dropdown-option
|
20
|
-
label="Three"
|
21
|
-
value="three"
|
22
|
-
></glide-core-dropdown-option>
|
23
|
-
|
24
|
-
<glide-core-dropdown-option
|
25
|
-
label="Four"
|
26
|
-
value="four"
|
27
|
-
></glide-core-dropdown-option>
|
28
|
-
|
29
|
-
<glide-core-dropdown-option
|
30
|
-
label="Five"
|
31
|
-
value="five"
|
32
|
-
></glide-core-dropdown-option>
|
33
|
-
|
34
|
-
<glide-core-dropdown-option
|
35
|
-
label="Six"
|
36
|
-
value="six"
|
37
|
-
></glide-core-dropdown-option>
|
38
|
-
|
39
|
-
<glide-core-dropdown-option
|
40
|
-
label="Seven"
|
41
|
-
value="seven"
|
42
|
-
></glide-core-dropdown-option>
|
43
|
-
|
44
|
-
<glide-core-dropdown-option
|
45
|
-
label="Eight"
|
46
|
-
value="eight"
|
47
|
-
></glide-core-dropdown-option>
|
48
|
-
|
49
|
-
<glide-core-dropdown-option
|
50
|
-
label="Nine"
|
51
|
-
value="nine"
|
52
|
-
></glide-core-dropdown-option>
|
53
|
-
|
54
|
-
<glide-core-dropdown-option
|
55
|
-
label="Ten"
|
56
|
-
value="ten"
|
57
|
-
></glide-core-dropdown-option>
|
58
|
-
|
59
|
-
<glide-core-dropdown-option
|
60
|
-
label="Eleven"
|
61
|
-
value="eleven"
|
62
|
-
></glide-core-dropdown-option>
|
9
|
+
<glide-core-dropdown-option label="One"></glide-core-dropdown-option>
|
10
|
+
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
11
|
+
<glide-core-dropdown-option label="Three"></glide-core-dropdown-option>
|
12
|
+
<glide-core-dropdown-option label="Four"></glide-core-dropdown-option>
|
13
|
+
<glide-core-dropdown-option label="Five"></glide-core-dropdown-option>
|
14
|
+
<glide-core-dropdown-option label="Six"></glide-core-dropdown-option>
|
15
|
+
<glide-core-dropdown-option label="Seven"></glide-core-dropdown-option>
|
16
|
+
<glide-core-dropdown-option label="Eight"></glide-core-dropdown-option>
|
17
|
+
<glide-core-dropdown-option label="Nine"></glide-core-dropdown-option>
|
18
|
+
<glide-core-dropdown-option label="Ten"></glide-core-dropdown-option>
|
19
|
+
<glide-core-dropdown-option label="Eleven"></glide-core-dropdown-option>
|
63
20
|
`;
|
64
21
|
it('opens on click', async () => {
|
65
22
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
@@ -218,6 +175,56 @@ it('hides its magnifying glass icon when multiselect and not filtering', async (
|
|
218
175
|
const icon = component?.shadowRoot?.querySelector('[data-test="magnifying-glass-icon"]');
|
219
176
|
expect(icon?.checkVisibility()).to.be.not.ok;
|
220
177
|
});
|
178
|
+
it('does not clear its filter when a tag is removed via Backspace', async () => {
|
179
|
+
const component = await fixture(html `<glide-core-dropdown
|
180
|
+
label="Label"
|
181
|
+
placeholder="Placeholder"
|
182
|
+
filterable
|
183
|
+
multiple
|
184
|
+
>
|
185
|
+
<glide-core-dropdown-option
|
186
|
+
label="One"
|
187
|
+
selected
|
188
|
+
></glide-core-dropdown-option>
|
189
|
+
|
190
|
+
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
191
|
+
</glide-core-dropdown>`);
|
192
|
+
// Wait for it to open.
|
193
|
+
await aTimeout(0);
|
194
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
195
|
+
input?.select();
|
196
|
+
input?.focus();
|
197
|
+
await sendKeys({ type: 'o' });
|
198
|
+
await sendKeys({ press: 'ArrowLeft' });
|
199
|
+
await sendKeys({ press: 'Backspace' });
|
200
|
+
expect(input?.value).to.equal('o');
|
201
|
+
});
|
202
|
+
it('does not clear its filter when every tag is removed via Meta + Backspace', async () => {
|
203
|
+
const component = await fixture(html `<glide-core-dropdown
|
204
|
+
label="Label"
|
205
|
+
placeholder="Placeholder"
|
206
|
+
filterable
|
207
|
+
multiple
|
208
|
+
>
|
209
|
+
<glide-core-dropdown-option
|
210
|
+
label="One"
|
211
|
+
selected
|
212
|
+
></glide-core-dropdown-option>
|
213
|
+
|
214
|
+
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
215
|
+
</glide-core-dropdown>`);
|
216
|
+
// Wait for it to open.
|
217
|
+
await aTimeout(0);
|
218
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
219
|
+
input?.select();
|
220
|
+
input?.focus();
|
221
|
+
await sendKeys({ type: 'o' });
|
222
|
+
await sendKeys({ press: 'ArrowLeft' });
|
223
|
+
await sendKeys({ down: 'Meta' });
|
224
|
+
await sendKeys({ press: 'Backspace' });
|
225
|
+
await sendKeys({ up: 'Meta' });
|
226
|
+
expect(input?.value).to.equal('o');
|
227
|
+
});
|
221
228
|
it('does not filter on only whitespace', async () => {
|
222
229
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
223
230
|
${defaultSlot}
|
@@ -308,14 +315,10 @@ it('sets the `value` of its `<input>` when made filterable', async () => {
|
|
308
315
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
309
316
|
<glide-core-dropdown-option
|
310
317
|
label="One"
|
311
|
-
value="one"
|
312
318
|
selected
|
313
319
|
></glide-core-dropdown-option>
|
314
320
|
|
315
|
-
<glide-core-dropdown-option
|
316
|
-
label="Two"
|
317
|
-
value="two"
|
318
|
-
></glide-core-dropdown-option>
|
321
|
+
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
319
322
|
</glide-core-dropdown>`);
|
320
323
|
component.filterable = true;
|
321
324
|
await elementUpdated(component);
|
@@ -350,7 +353,6 @@ it('deselects the last selected option on Backspace', async () => {
|
|
350
353
|
component.shadowRoot
|
351
354
|
?.querySelector('[data-test="input"]')
|
352
355
|
?.setSelectionRange(0, 0);
|
353
|
-
await aTimeout(0);
|
354
356
|
await sendKeys({ press: 'Backspace' });
|
355
357
|
expect(options[1].selected).to.be.false;
|
356
358
|
expect(options[0].selected).to.be.true;
|
@@ -395,6 +397,22 @@ it('clears the `value` of its `<input>` when multiselect and an option is select
|
|
395
397
|
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
396
398
|
expect(input?.value).to.be.empty.string;
|
397
399
|
});
|
400
|
+
it('does not clear its filter when a tag is removed', async () => {
|
401
|
+
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" multiple>
|
402
|
+
${defaultSlot}
|
403
|
+
</glide-core-dropdown>`);
|
404
|
+
const option = component.querySelector('glide-core-dropdown-option');
|
405
|
+
assert(option);
|
406
|
+
option.selected = true;
|
407
|
+
component.focus();
|
408
|
+
await sendKeys({ type: 'one' });
|
409
|
+
component.shadowRoot
|
410
|
+
?.querySelector('[data-test="tag"]')
|
411
|
+
?.click();
|
412
|
+
await elementUpdated(component);
|
413
|
+
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
414
|
+
expect(input?.value).to.equal('one');
|
415
|
+
});
|
398
416
|
it('uses `placeholder` as a placeholder when multiselect and no option is selected', async () => {
|
399
417
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" multiple>
|
400
418
|
${defaultSlot}
|
@@ -601,7 +619,7 @@ it('sets `aria-activedescendant` when closed via click', async () => {
|
|
601
619
|
?.click();
|
602
620
|
await elementUpdated(component);
|
603
621
|
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
604
|
-
expect(input?.getAttribute('aria-activedescendant')).to.
|
622
|
+
expect(input?.getAttribute('aria-activedescendant')).to.be.empty.string;
|
605
623
|
});
|
606
624
|
it('sets `aria-activedescendant` when closed because it lost focus', async () => {
|
607
625
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
|
@@ -610,7 +628,7 @@ it('sets `aria-activedescendant` when closed because it lost focus', async () =>
|
|
610
628
|
component.focus();
|
611
629
|
await sendKeys({ press: 'Tab' });
|
612
630
|
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
613
|
-
expect(input?.getAttribute('aria-activedescendant')).to.
|
631
|
+
expect(input?.getAttribute('aria-activedescendant')).to.be.empty.string;
|
614
632
|
});
|
615
633
|
it('sets `aria-activedescendant` when closed because something outside of it was clicked', async () => {
|
616
634
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
|
@@ -619,7 +637,7 @@ it('sets `aria-activedescendant` when closed because something outside of it was
|
|
619
637
|
document.body.click();
|
620
638
|
await elementUpdated(component);
|
621
639
|
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
622
|
-
expect(input?.getAttribute('aria-activedescendant')).to.
|
640
|
+
expect(input?.getAttribute('aria-activedescendant')).to.be.empty.string;
|
623
641
|
});
|
624
642
|
it('sets `aria-activedescendant` when closed via Escape', async () => {
|
625
643
|
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
|
@@ -628,7 +646,7 @@ it('sets `aria-activedescendant` when closed via Escape', async () => {
|
|
628
646
|
component.focus();
|
629
647
|
await sendKeys({ press: 'Escape' });
|
630
648
|
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
631
|
-
expect(input?.getAttribute('aria-activedescendant')).to.
|
649
|
+
expect(input?.getAttribute('aria-activedescendant')).to.be.empty.string;
|
632
650
|
});
|
633
651
|
it('cannot be tabbed to when `disabled`', async () => {
|
634
652
|
await fixture(html `<glide-core-dropdown
|
@@ -691,14 +709,10 @@ it('has no icon when filtering and an option is selected', async () => {
|
|
691
709
|
|
692
710
|
<glide-core-dropdown-option
|
693
711
|
label="One"
|
694
|
-
value="one"
|
695
712
|
selected
|
696
713
|
></glide-core-dropdown-option>
|
697
714
|
|
698
|
-
<glide-core-dropdown-option
|
699
|
-
label="Two"
|
700
|
-
value="two"
|
701
|
-
></glide-core-dropdown-option>
|
715
|
+
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
702
716
|
</glide-core-dropdown>`);
|
703
717
|
component.focus();
|
704
718
|
await sendKeys({ type: 'one' });
|