@crowdstrike/glide-core 0.13.1 → 0.14.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/dist/drawer.d.ts +2 -2
- package/dist/drawer.js +1 -1
- package/dist/drawer.styles.js +3 -14
- package/dist/dropdown.styles.js +3 -2
- package/dist/input.styles.js +1 -0
- package/dist/styles/variables.css +1 -1
- package/dist/textarea.styles.js +2 -0
- package/dist/toasts.d.ts +2 -2
- package/dist/toasts.toast.d.ts +1 -1
- package/dist/toasts.toast.js +1 -1
- package/dist/toasts.toast.styles.js +8 -0
- package/dist/tree.item.styles.js +2 -2
- package/package.json +8 -5
- package/dist/accordion.stories.d.ts +0 -6
- package/dist/accordion.test.basics.d.ts +0 -1
- package/dist/accordion.test.basics.js +0 -28
- package/dist/accordion.test.events.d.ts +0 -1
- package/dist/accordion.test.events.js +0 -28
- package/dist/accordion.test.focus.d.ts +0 -1
- package/dist/accordion.test.focus.js +0 -11
- package/dist/accordion.test.interactions.d.ts +0 -1
- package/dist/accordion.test.interactions.js +0 -75
- package/dist/button-group.button.test.basics.d.ts +0 -1
- package/dist/button-group.button.test.basics.js +0 -97
- package/dist/button-group.button.test.events.d.ts +0 -1
- package/dist/button-group.button.test.events.js +0 -15
- package/dist/button-group.button.test.focus.d.ts +0 -1
- package/dist/button-group.button.test.focus.js +0 -13
- package/dist/button-group.button.test.interactions.d.ts +0 -1
- package/dist/button-group.button.test.interactions.js +0 -42
- package/dist/button-group.stories.d.ts +0 -7
- package/dist/button-group.test.basics.d.ts +0 -1
- package/dist/button-group.test.basics.js +0 -148
- package/dist/button-group.test.events.d.ts +0 -1
- package/dist/button-group.test.events.js +0 -241
- package/dist/button-group.test.focus.d.ts +0 -1
- package/dist/button-group.test.focus.js +0 -39
- package/dist/button-group.test.interactions.d.ts +0 -1
- package/dist/button-group.test.interactions.js +0 -91
- package/dist/button.stories.d.ts +0 -7
- package/dist/button.test.basics.d.ts +0 -1
- package/dist/button.test.basics.js +0 -69
- package/dist/button.test.events.d.ts +0 -1
- package/dist/button.test.events.js +0 -102
- package/dist/checkbox-group.stories.d.ts +0 -6
- package/dist/checkbox-group.test.basics.d.ts +0 -1
- package/dist/checkbox-group.test.basics.js +0 -116
- package/dist/checkbox-group.test.events.d.ts +0 -1
- package/dist/checkbox-group.test.events.js +0 -111
- package/dist/checkbox-group.test.focus.d.ts +0 -1
- package/dist/checkbox-group.test.focus.js +0 -70
- package/dist/checkbox-group.test.form.d.ts +0 -1
- package/dist/checkbox-group.test.form.js +0 -131
- package/dist/checkbox-group.test.interactions.d.ts +0 -1
- package/dist/checkbox-group.test.interactions.js +0 -82
- package/dist/checkbox-group.test.validity.d.ts +0 -1
- package/dist/checkbox-group.test.validity.js +0 -145
- package/dist/checkbox.stories.d.ts +0 -5
- package/dist/checkbox.test.basics.d.ts +0 -1
- package/dist/checkbox.test.basics.js +0 -90
- package/dist/checkbox.test.events.d.ts +0 -1
- package/dist/checkbox.test.events.js +0 -105
- package/dist/checkbox.test.focus.d.ts +0 -1
- package/dist/checkbox.test.focus.js +0 -51
- package/dist/checkbox.test.form.d.ts +0 -1
- package/dist/checkbox.test.form.js +0 -133
- package/dist/checkbox.test.interactions.d.ts +0 -1
- package/dist/checkbox.test.interactions.js +0 -131
- package/dist/checkbox.test.validity.d.ts +0 -1
- package/dist/checkbox.test.validity.js +0 -128
- package/dist/drawer.stories.d.ts +0 -6
- package/dist/drawer.test.accessibility.d.ts +0 -1
- package/dist/drawer.test.accessibility.js +0 -22
- package/dist/drawer.test.basics.d.ts +0 -1
- package/dist/drawer.test.basics.js +0 -44
- package/dist/drawer.test.closing.d.ts +0 -1
- package/dist/drawer.test.closing.js +0 -40
- package/dist/drawer.test.events.d.ts +0 -1
- package/dist/drawer.test.events.js +0 -42
- package/dist/drawer.test.methods.d.ts +0 -1
- package/dist/drawer.test.methods.js +0 -35
- package/dist/dropdown.option.test.basics.d.ts +0 -1
- package/dist/dropdown.option.test.basics.js +0 -34
- package/dist/dropdown.option.test.basics.multiple.d.ts +0 -1
- package/dist/dropdown.option.test.basics.multiple.js +0 -36
- package/dist/dropdown.option.test.basics.single.d.ts +0 -1
- package/dist/dropdown.option.test.basics.single.js +0 -29
- package/dist/dropdown.option.test.events.d.ts +0 -1
- package/dist/dropdown.option.test.events.js +0 -36
- package/dist/dropdown.option.test.focus.d.ts +0 -1
- package/dist/dropdown.option.test.focus.js +0 -11
- package/dist/dropdown.option.test.interactions.multiple.d.ts +0 -1
- package/dist/dropdown.option.test.interactions.multiple.js +0 -42
- package/dist/dropdown.option.test.interactions.single.d.ts +0 -1
- package/dist/dropdown.option.test.interactions.single.js +0 -76
- package/dist/dropdown.stories.d.ts +0 -8
- package/dist/dropdown.test.basics.d.ts +0 -1
- package/dist/dropdown.test.basics.filterable.d.ts +0 -1
- package/dist/dropdown.test.basics.filterable.js +0 -108
- package/dist/dropdown.test.basics.js +0 -181
- package/dist/dropdown.test.basics.multiple.d.ts +0 -1
- package/dist/dropdown.test.basics.multiple.js +0 -259
- package/dist/dropdown.test.basics.single.d.ts +0 -1
- package/dist/dropdown.test.basics.single.js +0 -122
- package/dist/dropdown.test.events.d.ts +0 -1
- package/dist/dropdown.test.events.filterable.d.ts +0 -1
- package/dist/dropdown.test.events.filterable.js +0 -31
- package/dist/dropdown.test.events.js +0 -251
- package/dist/dropdown.test.events.multiple.d.ts +0 -1
- package/dist/dropdown.test.events.multiple.js +0 -446
- package/dist/dropdown.test.events.single.d.ts +0 -1
- package/dist/dropdown.test.events.single.js +0 -343
- package/dist/dropdown.test.focus.d.ts +0 -1
- package/dist/dropdown.test.focus.filterable.d.ts +0 -1
- package/dist/dropdown.test.focus.filterable.js +0 -140
- package/dist/dropdown.test.focus.js +0 -107
- package/dist/dropdown.test.focus.multiple.d.ts +0 -1
- package/dist/dropdown.test.focus.multiple.js +0 -170
- package/dist/dropdown.test.focus.single.d.ts +0 -1
- package/dist/dropdown.test.focus.single.js +0 -42
- package/dist/dropdown.test.form.d.ts +0 -1
- package/dist/dropdown.test.form.js +0 -74
- package/dist/dropdown.test.form.multiple.d.ts +0 -1
- package/dist/dropdown.test.form.multiple.js +0 -151
- package/dist/dropdown.test.form.single.d.ts +0 -1
- package/dist/dropdown.test.form.single.js +0 -129
- package/dist/dropdown.test.interactions.d.ts +0 -1
- package/dist/dropdown.test.interactions.filterable.d.ts +0 -1
- package/dist/dropdown.test.interactions.filterable.js +0 -805
- package/dist/dropdown.test.interactions.js +0 -696
- package/dist/dropdown.test.interactions.multiple.d.ts +0 -1
- package/dist/dropdown.test.interactions.multiple.js +0 -1026
- package/dist/dropdown.test.interactions.single.d.ts +0 -1
- package/dist/dropdown.test.interactions.single.js +0 -569
- package/dist/dropdown.test.validity.d.ts +0 -1
- package/dist/dropdown.test.validity.js +0 -181
- package/dist/form-controls-layout.stories.d.ts +0 -10
- package/dist/form-controls-layout.test.basics.d.ts +0 -2
- package/dist/form-controls-layout.test.basics.js +0 -75
- package/dist/form-controls-layout.test.interactions.d.ts +0 -2
- package/dist/form-controls-layout.test.interactions.js +0 -26
- package/dist/icon-button.stories.d.ts +0 -6
- package/dist/icon-button.test.basics.d.ts +0 -1
- package/dist/icon-button.test.basics.js +0 -43
- package/dist/icon-button.test.focus.d.ts +0 -1
- package/dist/icon-button.test.focus.js +0 -13
- package/dist/input.stories.d.ts +0 -8
- package/dist/input.test.basics.d.ts +0 -1
- package/dist/input.test.basics.js +0 -138
- package/dist/input.test.events.d.ts +0 -1
- package/dist/input.test.events.js +0 -98
- package/dist/input.test.focus.d.ts +0 -1
- package/dist/input.test.focus.js +0 -58
- package/dist/input.test.form.d.ts +0 -1
- package/dist/input.test.form.js +0 -74
- package/dist/input.test.validity.d.ts +0 -1
- package/dist/input.test.validity.js +0 -258
- package/dist/label.test.basics.d.ts +0 -1
- package/dist/label.test.basics.js +0 -136
- package/dist/menu.button.test.basics.d.ts +0 -1
- package/dist/menu.button.test.basics.js +0 -43
- package/dist/menu.link.test.basics.d.ts +0 -1
- package/dist/menu.link.test.basics.js +0 -47
- package/dist/menu.options.test.basics.d.ts +0 -2
- package/dist/menu.options.test.basics.js +0 -44
- package/dist/menu.options.test.events.d.ts +0 -1
- package/dist/menu.options.test.events.js +0 -19
- package/dist/menu.stories.d.ts +0 -11
- package/dist/menu.test.basics.d.ts +0 -1
- package/dist/menu.test.basics.js +0 -178
- package/dist/menu.test.events.d.ts +0 -3
- package/dist/menu.test.events.js +0 -125
- package/dist/menu.test.focus.d.ts +0 -2
- package/dist/menu.test.focus.js +0 -102
- package/dist/menu.test.interactions.d.ts +0 -3
- package/dist/menu.test.interactions.js +0 -1069
- package/dist/modal.icon-button.test.basics.d.ts +0 -1
- package/dist/modal.icon-button.test.basics.js +0 -46
- package/dist/modal.stories.d.ts +0 -13
- package/dist/modal.tertiary-icon.test.basics.d.ts +0 -1
- package/dist/modal.tertiary-icon.test.basics.js +0 -60
- package/dist/modal.test.accessibility.d.ts +0 -1
- package/dist/modal.test.accessibility.js +0 -38
- package/dist/modal.test.basics.d.ts +0 -3
- package/dist/modal.test.basics.js +0 -204
- package/dist/modal.test.close.d.ts +0 -1
- package/dist/modal.test.close.js +0 -35
- package/dist/modal.test.events.d.ts +0 -1
- package/dist/modal.test.events.js +0 -99
- package/dist/modal.test.lock-scroll.d.ts +0 -1
- package/dist/modal.test.lock-scroll.js +0 -67
- package/dist/modal.test.methods.d.ts +0 -1
- package/dist/modal.test.methods.js +0 -20
- package/dist/modal.test.scrollbars.d.ts +0 -1
- package/dist/modal.test.scrollbars.js +0 -18
- package/dist/radio-group.stories.d.ts +0 -6
- package/dist/radio-group.test.basics.d.ts +0 -2
- package/dist/radio-group.test.basics.js +0 -324
- package/dist/radio-group.test.events.d.ts +0 -2
- package/dist/radio-group.test.events.js +0 -278
- package/dist/radio-group.test.focus.d.ts +0 -2
- package/dist/radio-group.test.focus.js +0 -95
- package/dist/radio-group.test.form.d.ts +0 -1
- package/dist/radio-group.test.form.js +0 -124
- package/dist/radio-group.test.validity.d.ts +0 -1
- package/dist/radio-group.test.validity.js +0 -311
- package/dist/split-button.primary-button.test.basics.d.ts +0 -1
- package/dist/split-button.primary-button.test.basics.js +0 -31
- package/dist/split-button.primary-button.test.focus.d.ts +0 -1
- package/dist/split-button.primary-button.test.focus.js +0 -14
- package/dist/split-button.primary-link.test.basics.d.ts +0 -1
- package/dist/split-button.primary-link.test.basics.js +0 -30
- package/dist/split-button.primary-link.test.focus.d.ts +0 -1
- package/dist/split-button.primary-link.test.focus.js +0 -15
- package/dist/split-button.secondary-button.test.basics.d.ts +0 -1
- package/dist/split-button.secondary-button.test.basics.js +0 -58
- package/dist/split-button.secondary-button.test.focus.d.ts +0 -1
- package/dist/split-button.secondary-button.test.focus.js +0 -14
- package/dist/split-button.secondary-button.test.interactions.d.ts +0 -2
- package/dist/split-button.secondary-button.test.interactions.js +0 -30
- package/dist/split-button.stories.d.ts +0 -13
- package/dist/split-button.test.basics.d.ts +0 -2
- package/dist/split-button.test.basics.js +0 -87
- package/dist/split-button.test.interactions.d.ts +0 -4
- package/dist/split-button.test.interactions.js +0 -51
- package/dist/tab.group.test.basics.d.ts +0 -3
- package/dist/tab.group.test.basics.js +0 -234
- package/dist/tab.group.test.interactions.d.ts +0 -3
- package/dist/tab.group.test.interactions.js +0 -434
- package/dist/tab.test.basics.d.ts +0 -1
- package/dist/tab.test.basics.js +0 -50
- package/dist/tabs.stories.d.ts +0 -8
- package/dist/tag.stories.d.ts +0 -7
- package/dist/tag.test.basics.d.ts +0 -1
- package/dist/tag.test.basics.js +0 -28
- package/dist/tag.test.events.d.ts +0 -1
- package/dist/tag.test.events.js +0 -93
- package/dist/tag.test.focus.d.ts +0 -1
- package/dist/tag.test.focus.js +0 -10
- package/dist/tag.test.interactions.d.ts +0 -1
- package/dist/tag.test.interactions.js +0 -36
- package/dist/textarea.stories.d.ts +0 -5
- package/dist/textarea.test.basics.d.ts +0 -1
- package/dist/textarea.test.basics.js +0 -177
- package/dist/textarea.test.events.d.ts +0 -1
- package/dist/textarea.test.events.js +0 -106
- package/dist/textarea.test.form.d.ts +0 -1
- package/dist/textarea.test.form.js +0 -71
- package/dist/textarea.test.validity.d.ts +0 -1
- package/dist/textarea.test.validity.js +0 -204
- package/dist/toasts.stories.d.ts +0 -7
- package/dist/toasts.test.basics.d.ts +0 -1
- package/dist/toasts.test.basics.js +0 -115
- package/dist/toasts.toast.test.basics.d.ts +0 -1
- package/dist/toasts.toast.test.basics.js +0 -139
- package/dist/toggle.stories.d.ts +0 -4
- package/dist/toggle.test.basics.d.ts +0 -1
- package/dist/toggle.test.basics.js +0 -69
- package/dist/toggle.test.events.d.ts +0 -1
- package/dist/toggle.test.events.js +0 -30
- package/dist/toggle.test.focus.d.ts +0 -1
- package/dist/toggle.test.focus.js +0 -9
- package/dist/toggle.test.interactions.d.ts +0 -1
- package/dist/toggle.test.interactions.js +0 -81
- package/dist/tooltip.stories.d.ts +0 -7
- package/dist/tooltip.test.basics.d.ts +0 -1
- package/dist/tooltip.test.basics.js +0 -100
- package/dist/tooltip.test.interactions.d.ts +0 -1
- package/dist/tooltip.test.interactions.js +0 -203
- package/dist/tree.item.icon-button.test.basics.d.ts +0 -1
- package/dist/tree.item.icon-button.test.basics.js +0 -22
- package/dist/tree.item.menu.test.basics.d.ts +0 -1
- package/dist/tree.item.menu.test.basics.js +0 -86
- package/dist/tree.item.test.basics.d.ts +0 -2
- package/dist/tree.item.test.basics.js +0 -138
- package/dist/tree.stories.d.ts +0 -9
- package/dist/tree.test.aria.d.ts +0 -1
- package/dist/tree.test.aria.js +0 -86
- package/dist/tree.test.basics.d.ts +0 -3
- package/dist/tree.test.basics.js +0 -130
- package/dist/tree.test.events.d.ts +0 -2
- package/dist/tree.test.events.js +0 -19
- package/dist/tree.test.focus.d.ts +0 -1
- package/dist/tree.test.focus.js +0 -383
@@ -1,42 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
3
|
-
import GlideCoreDropdownOption from './dropdown.option.js';
|
4
|
-
GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
|
5
|
-
it('is selected when programmatically selected', async () => {
|
6
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
7
|
-
label="Label"
|
8
|
-
value="value"
|
9
|
-
private-multiple
|
10
|
-
></glide-core-dropdown-option>`);
|
11
|
-
component.selected = true;
|
12
|
-
await elementUpdated(component);
|
13
|
-
const checkbox = component.shadowRoot?.querySelector('[data-test="checkbox"]');
|
14
|
-
expect(component.ariaSelected).to.equal('true');
|
15
|
-
expect(checkbox?.checked).to.be.true;
|
16
|
-
});
|
17
|
-
it('is deselected when programmatically deselected', async () => {
|
18
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
19
|
-
label="Label"
|
20
|
-
value="value"
|
21
|
-
private-multiple
|
22
|
-
selected
|
23
|
-
></glide-core-dropdown-option>`);
|
24
|
-
component.selected = false;
|
25
|
-
await elementUpdated(component);
|
26
|
-
const checkbox = component.shadowRoot?.querySelector('[data-test="checkbox"]');
|
27
|
-
expect(component.selected).to.be.false;
|
28
|
-
expect(component.ariaSelected).to.equal('false');
|
29
|
-
expect(checkbox?.checked).to.be.false;
|
30
|
-
});
|
31
|
-
it('sets `privateIsEditActive`', async () => {
|
32
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
33
|
-
label="Label"
|
34
|
-
editable
|
35
|
-
private-multiple
|
36
|
-
></glide-core-dropdown-option>`);
|
37
|
-
const button = component.shadowRoot?.querySelector('[data-test="edit-button"]');
|
38
|
-
button?.dispatchEvent(new MouseEvent('mouseover'));
|
39
|
-
expect(component.privateIsEditActive).to.be.true;
|
40
|
-
button?.dispatchEvent(new MouseEvent('mouseout'));
|
41
|
-
expect(component.privateIsEditActive).to.be.false;
|
42
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,76 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import { aTimeout, elementUpdated, expect, fixture, html, } from '@open-wc/testing';
|
3
|
-
import GlideCoreDropdownOption from './dropdown.option.js';
|
4
|
-
GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
|
5
|
-
it('is selected when programmatically selected', async () => {
|
6
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
7
|
-
label="Label"
|
8
|
-
value="value"
|
9
|
-
></glide-core-dropdown-option>`);
|
10
|
-
component.selected = true;
|
11
|
-
await elementUpdated(component);
|
12
|
-
expect(component.ariaSelected).to.equal('true');
|
13
|
-
});
|
14
|
-
it('has a tooltip when active and with a long label', async () => {
|
15
|
-
// The period is arbitrary. 500 of them ensures we exceed the maximum
|
16
|
-
// width even if it's increased.
|
17
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
18
|
-
label=${'.'.repeat(500)}
|
19
|
-
value="value"
|
20
|
-
></glide-core-dropdown-option>`);
|
21
|
-
component.privateIsTooltipOpen = true;
|
22
|
-
// Wait for the tooltip.
|
23
|
-
await aTimeout(0);
|
24
|
-
const tooltip = component.shadowRoot?.querySelector('[data-test="tooltip"]');
|
25
|
-
expect(tooltip?.checkVisibility()).to.be.true;
|
26
|
-
});
|
27
|
-
it('has no tooltip when active and with a short label', async () => {
|
28
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
29
|
-
label="Label"
|
30
|
-
value="value"
|
31
|
-
></glide-core-dropdown-option>`);
|
32
|
-
component.privateActive = true;
|
33
|
-
// Wait for the tooltip.
|
34
|
-
await aTimeout(0);
|
35
|
-
const tooltip = component.shadowRoot?.querySelector('[data-test="tooltip"]');
|
36
|
-
expect(tooltip?.checkVisibility()).to.be.false;
|
37
|
-
});
|
38
|
-
it('has a tooltip when active and with a long label set programmatically', async () => {
|
39
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
40
|
-
label="Label"
|
41
|
-
value="value"
|
42
|
-
></glide-core-dropdown-option>`);
|
43
|
-
component.privateIsTooltipOpen = true;
|
44
|
-
// The period is arbitrary. 500 of them ensures we exceed the maximum
|
45
|
-
// width even if it's increased.
|
46
|
-
component.label = '.'.repeat(500);
|
47
|
-
// Wait for the tooltip.
|
48
|
-
await aTimeout(0);
|
49
|
-
const tooltip = component.shadowRoot?.querySelector('[data-test="tooltip"]');
|
50
|
-
expect(tooltip?.checkVisibility()).to.be.true;
|
51
|
-
});
|
52
|
-
it('has no tooltip when active and with a short label set programmatically', async () => {
|
53
|
-
// The period is arbitrary. 500 of them ensures we exceed the maximum
|
54
|
-
// width even if it's increased.
|
55
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
56
|
-
label=${'.'.repeat(500)}
|
57
|
-
value="value"
|
58
|
-
></glide-core-dropdown-option>`);
|
59
|
-
component.privateActive = true;
|
60
|
-
component.label = 'Label';
|
61
|
-
// Wait for the tooltip.
|
62
|
-
await aTimeout(0);
|
63
|
-
const tooltip = component.shadowRoot?.querySelector('[data-test="tooltip"]');
|
64
|
-
expect(tooltip?.checkVisibility()).to.be.false;
|
65
|
-
});
|
66
|
-
it('sets `privateIsEditActive`', async () => {
|
67
|
-
const component = await fixture(html `<glide-core-dropdown-option
|
68
|
-
label="Label"
|
69
|
-
editable
|
70
|
-
></glide-core-dropdown-option>`);
|
71
|
-
const button = component.shadowRoot?.querySelector('[data-test="edit-button"]');
|
72
|
-
button?.dispatchEvent(new MouseEvent('mouseover'));
|
73
|
-
expect(component.privateIsEditActive).to.be.true;
|
74
|
-
button?.dispatchEvent(new MouseEvent('mouseout'));
|
75
|
-
expect(component.privateIsEditActive).to.be.false;
|
76
|
-
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import './dropdown.option.js';
|
2
|
-
import './icons/storybook.js';
|
3
|
-
import type { Meta, StoryObj } from '@storybook/web-components';
|
4
|
-
declare const meta: Meta;
|
5
|
-
export default meta;
|
6
|
-
export declare const Dropdown: StoryObj;
|
7
|
-
export declare const WithError: StoryObj;
|
8
|
-
export declare const WithIcons: StoryObj;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
import './dropdown.option.js';
|
@@ -1,108 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import './dropdown.option.js';
|
3
|
-
import { expect, fixture, html } from '@open-wc/testing';
|
4
|
-
import GlideCoreDropdown from './dropdown.js';
|
5
|
-
GlideCoreDropdown.shadowRootOptions.mode = 'open';
|
6
|
-
const defaultSlot = html `
|
7
|
-
<glide-core-dropdown-option label="One"></glide-core-dropdown-option>
|
8
|
-
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
9
|
-
<glide-core-dropdown-option label="Three"></glide-core-dropdown-option>
|
10
|
-
<glide-core-dropdown-option label="Four"></glide-core-dropdown-option>
|
11
|
-
<glide-core-dropdown-option label="Five"></glide-core-dropdown-option>
|
12
|
-
<glide-core-dropdown-option label="Six"></glide-core-dropdown-option>
|
13
|
-
<glide-core-dropdown-option label="Seven"></glide-core-dropdown-option>
|
14
|
-
<glide-core-dropdown-option label="Eight"></glide-core-dropdown-option>
|
15
|
-
<glide-core-dropdown-option label="Nine"></glide-core-dropdown-option>
|
16
|
-
<glide-core-dropdown-option label="Ten"></glide-core-dropdown-option>
|
17
|
-
<glide-core-dropdown-option label="Eleven"></glide-core-dropdown-option>
|
18
|
-
`;
|
19
|
-
it('is accessible', async () => {
|
20
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" multiple>
|
21
|
-
${defaultSlot}
|
22
|
-
</glide-core-dropdown>`);
|
23
|
-
await expect(component).to.be.accessible({
|
24
|
-
ignoredRules: [
|
25
|
-
// Axe doesn't like that our item count element doesn't have a `role`. Yet
|
26
|
-
// it does label `<input>` and is announced correctly, at least by VoiceOver.
|
27
|
-
'aria-prohibited-attr',
|
28
|
-
// Axe doesn't search within slots when determining whether an element
|
29
|
-
// has an ID that matches `aria-activedescendant` exists.
|
30
|
-
'aria-valid-attr-value',
|
31
|
-
],
|
32
|
-
});
|
33
|
-
});
|
34
|
-
it('is filterable', async () => {
|
35
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" multiple>
|
36
|
-
${defaultSlot}
|
37
|
-
</glide-core-dropdown>`);
|
38
|
-
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
39
|
-
expect(input?.checkVisibility()).to.be.true;
|
40
|
-
});
|
41
|
-
it('uses `placeholder` as a placeholder when not `multiple` and no option is selected', async () => {
|
42
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
43
|
-
${defaultSlot}
|
44
|
-
</glide-core-dropdown>`);
|
45
|
-
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
46
|
-
expect(input?.placeholder).to.equal('Placeholder');
|
47
|
-
});
|
48
|
-
it('sets `value` of its `<input>` when an option is initially selected', async () => {
|
49
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
50
|
-
<glide-core-dropdown-option
|
51
|
-
label="One"
|
52
|
-
value="one"
|
53
|
-
selected
|
54
|
-
></glide-core-dropdown-option>
|
55
|
-
|
56
|
-
<glide-core-dropdown-option
|
57
|
-
label="Two"
|
58
|
-
value="two"
|
59
|
-
></glide-core-dropdown-option>
|
60
|
-
|
61
|
-
<glide-core-dropdown-option
|
62
|
-
label="Three"
|
63
|
-
value="three"
|
64
|
-
></glide-core-dropdown-option>
|
65
|
-
|
66
|
-
<glide-core-dropdown-option
|
67
|
-
label="Four"
|
68
|
-
value="four"
|
69
|
-
></glide-core-dropdown-option>
|
70
|
-
|
71
|
-
<glide-core-dropdown-option
|
72
|
-
label="Five"
|
73
|
-
value="five"
|
74
|
-
></glide-core-dropdown-option>
|
75
|
-
|
76
|
-
<glide-core-dropdown-option
|
77
|
-
label="Six"
|
78
|
-
value="six"
|
79
|
-
></glide-core-dropdown-option>
|
80
|
-
|
81
|
-
<glide-core-dropdown-option
|
82
|
-
label="Seven"
|
83
|
-
value="seven"
|
84
|
-
></glide-core-dropdown-option>
|
85
|
-
|
86
|
-
<glide-core-dropdown-option
|
87
|
-
label="Eight"
|
88
|
-
value="eight"
|
89
|
-
></glide-core-dropdown-option>
|
90
|
-
|
91
|
-
<glide-core-dropdown-option
|
92
|
-
label="Nine"
|
93
|
-
value="nine"
|
94
|
-
></glide-core-dropdown-option>
|
95
|
-
|
96
|
-
<glide-core-dropdown-option
|
97
|
-
label="Ten"
|
98
|
-
value="ten"
|
99
|
-
></glide-core-dropdown-option>
|
100
|
-
|
101
|
-
<glide-core-dropdown-option
|
102
|
-
label="Eleven"
|
103
|
-
value="eleven"
|
104
|
-
></glide-core-dropdown-option>
|
105
|
-
</glide-core-dropdown>`);
|
106
|
-
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
107
|
-
expect(input?.value).to.equal('One');
|
108
|
-
});
|
@@ -1,181 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import { ArgumentError } from 'ow';
|
3
|
-
import { aTimeout, assert, expect, fixture, html } from '@open-wc/testing';
|
4
|
-
import { repeat } from 'lit/directives/repeat.js';
|
5
|
-
import GlideCoreDropdown from './dropdown.js';
|
6
|
-
import GlideCoreDropdownOption from './dropdown.option.js';
|
7
|
-
import expectArgumentError from './library/expect-argument-error.js';
|
8
|
-
import sinon from 'sinon';
|
9
|
-
// You'll notice quite a few duplicated tests among the "*.single.ts", "*.multiple.ts",
|
10
|
-
// and "*.filterable.ts" test suites. The thinking is that a test warrants
|
11
|
-
// duplication whenever Dropdown's internal logic isn't shared among all three
|
12
|
-
// of those states or if one state goes down a significantly different code path.
|
13
|
-
//
|
14
|
-
// There are still gaps. And there are exceptions to avoid excessive duplication
|
15
|
-
// for the sake of organization. Many of the tests in `dropdown.test.interactions.ts`,
|
16
|
-
// for example, don't apply to the filterable case and so aren't common among all
|
17
|
-
// three states. They nonetheless reside there because moving them out and
|
18
|
-
// duplicating them in both `dropdown.test.interactions.single.ts` and
|
19
|
-
// `dropdown.test.interactions.multiple.ts` would add a ton of test weight.
|
20
|
-
GlideCoreDropdown.shadowRootOptions.mode = 'open';
|
21
|
-
GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
|
22
|
-
it('registers', async () => {
|
23
|
-
expect(window.customElements.get('glide-core-dropdown')).to.equal(GlideCoreDropdown);
|
24
|
-
});
|
25
|
-
it('has defaults', async () => {
|
26
|
-
// Required attributes are supplied here and thus left unasserted below. The
|
27
|
-
// idea is that this test shouldn't fail to typecheck if these templates are
|
28
|
-
// eventually typechecked, which means supplying all required attributes and slots.
|
29
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
30
|
-
<glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
|
31
|
-
</glide-core-dropdown>`);
|
32
|
-
expect(component.disabled).to.be.false;
|
33
|
-
expect(component.filterable).to.be.false;
|
34
|
-
expect(component.name).to.be.empty.string;
|
35
|
-
expect(component.required).to.be.false;
|
36
|
-
expect(component.size).to.equal('large');
|
37
|
-
// Not reflected, so no attribute assertion is necessary.
|
38
|
-
expect(component.value).to.deep.equal([]);
|
39
|
-
});
|
40
|
-
it('can be open', async () => {
|
41
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
|
42
|
-
<glide-core-dropdown-option
|
43
|
-
label="Label"
|
44
|
-
selected
|
45
|
-
></glide-core-dropdown-option>
|
46
|
-
</glide-core-dropdown>`);
|
47
|
-
// Wait for it to open.
|
48
|
-
await aTimeout(0);
|
49
|
-
const options = component.shadowRoot?.querySelector('[data-test="options"]');
|
50
|
-
expect(component.open).to.be.true;
|
51
|
-
expect(component.hasAttribute('open')).to.be.true;
|
52
|
-
expect(options?.checkVisibility()).to.be.true;
|
53
|
-
});
|
54
|
-
it('cannot be open when disabled', async () => {
|
55
|
-
const component = await fixture(html `<glide-core-dropdown
|
56
|
-
label="Label"
|
57
|
-
placeholder="Placeholder"
|
58
|
-
open
|
59
|
-
disabled
|
60
|
-
>
|
61
|
-
<glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
|
62
|
-
</glide-core-dropdown>`);
|
63
|
-
const options = component?.shadowRoot?.querySelector('[data-test="options"]');
|
64
|
-
expect(options?.checkVisibility()).to.be.false;
|
65
|
-
});
|
66
|
-
it('can be filterable', async () => {
|
67
|
-
const component = await fixture(html `<glide-core-dropdown
|
68
|
-
label="Label"
|
69
|
-
placeholder="Placeholder"
|
70
|
-
filterable
|
71
|
-
>
|
72
|
-
<glide-core-dropdown-option label="Label"></glide-core-dropdown-option>
|
73
|
-
</glide-core-dropdown>`);
|
74
|
-
const input = component.shadowRoot?.querySelector('[data-test="input"]');
|
75
|
-
expect(input?.checkVisibility()).to.be.true;
|
76
|
-
});
|
77
|
-
it('activates the first option when no options are initially selected', async () => {
|
78
|
-
const component = await fixture(html `<glide-core-dropdown open>
|
79
|
-
<glide-core-dropdown-option label="One"></glide-core-dropdown-option>
|
80
|
-
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
81
|
-
</glide-core-dropdown>`);
|
82
|
-
const options = component.querySelectorAll('glide-core-dropdown-option');
|
83
|
-
expect(options[0]?.privateActive).to.be.true;
|
84
|
-
expect(options[1]?.privateActive).to.be.false;
|
85
|
-
});
|
86
|
-
it('activates the last selected option when options are initially selected', async () => {
|
87
|
-
const component = await fixture(html `<glide-core-dropdown open>
|
88
|
-
<glide-core-dropdown-option label="One"></glide-core-dropdown-option>
|
89
|
-
|
90
|
-
<glide-core-dropdown-option
|
91
|
-
label="Two"
|
92
|
-
selected
|
93
|
-
></glide-core-dropdown-option>
|
94
|
-
|
95
|
-
<glide-core-dropdown-option
|
96
|
-
label="Three"
|
97
|
-
selected
|
98
|
-
></glide-core-dropdown-option>
|
99
|
-
</glide-core-dropdown>`);
|
100
|
-
const options = component.querySelectorAll('glide-core-dropdown-option');
|
101
|
-
expect(options[0]?.privateActive).to.be.false;
|
102
|
-
expect(options[1]?.privateActive).to.be.false;
|
103
|
-
expect(options[2]?.privateActive).to.be.true;
|
104
|
-
});
|
105
|
-
it('is scrollable', async () => {
|
106
|
-
const component = await fixture(html `<glide-core-dropdown open>
|
107
|
-
<glide-core-dropdown-option label="One"></glide-core-dropdown-option>
|
108
|
-
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
109
|
-
<glide-core-dropdown-option label="Three"></glide-core-dropdown-option>
|
110
|
-
<glide-core-dropdown-option label="Four"></glide-core-dropdown-option>
|
111
|
-
<glide-core-dropdown-option label="Five"></glide-core-dropdown-option>
|
112
|
-
<glide-core-dropdown-option label="Six"></glide-core-dropdown-option>
|
113
|
-
<glide-core-dropdown-option label="Seven"></glide-core-dropdown-option>
|
114
|
-
<glide-core-dropdown-option label="Eight"></glide-core-dropdown-option>
|
115
|
-
<glide-core-dropdown-option label="Nine"></glide-core-dropdown-option>
|
116
|
-
<glide-core-dropdown-option label="Ten"></glide-core-dropdown-option>
|
117
|
-
</glide-core-dropdown>`);
|
118
|
-
// Wait for it to open.
|
119
|
-
await aTimeout(0);
|
120
|
-
const options = component.shadowRoot?.querySelector('[data-test="options"]');
|
121
|
-
assert(options);
|
122
|
-
expect(options.scrollHeight).to.be.greaterThan(options.clientHeight);
|
123
|
-
});
|
124
|
-
it('is not scrollable', async () => {
|
125
|
-
const component = await fixture(html `<glide-core-dropdown open>
|
126
|
-
<glide-core-dropdown-option label="One"></glide-core-dropdown-option>
|
127
|
-
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
128
|
-
<glide-core-dropdown-option label="Three"></glide-core-dropdown-option>
|
129
|
-
<glide-core-dropdown-option label="Four"></glide-core-dropdown-option>
|
130
|
-
<glide-core-dropdown-option label="Five"></glide-core-dropdown-option>
|
131
|
-
<glide-core-dropdown-option label="Six"></glide-core-dropdown-option>
|
132
|
-
<glide-core-dropdown-option label="Seven"></glide-core-dropdown-option>
|
133
|
-
<glide-core-dropdown-option label="Eight"></glide-core-dropdown-option>
|
134
|
-
<glide-core-dropdown-option label="Nine"></glide-core-dropdown-option>
|
135
|
-
</glide-core-dropdown>`);
|
136
|
-
// Wait for it to open.
|
137
|
-
await aTimeout(0);
|
138
|
-
const options = component.shadowRoot?.querySelector('[data-test="options"]');
|
139
|
-
assert(options);
|
140
|
-
expect(options.scrollHeight).to.equal(options.clientHeight);
|
141
|
-
});
|
142
|
-
it('throws if the default slot is the incorrect type', async () => {
|
143
|
-
await expectArgumentError(() => {
|
144
|
-
return fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
145
|
-
<button>Button</button>
|
146
|
-
</glide-core-dropdown>`);
|
147
|
-
});
|
148
|
-
});
|
149
|
-
it('does not throw if the default slot only contains whitespace', async () => {
|
150
|
-
const spy = sinon.spy();
|
151
|
-
try {
|
152
|
-
await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
|
153
|
-
${repeat([], () => html `<glide-core-dropdown-option
|
154
|
-
label="Option"
|
155
|
-
></glide-core-dropdown-option>`)}
|
156
|
-
</glide-core-dropdown>`);
|
157
|
-
}
|
158
|
-
catch (error) {
|
159
|
-
if (error instanceof ArgumentError) {
|
160
|
-
spy();
|
161
|
-
}
|
162
|
-
}
|
163
|
-
expect(spy.callCount).to.equal(0);
|
164
|
-
});
|
165
|
-
it('hides the tooltip of the active option when open', async () => {
|
166
|
-
// The period is arbitrary. 500 of them ensures we exceed the maximum
|
167
|
-
// width even if it's increased.
|
168
|
-
const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
|
169
|
-
<glide-core-dropdown-option
|
170
|
-
label=${'.'.repeat(500)}
|
171
|
-
></glide-core-dropdown-option>
|
172
|
-
|
173
|
-
<glide-core-dropdown-option label="Two"></glide-core-dropdown-option>
|
174
|
-
</glide-core-dropdown>`);
|
175
|
-
// Wait for it to open.
|
176
|
-
await aTimeout(0);
|
177
|
-
const tooltip = component
|
178
|
-
.querySelector('glide-core-dropdown-option')
|
179
|
-
?.shadowRoot?.querySelector('[data-test="tooltip"]');
|
180
|
-
expect(tooltip?.checkVisibility()).to.be.false;
|
181
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
import './dropdown.option.js';
|