@crowdstrike/glide-core 0.9.5 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -53
- package/dist/accordion.d.ts +10 -10
- package/dist/accordion.js +1 -1
- package/dist/accordion.stories.d.ts +0 -1
- package/dist/accordion.styles.js +36 -38
- package/dist/accordion.test.basics.js +13 -95
- package/dist/accordion.test.events.js +21 -33
- package/dist/accordion.test.focus.d.ts +1 -0
- package/dist/accordion.test.focus.js +11 -0
- package/dist/accordion.test.interactions.d.ts +1 -0
- package/dist/accordion.test.interactions.js +75 -0
- package/dist/button-group.button.d.ts +2 -4
- package/dist/button-group.button.js +1 -1
- package/dist/button-group.button.styles.js +6 -14
- package/dist/button-group.button.test.basics.js +8 -17
- package/dist/button-group.button.test.interactions.js +4 -4
- package/dist/button-group.d.ts +0 -2
- package/dist/button-group.test.basics.js +10 -10
- package/dist/button-group.test.events.js +2 -2
- package/dist/button-group.test.interactions.js +1 -1
- package/dist/button.d.ts +7 -10
- package/dist/button.js +1 -1
- package/dist/button.styles.js +4 -7
- package/dist/button.test.basics.js +10 -26
- package/dist/button.test.events.js +9 -9
- package/dist/checkbox-group.d.ts +3 -4
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox-group.styles.js +13 -1
- package/dist/checkbox-group.test.basics.js +8 -12
- package/dist/checkbox-group.test.focus.js +7 -7
- package/dist/checkbox-group.test.interactions.d.ts +1 -0
- package/dist/checkbox-group.test.interactions.js +82 -0
- package/dist/checkbox.d.ts +5 -4
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.styles.js +35 -15
- package/dist/checkbox.test.basics.js +6 -15
- package/dist/checkbox.test.focus.js +4 -2
- package/dist/checkbox.test.interactions.js +11 -11
- package/dist/drawer.d.ts +2 -5
- package/dist/drawer.js +1 -1
- package/dist/drawer.test.accessibility.js +8 -8
- package/dist/drawer.test.basics.js +16 -16
- package/dist/drawer.test.closing.js +18 -16
- package/dist/drawer.test.events.js +13 -24
- package/dist/drawer.test.methods.js +22 -22
- package/dist/dropdown.d.ts +7 -5
- package/dist/dropdown.js +1 -1
- package/dist/dropdown.option.d.ts +1 -3
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +31 -19
- package/dist/dropdown.option.test.basics.js +4 -4
- package/dist/dropdown.styles.js +39 -3
- package/dist/dropdown.test.basics.js +8 -13
- package/dist/dropdown.test.basics.multiple.js +63 -31
- package/dist/dropdown.test.basics.single.js +49 -0
- package/dist/dropdown.test.focus.filterable.js +12 -3
- package/dist/dropdown.test.focus.js +18 -2
- package/dist/dropdown.test.interactions.filterable.js +121 -45
- package/dist/dropdown.test.interactions.multiple.js +71 -30
- package/dist/dropdown.test.interactions.single.js +26 -4
- package/dist/form-controls-layout.d.ts +0 -2
- package/dist/icon-button.d.ts +2 -4
- package/dist/icon-button.js +1 -1
- package/dist/icon-button.test.basics.js +14 -82
- package/dist/icon-button.test.focus.d.ts +1 -0
- package/dist/icon-button.test.focus.js +13 -0
- package/dist/input.d.ts +4 -5
- package/dist/input.js +1 -1
- package/dist/input.styles.js +4 -4
- package/dist/input.test.basics.js +0 -52
- package/dist/input.test.events.js +27 -27
- package/dist/input.test.focus.js +27 -26
- package/dist/input.test.form.js +6 -6
- package/dist/input.test.validity.js +130 -130
- package/dist/label.d.ts +1 -3
- package/dist/label.js +1 -1
- package/dist/label.styles.js +5 -6
- package/dist/label.test.basics.js +4 -4
- package/dist/library/ow.js +1 -1
- package/dist/menu.button.d.ts +0 -2
- package/dist/menu.button.test.basics.js +3 -3
- package/dist/menu.d.ts +1 -4
- package/dist/menu.js +1 -1
- package/dist/menu.link.d.ts +1 -2
- package/dist/menu.link.js +1 -1
- package/dist/menu.options.d.ts +0 -2
- package/dist/menu.test.events.js +6 -6
- package/dist/menu.test.focus.js +5 -18
- package/dist/menu.test.interactions.js +48 -24
- package/dist/modal.d.ts +6 -17
- package/dist/modal.icon-button.d.ts +0 -2
- package/dist/modal.icon-button.test.basics.js +3 -3
- package/dist/modal.js +1 -1
- package/dist/modal.styles.js +13 -19
- package/dist/modal.tertiary-icon.d.ts +0 -3
- package/dist/modal.tertiary-icon.test.basics.js +3 -3
- package/dist/modal.test.basics.js +9 -5
- package/dist/modal.test.close.js +2 -2
- package/dist/modal.test.events.js +2 -2
- package/dist/radio-group.d.ts +0 -3
- package/dist/radio-group.js +1 -1
- package/dist/radio-group.test.basics.js +61 -61
- package/dist/radio-group.test.events.js +13 -13
- package/dist/radio-group.test.focus.js +1 -1
- package/dist/radio-group.test.form.js +2 -2
- package/dist/radio-group.test.validity.js +12 -12
- package/dist/radio.d.ts +0 -3
- package/dist/radio.styles.js +4 -12
- package/dist/split-button.d.ts +8 -11
- package/dist/split-button.js +1 -1
- package/dist/split-button.primary-button.d.ts +21 -0
- package/dist/split-button.primary-button.js +1 -0
- package/dist/split-button.primary-button.styles.js +96 -0
- package/dist/split-button.primary-button.test.basics.d.ts +1 -0
- package/dist/split-button.primary-button.test.basics.js +31 -0
- package/dist/split-button.primary-button.test.focus.d.ts +1 -0
- package/dist/split-button.primary-button.test.focus.js +14 -0
- package/dist/split-button.primary-link.d.ts +19 -0
- package/dist/split-button.primary-link.js +1 -0
- package/dist/split-button.primary-link.test.basics.d.ts +1 -0
- package/dist/split-button.primary-link.test.basics.js +30 -0
- package/dist/split-button.primary-link.test.focus.d.ts +1 -0
- package/dist/split-button.primary-link.test.focus.js +15 -0
- package/dist/split-button.secondary-button.d.ts +25 -0
- package/dist/split-button.secondary-button.js +1 -0
- package/dist/split-button.secondary-button.styles.js +103 -0
- package/dist/split-button.secondary-button.test.basics.d.ts +1 -0
- package/dist/split-button.secondary-button.test.basics.js +58 -0
- package/dist/split-button.secondary-button.test.focus.d.ts +1 -0
- package/dist/split-button.secondary-button.test.focus.js +14 -0
- package/dist/split-button.secondary-button.test.interactions.d.ts +2 -0
- package/dist/split-button.secondary-button.test.interactions.js +30 -0
- package/dist/split-button.stories.d.ts +4 -3
- package/dist/split-button.styles.js +1 -94
- package/dist/split-button.test.basics.d.ts +2 -1
- package/dist/split-button.test.basics.js +67 -80
- package/dist/split-button.test.interactions.d.ts +4 -0
- package/dist/split-button.test.interactions.js +51 -0
- package/dist/styles/opacity-and-scale-animation.js +2 -6
- package/dist/styles/variables.css +1 -1
- package/dist/tab.d.ts +2 -11
- package/dist/tab.group.d.ts +2 -5
- package/dist/tab.group.styles.js +12 -15
- package/dist/tab.group.test.basics.js +49 -34
- package/dist/tab.group.test.interactions.js +17 -14
- package/dist/tab.panel.d.ts +0 -3
- package/dist/tab.test.basics.js +6 -5
- package/dist/tag.d.ts +6 -4
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +36 -36
- package/dist/tag.test.basics.js +16 -109
- package/dist/tag.test.events.js +12 -8
- package/dist/tag.test.focus.js +2 -3
- package/dist/tag.test.interactions.d.ts +1 -0
- package/dist/tag.test.interactions.js +34 -0
- package/dist/textarea.d.ts +2 -3
- package/dist/textarea.js +2 -2
- package/dist/textarea.test.basics.js +8 -8
- package/dist/textarea.test.events.js +55 -55
- package/dist/textarea.test.form.js +9 -9
- package/dist/textarea.test.validity.js +167 -135
- package/dist/toasts.d.ts +1 -5
- package/dist/toasts.test.basics.js +2 -1
- package/dist/toasts.toast.d.ts +1 -4
- package/dist/toasts.toast.js +1 -1
- package/dist/toasts.toast.styles.js +12 -0
- package/dist/toggle.d.ts +0 -2
- package/dist/toggle.styles.js +1 -5
- package/dist/toggle.test.basics.js +2 -2
- package/dist/toggle.test.interactions.js +7 -7
- package/dist/tooltip.d.ts +2 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.styles.js +37 -14
- package/dist/tooltip.test.basics.d.ts +1 -1
- package/dist/tooltip.test.basics.js +19 -19
- package/dist/tree.d.ts +0 -2
- package/dist/tree.item.d.ts +5 -7
- package/dist/tree.item.icon-button.d.ts +1 -4
- package/dist/tree.item.js +1 -1
- package/dist/tree.item.menu.d.ts +0 -2
- package/dist/tree.item.menu.test.basics.js +9 -9
- package/dist/tree.item.styles.js +4 -3
- package/dist/tree.item.test.basics.js +43 -31
- package/dist/tree.test.basics.js +29 -29
- package/dist/tree.test.focus.js +77 -74
- package/package.json +12 -14
- package/dist/split-container.d.ts +0 -31
- package/dist/split-container.js +0 -1
- package/dist/split-container.styles.js +0 -132
- package/dist/split-container.test.basics.d.ts +0 -3
- package/dist/split-container.test.basics.js +0 -445
- package/dist/split-container.test.interactions.d.ts +0 -1
- package/dist/split-container.test.interactions.js +0 -20
- package/dist/split-link.d.ts +0 -25
- package/dist/split-link.js +0 -1
- package/dist/split-link.test.basics.d.ts +0 -1
- package/dist/split-link.test.basics.js +0 -93
- package/dist/split-link.test.interactions.d.ts +0 -1
- package/dist/split-link.test.interactions.js +0 -20
- package/dist/status-indicator.d.ts +0 -30
- package/dist/status-indicator.js +0 -1
- package/dist/status-indicator.stories.d.ts +0 -5
- package/dist/status-indicator.styles.js +0 -58
- package/dist/status-indicator.test.basics.d.ts +0 -1
- package/dist/status-indicator.test.basics.js +0 -102
- /package/dist/{split-container.styles.d.ts → split-button.primary-button.styles.d.ts} +0 -0
- /package/dist/{status-indicator.styles.d.ts → split-button.secondary-button.styles.d.ts} +0 -0
@@ -1,445 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import './split-button.js';
|
3
|
-
import './split-container.js';
|
4
|
-
import './split-link.js';
|
5
|
-
import { elementUpdated, expect, fixture, html, waitUntil, } from '@open-wc/testing';
|
6
|
-
import GlideCoreMenuButton from './menu.button.js';
|
7
|
-
import GlideCoreMenuLink from './menu.link.js';
|
8
|
-
import GlideCoreSplitButton from './split-button.js';
|
9
|
-
import GlideCoreSplitContainer from './split-container.js';
|
10
|
-
import GlideCoreSplitLink from './split-link.js';
|
11
|
-
import expectArgumentError from './library/expect-argument-error.js';
|
12
|
-
import sinon from 'sinon';
|
13
|
-
GlideCoreSplitContainer.shadowRootOptions.mode = 'open';
|
14
|
-
GlideCoreMenuButton.shadowRootOptions.mode = 'open';
|
15
|
-
GlideCoreMenuLink.shadowRootOptions.mode = 'open';
|
16
|
-
it('registers', async () => {
|
17
|
-
expect(window.customElements.get('glide-core-split-container')).to.equal(GlideCoreSplitContainer);
|
18
|
-
});
|
19
|
-
it('is accessible', async () => {
|
20
|
-
const component = await fixture(html `
|
21
|
-
<glide-core-split-container menu-label="label">
|
22
|
-
<glide-core-split-button slot="primary-action"
|
23
|
-
>Button</glide-core-split-button
|
24
|
-
>
|
25
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
26
|
-
<glide-core-menu-link label="Two" url="/two"></glide-core-menu-link>
|
27
|
-
<glide-core-menu-button label="Three"></glide-core-menu-button>
|
28
|
-
</glide-core-split-container>
|
29
|
-
`);
|
30
|
-
await expect(component).to.be.accessible();
|
31
|
-
});
|
32
|
-
it('should render a split button, a divider, and a menu button', async () => {
|
33
|
-
const component = await fixture(html `
|
34
|
-
<glide-core-split-container menu-label="label">
|
35
|
-
<glide-core-split-button slot="primary-action"
|
36
|
-
>Button</glide-core-split-button
|
37
|
-
>
|
38
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
39
|
-
</glide-core-split-container>
|
40
|
-
`);
|
41
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]'))
|
42
|
-
.to.be.not.null;
|
43
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-divider"]')).to
|
44
|
-
.be.not.null;
|
45
|
-
const slot = component?.shadowRoot?.querySelector('slot[data-test="primary-action"]');
|
46
|
-
expect(slot).to.be.not.null;
|
47
|
-
const defaultSlotValue = slot.assignedNodes()?.at(0);
|
48
|
-
expect(defaultSlotValue instanceof GlideCoreSplitButton).to.be.true;
|
49
|
-
expect(defaultSlotValue?.textContent).to.equal('Button');
|
50
|
-
});
|
51
|
-
it('should render a split link, a divider, and a menu button', async () => {
|
52
|
-
const component = await fixture(html `
|
53
|
-
<glide-core-split-container menu-label="label">
|
54
|
-
<glide-core-split-link slot="primary-action">Link</glide-core-split-link>
|
55
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
56
|
-
</glide-core-split-container>
|
57
|
-
`);
|
58
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]'))
|
59
|
-
.to.be.not.null;
|
60
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-divider"]')).to
|
61
|
-
.be.not.null;
|
62
|
-
const slot = component?.shadowRoot?.querySelector('slot[data-test="primary-action"]');
|
63
|
-
expect(slot).to.be.not.null;
|
64
|
-
const defaultSlotValue = slot.assignedNodes()?.at(0);
|
65
|
-
expect(defaultSlotValue instanceof GlideCoreSplitLink).to.be.true;
|
66
|
-
expect(defaultSlotValue?.textContent).to.equal('Link');
|
67
|
-
});
|
68
|
-
it('does not set the menu to "open" by default', async () => {
|
69
|
-
const component = await fixture(html `
|
70
|
-
<glide-core-split-container menu-label="label">
|
71
|
-
<glide-core-split-button slot="primary-action"
|
72
|
-
>Button</glide-core-split-button
|
73
|
-
>
|
74
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
75
|
-
</glide-core-split-container>
|
76
|
-
`);
|
77
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.not.have.attribute('open');
|
78
|
-
});
|
79
|
-
it('sets the menu component to "open" when the "open" attribute is set', async () => {
|
80
|
-
const component = await fixture(html `
|
81
|
-
<glide-core-split-container menu-label="label" open>
|
82
|
-
<glide-core-split-button slot="primary-action"
|
83
|
-
>Button</glide-core-split-button
|
84
|
-
>
|
85
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
86
|
-
</glide-core-split-container>
|
87
|
-
`);
|
88
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('open');
|
89
|
-
});
|
90
|
-
it('applies appropriate classes and attributes when "size" is set to "small"', async () => {
|
91
|
-
const component = await fixture(html `
|
92
|
-
<glide-core-split-container menu-label="label" size="small">
|
93
|
-
<glide-core-split-button slot="primary-action"
|
94
|
-
>Button</glide-core-split-button
|
95
|
-
>
|
96
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
97
|
-
</glide-core-split-container>
|
98
|
-
`);
|
99
|
-
expect(component.shadowRoot
|
100
|
-
?.querySelector('[data-test="primary-action"]')
|
101
|
-
?.assignedNodes()
|
102
|
-
?.at(0)).to.have.attribute('size', 'small');
|
103
|
-
expect(component.shadowRoot
|
104
|
-
?.querySelector('[data-test="split-menu-button"]')
|
105
|
-
?.classList.contains('small')).to.be.true;
|
106
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'small');
|
107
|
-
});
|
108
|
-
it('applies appropriate classes and attributes when "size" is set to "large"', async () => {
|
109
|
-
const component = await fixture(html `
|
110
|
-
<glide-core-split-container menu-label="label" size="large">
|
111
|
-
<glide-core-split-button slot="primary-action"
|
112
|
-
>Button</glide-core-split-button
|
113
|
-
>
|
114
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
115
|
-
</glide-core-split-container>
|
116
|
-
`);
|
117
|
-
expect(component.shadowRoot
|
118
|
-
?.querySelector('[data-test="primary-action"]')
|
119
|
-
?.assignedNodes()
|
120
|
-
?.at(0)).to.have.attribute('size', 'large');
|
121
|
-
expect(component.shadowRoot
|
122
|
-
?.querySelector('[data-test="split-menu-button"]')
|
123
|
-
?.classList.contains('large')).to.be.true;
|
124
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'large');
|
125
|
-
});
|
126
|
-
it('applies appropriate classes and attributes by default as "large" when "size" is not set', async () => {
|
127
|
-
const component = await fixture(html `
|
128
|
-
<glide-core-split-container menu-label="label">
|
129
|
-
<glide-core-split-button slot="primary-action"
|
130
|
-
>Button</glide-core-split-button
|
131
|
-
>
|
132
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
133
|
-
</glide-core-split-container>
|
134
|
-
`);
|
135
|
-
expect(component.shadowRoot
|
136
|
-
?.querySelector('[data-test="primary-action"]')
|
137
|
-
?.assignedNodes()
|
138
|
-
?.at(0)).to.have.attribute('size', 'large');
|
139
|
-
expect(component.shadowRoot
|
140
|
-
?.querySelector('[data-test="split-menu-button"]')
|
141
|
-
?.classList.contains('large')).to.be.true;
|
142
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'large');
|
143
|
-
});
|
144
|
-
it('applies appropriate classes and attributes when "size" is dynamically changed using the split button', async () => {
|
145
|
-
const component = await fixture(html `
|
146
|
-
<glide-core-split-container menu-label="label" size="large">
|
147
|
-
<glide-core-split-button slot="primary-action"
|
148
|
-
>Button</glide-core-split-button
|
149
|
-
>
|
150
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
151
|
-
</glide-core-split-container>
|
152
|
-
`);
|
153
|
-
expect(component.shadowRoot
|
154
|
-
?.querySelector('[data-test="primary-action"]')
|
155
|
-
?.assignedNodes()
|
156
|
-
?.at(0)).to.have.attribute('size', 'large');
|
157
|
-
expect(component.shadowRoot
|
158
|
-
?.querySelector('[data-test="split-menu-button"]')
|
159
|
-
?.classList.contains('large')).to.be.true;
|
160
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'large');
|
161
|
-
component.size = 'small';
|
162
|
-
await elementUpdated(component);
|
163
|
-
expect(component.shadowRoot
|
164
|
-
?.querySelector('[data-test="primary-action"]')
|
165
|
-
?.assignedNodes()
|
166
|
-
?.at(0)).to.have.attribute('size', 'small');
|
167
|
-
expect(component.shadowRoot
|
168
|
-
?.querySelector('[data-test="split-menu-button"]')
|
169
|
-
?.classList.contains('small')).to.be.true;
|
170
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'small');
|
171
|
-
});
|
172
|
-
it('applies appropriate classes and attributes when "size" is dynamically changed using the link button', async () => {
|
173
|
-
const component = await fixture(html `
|
174
|
-
<glide-core-split-container menu-label="label" size="large">
|
175
|
-
<glide-core-split-link slot="primary-action" url="/"
|
176
|
-
>Button</glide-core-split-link
|
177
|
-
>
|
178
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
179
|
-
</glide-core-split-container>
|
180
|
-
`);
|
181
|
-
expect(component.shadowRoot
|
182
|
-
?.querySelector('[data-test="primary-action"]')
|
183
|
-
?.assignedNodes()
|
184
|
-
?.at(0)).to.have.attribute('size', 'large');
|
185
|
-
expect(component.shadowRoot
|
186
|
-
?.querySelector('[data-test="split-menu-button"]')
|
187
|
-
?.classList.contains('large')).to.be.true;
|
188
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'large');
|
189
|
-
component.size = 'small';
|
190
|
-
await elementUpdated(component);
|
191
|
-
expect(component.shadowRoot
|
192
|
-
?.querySelector('[data-test="primary-action"]')
|
193
|
-
?.assignedNodes()
|
194
|
-
?.at(0)).to.have.attribute('size', 'small');
|
195
|
-
expect(component.shadowRoot
|
196
|
-
?.querySelector('[data-test="split-menu-button"]')
|
197
|
-
?.classList.contains('small')).to.be.true;
|
198
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('size', 'small');
|
199
|
-
});
|
200
|
-
it('applies appropriate classes and sets the "variant" to "primary" by default', async () => {
|
201
|
-
const component = await fixture(html `
|
202
|
-
<glide-core-split-container menu-label="label">
|
203
|
-
<glide-core-split-button slot="primary-action"
|
204
|
-
>Button</glide-core-split-button
|
205
|
-
>
|
206
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
207
|
-
</glide-core-split-container>
|
208
|
-
`);
|
209
|
-
expect(component.shadowRoot
|
210
|
-
?.querySelector('[data-test="primary-action"]')
|
211
|
-
?.assignedNodes()
|
212
|
-
?.at(0)).to.have.attribute('variant', 'primary');
|
213
|
-
expect(component.shadowRoot
|
214
|
-
?.querySelector('[data-test="split-menu-button"]')
|
215
|
-
?.classList.contains('primary')).to.be.true;
|
216
|
-
expect(component.shadowRoot
|
217
|
-
?.querySelector('[data-test="split-divider"]')
|
218
|
-
?.classList.contains('primary')).to.be.true;
|
219
|
-
});
|
220
|
-
it('applies appropriate classes when "variant" is set to "primary"', async () => {
|
221
|
-
const component = await fixture(html `
|
222
|
-
<glide-core-split-container menu-label="label" variant="primary">
|
223
|
-
<glide-core-split-button slot="primary-action"
|
224
|
-
>Button</glide-core-split-button
|
225
|
-
>
|
226
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
227
|
-
</glide-core-split-container>
|
228
|
-
`);
|
229
|
-
expect(component.shadowRoot
|
230
|
-
?.querySelector('[data-test="primary-action"]')
|
231
|
-
?.assignedNodes()
|
232
|
-
?.at(0)).to.have.attribute('variant', 'primary');
|
233
|
-
expect(component.shadowRoot
|
234
|
-
?.querySelector('[data-test="split-menu-button"]')
|
235
|
-
?.classList.contains('primary')).to.be.true;
|
236
|
-
expect(component.shadowRoot
|
237
|
-
?.querySelector('[data-test="split-divider"]')
|
238
|
-
?.classList.contains('primary')).to.be.true;
|
239
|
-
});
|
240
|
-
it('applies appropriate classes when "variant" is set to "secondary"', async () => {
|
241
|
-
const component = await fixture(html `
|
242
|
-
<glide-core-split-container menu-label="label" variant="secondary">
|
243
|
-
<glide-core-split-button slot="primary-action"
|
244
|
-
>Button</glide-core-split-button
|
245
|
-
>
|
246
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
247
|
-
</glide-core-split-container>
|
248
|
-
`);
|
249
|
-
expect(component.shadowRoot
|
250
|
-
?.querySelector('[data-test="primary-action"]')
|
251
|
-
?.assignedNodes()
|
252
|
-
?.at(0)).to.have.attribute('variant', 'secondary');
|
253
|
-
expect(component.shadowRoot
|
254
|
-
?.querySelector('[data-test="split-menu-button"]')
|
255
|
-
?.classList.contains('secondary')).to.be.true;
|
256
|
-
expect(component.shadowRoot
|
257
|
-
?.querySelector('[data-test="split-divider"]')
|
258
|
-
?.classList.contains('secondary')).to.be.true;
|
259
|
-
});
|
260
|
-
it('applies appropriate classes and attributes when "variant" is dynamically changed using the split button', async () => {
|
261
|
-
const component = await fixture(html `
|
262
|
-
<glide-core-split-container menu-label="label" variant="primary">
|
263
|
-
<glide-core-split-button slot="primary-action"
|
264
|
-
>Button</glide-core-split-button
|
265
|
-
>
|
266
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
267
|
-
</glide-core-split-container>
|
268
|
-
`);
|
269
|
-
expect(component.shadowRoot
|
270
|
-
?.querySelector('[data-test="primary-action"]')
|
271
|
-
?.assignedNodes()
|
272
|
-
?.at(0)).to.have.attribute('variant', 'primary');
|
273
|
-
expect(component.shadowRoot
|
274
|
-
?.querySelector('[data-test="split-menu-button"]')
|
275
|
-
?.classList.contains('primary')).to.be.true;
|
276
|
-
expect(component.shadowRoot
|
277
|
-
?.querySelector('[data-test="split-divider"]')
|
278
|
-
?.classList.contains('primary')).to.be.true;
|
279
|
-
component.variant = 'secondary';
|
280
|
-
await elementUpdated(component);
|
281
|
-
expect(component.shadowRoot
|
282
|
-
?.querySelector('[data-test="primary-action"]')
|
283
|
-
?.assignedNodes()
|
284
|
-
?.at(0)).to.have.attribute('variant', 'secondary');
|
285
|
-
expect(component.shadowRoot
|
286
|
-
?.querySelector('[data-test="split-menu-button"]')
|
287
|
-
?.classList.contains('secondary')).to.be.true;
|
288
|
-
expect(component.shadowRoot
|
289
|
-
?.querySelector('[data-test="split-divider"]')
|
290
|
-
?.classList.contains('secondary')).to.be.true;
|
291
|
-
});
|
292
|
-
it('applies appropriate classes and attributes when "variant" is dynamically changed using the link button', async () => {
|
293
|
-
const component = await fixture(html `
|
294
|
-
<glide-core-split-container menu-label="label" variant="primary">
|
295
|
-
<glide-core-split-link slot="primary-action" url="/"
|
296
|
-
>Button</glide-core-split-link
|
297
|
-
>
|
298
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
299
|
-
</glide-core-split-container>
|
300
|
-
`);
|
301
|
-
expect(component.shadowRoot
|
302
|
-
?.querySelector('[data-test="primary-action"]')
|
303
|
-
?.assignedNodes()
|
304
|
-
?.at(0)).to.have.attribute('variant', 'primary');
|
305
|
-
expect(component.shadowRoot
|
306
|
-
?.querySelector('[data-test="split-menu-button"]')
|
307
|
-
?.classList.contains('primary')).to.be.true;
|
308
|
-
expect(component.shadowRoot
|
309
|
-
?.querySelector('[data-test="split-divider"]')
|
310
|
-
?.classList.contains('primary')).to.be.true;
|
311
|
-
component.variant = 'secondary';
|
312
|
-
await elementUpdated(component);
|
313
|
-
expect(component.shadowRoot
|
314
|
-
?.querySelector('[data-test="primary-action"]')
|
315
|
-
?.assignedNodes()
|
316
|
-
?.at(0)).to.have.attribute('variant', 'secondary');
|
317
|
-
expect(component.shadowRoot
|
318
|
-
?.querySelector('[data-test="split-menu-button"]')
|
319
|
-
?.classList.contains('secondary')).to.be.true;
|
320
|
-
expect(component.shadowRoot
|
321
|
-
?.querySelector('[data-test="split-divider"]')
|
322
|
-
?.classList.contains('secondary')).to.be.true;
|
323
|
-
});
|
324
|
-
it('sets the appropriate classes and attributes when the "disabled" attribute is set', async () => {
|
325
|
-
const component = await fixture(html `
|
326
|
-
<glide-core-split-container menu-label="label" disabled>
|
327
|
-
<glide-core-split-button slot="primary-action"
|
328
|
-
>Button</glide-core-split-button
|
329
|
-
>
|
330
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
331
|
-
</glide-core-split-container>
|
332
|
-
`);
|
333
|
-
expect(component.shadowRoot
|
334
|
-
?.querySelector('[data-test="primary-action"]')
|
335
|
-
?.assignedNodes()
|
336
|
-
?.at(0)).to.have.attribute('disabled');
|
337
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]')).to.have.attribute('disabled');
|
338
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]')).to.have.attribute('disabled');
|
339
|
-
});
|
340
|
-
it('applies appropriate classes and attributes when "disabled" is dynamically changed using the split button', async () => {
|
341
|
-
const component = await fixture(html `
|
342
|
-
<glide-core-split-container menu-label="label">
|
343
|
-
<glide-core-split-button slot="primary-action"
|
344
|
-
>Button</glide-core-split-button
|
345
|
-
>
|
346
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
347
|
-
</glide-core-split-container>
|
348
|
-
`);
|
349
|
-
expect(component.shadowRoot
|
350
|
-
?.querySelector('[data-test="primary-action"]')
|
351
|
-
?.assignedNodes()
|
352
|
-
?.at(0)).to.not.have.attribute('disabled');
|
353
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]')).to.not.have.attribute('disabled');
|
354
|
-
component.disabled = true;
|
355
|
-
await elementUpdated(component);
|
356
|
-
expect(component.shadowRoot
|
357
|
-
?.querySelector('[data-test="primary-action"]')
|
358
|
-
?.assignedNodes()
|
359
|
-
?.at(0)).to.have.attribute('disabled');
|
360
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]')).to.have.attribute('disabled');
|
361
|
-
});
|
362
|
-
it('applies appropriate classes and attributes when "disabled" is dynamically changed using the link button', async () => {
|
363
|
-
const component = await fixture(html `
|
364
|
-
<glide-core-split-container menu-label="label">
|
365
|
-
<glide-core-split-link slot="primary-action" url="/"
|
366
|
-
>Button</glide-core-split-link
|
367
|
-
>
|
368
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
369
|
-
</glide-core-split-container>
|
370
|
-
`);
|
371
|
-
expect(component.shadowRoot
|
372
|
-
?.querySelector('[data-test="primary-action"]')
|
373
|
-
?.assignedNodes()
|
374
|
-
?.at(0)).to.not.have.attribute('disabled');
|
375
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]')).to.not.have.attribute('disabled');
|
376
|
-
component.disabled = true;
|
377
|
-
await elementUpdated(component);
|
378
|
-
expect(component.shadowRoot
|
379
|
-
?.querySelector('[data-test="primary-action"]')
|
380
|
-
?.assignedNodes()
|
381
|
-
?.at(0)).to.have.attribute('disabled');
|
382
|
-
expect(component.shadowRoot?.querySelector('[data-test="split-menu-button"]')).to.have.attribute('disabled');
|
383
|
-
});
|
384
|
-
it('sets the default "menu-placement" as "bottom-end"', async () => {
|
385
|
-
const component = await fixture(html `
|
386
|
-
<glide-core-split-container menu-label="label">
|
387
|
-
<glide-core-split-button slot="primary-action"
|
388
|
-
>Button</glide-core-split-button
|
389
|
-
>
|
390
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
391
|
-
</glide-core-split-container>
|
392
|
-
`);
|
393
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('placement', 'bottom-end');
|
394
|
-
});
|
395
|
-
it('sets the "menu-placement" attribute as specified', async () => {
|
396
|
-
const component = await fixture(html `
|
397
|
-
<glide-core-split-container menu-label="label" menu-placement="bottom">
|
398
|
-
<glide-core-split-button slot="primary-action"
|
399
|
-
>Button</glide-core-split-button
|
400
|
-
>
|
401
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
402
|
-
</glide-core-split-container>
|
403
|
-
`);
|
404
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('placement', 'bottom');
|
405
|
-
});
|
406
|
-
it('focuses the "primary-action" slotted element when the container component is focused', async () => {
|
407
|
-
const component = await fixture(html `
|
408
|
-
<glide-core-split-container menu-label="label" menu-placement="bottom">
|
409
|
-
<glide-core-split-button slot="primary-action"
|
410
|
-
>Button</glide-core-split-button
|
411
|
-
>
|
412
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
413
|
-
</glide-core-split-container>
|
414
|
-
`);
|
415
|
-
component.focus();
|
416
|
-
expect(component.shadowRoot
|
417
|
-
?.querySelector('[data-test="primary-action"]')
|
418
|
-
?.assignedNodes()
|
419
|
-
?.at(0)).to.have.focus;
|
420
|
-
});
|
421
|
-
it('throws an error when the default slot is empty', async () => {
|
422
|
-
await expectArgumentError(() => fixture(html `<glide-core-split-container menu-label="label">
|
423
|
-
<glide-core-split-button slot="primary-action"
|
424
|
-
>Button</glide-core-split-button
|
425
|
-
>
|
426
|
-
</glide-core-split-container>`));
|
427
|
-
});
|
428
|
-
it('throws an error when the default slot is an unsupported type', async () => {
|
429
|
-
await expectArgumentError(() => fixture(html `<glide-core-split-container menu-label="label">
|
430
|
-
<glide-core-split-button slot="primary-action">
|
431
|
-
Button
|
432
|
-
</glide-core-split-button>
|
433
|
-
<div>Option</div>
|
434
|
-
</glide-core-split-container>`));
|
435
|
-
// Menu is rendered asynchronously outside of Split Container's lifecycle
|
436
|
-
// and asserts against its default slot. That assertion, which is expected
|
437
|
-
// to fail in this case, results in an unhandled rejection that gets logged.
|
438
|
-
// `console.error` is stubbed so the logs aren't muddied.
|
439
|
-
const stub = sinon.stub(console, 'error');
|
440
|
-
// Menu asserts against its default slot once on `firstUpdated` and
|
441
|
-
// again on "slotchange". So we wait until the stub has been called
|
442
|
-
// twice before restoring it.
|
443
|
-
await waitUntil(() => stub.calledTwice);
|
444
|
-
stub.restore();
|
445
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
import './split-container.js';
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import './split-container.js';
|
2
|
-
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
3
|
-
import GlideCoreSplitContainer from './split-container.js';
|
4
|
-
GlideCoreSplitContainer.shadowRootOptions.mode = 'open';
|
5
|
-
it('the menu opens when the menu button is clicked', async () => {
|
6
|
-
const component = await fixture(html `
|
7
|
-
<glide-core-split-container menu-label="label">
|
8
|
-
<glide-core-split-button slot="primary-action"
|
9
|
-
>Button</glide-core-split-button
|
10
|
-
>
|
11
|
-
<glide-core-menu-link label="One" url="/one"></glide-core-menu-link>
|
12
|
-
</glide-core-split-container>
|
13
|
-
`);
|
14
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.not.have.attribute('open');
|
15
|
-
component.shadowRoot
|
16
|
-
?.querySelector('[data-test="split-menu-button"]')
|
17
|
-
?.click();
|
18
|
-
await elementUpdated(component);
|
19
|
-
expect(component.shadowRoot?.querySelector('glide-core-menu')).to.have.attribute('open');
|
20
|
-
});
|
package/dist/split-link.d.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import './menu.js';
|
2
|
-
import { LitElement } from 'lit';
|
3
|
-
declare global {
|
4
|
-
interface HTMLElementTagNameMap {
|
5
|
-
'glide-core-split-link': GlideCoreSplitLink;
|
6
|
-
}
|
7
|
-
}
|
8
|
-
/**
|
9
|
-
* @description - A link to be used in the `primary-action` slot of `glide-core-split-container`.
|
10
|
-
*
|
11
|
-
* @slot prefix - An optional icon slot to display before the label.
|
12
|
-
* @slot - A label for the contents of the link.
|
13
|
-
*/
|
14
|
-
export default class GlideCoreSplitLink extends LitElement {
|
15
|
-
#private;
|
16
|
-
static shadowRootOptions: ShadowRootInit;
|
17
|
-
static styles: import("lit").CSSResult[];
|
18
|
-
url?: string;
|
19
|
-
disabled: boolean;
|
20
|
-
variant: 'primary' | 'secondary';
|
21
|
-
size: 'large' | 'small';
|
22
|
-
firstUpdated(): void;
|
23
|
-
render(): import("lit").TemplateResult<1>;
|
24
|
-
private hasPrefixSlot;
|
25
|
-
}
|
package/dist/split-link.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,o,l){var i,s=arguments.length,r=s<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,l);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(r=(s<3?i(r):s>3?i(t,o,r):i(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r};import"./menu.js";import{LitElement,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{owSlot,owSlotType}from"./library/ow.js";import styles from"./split-button.styles.js";let GlideCoreSplitLink=class GlideCoreSplitLink extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.variant="primary",this.size="large",this.hasPrefixSlot=!1,this.#e=createRef(),this.#t=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:"closed"}}static{this.styles=styles}firstUpdated(){owSlot(this.#e.value),owSlotType(this.#e.value,[Text])}render(){return this.disabled?html`<span class="${classMap({component:!0,disabled:!0,[this.variant]:!0,[this.size]:!0,"has-prefix":this.hasPrefixSlot})}" aria-disabled="true" role="link" @keydown="${this.#o}" data-test="split-link"><slot name="prefix" @slotchange="${this.#l}" ${ref(this.#t)} data-test="prefix-slot"></slot><slot @slotchange="${this.#i}" ${ref(this.#e)} data-test="default-slot"></slot></span>`:html`<a href="${ifDefined(this.url)}" class="${classMap({component:!0,[this.variant]:!0,[this.size]:!0,"has-prefix":this.hasPrefixSlot})}" @keydown="${this.#o}" data-test="split-link"><slot name="prefix" @slotchange="${this.#l}" ${ref(this.#t)} data-test="prefix-slot"></slot><slot @slotchange="${this.#i}" ${ref(this.#e)} data-test="default-slot"></slot></a>`}#e;#t;#i(){owSlot(this.#e.value),owSlotType(this.#e.value,[Text])}#o(e){" "===e.key&&this.url?.length&&window.open(this.url)}#l(){const e=this.#t.value?.assignedNodes();this.hasPrefixSlot=!!(e&&e.length>0)}};__decorate([property({reflect:!0})],GlideCoreSplitLink.prototype,"url",void 0),__decorate([property({type:Boolean,reflect:!0})],GlideCoreSplitLink.prototype,"disabled",void 0),__decorate([property({reflect:!0})],GlideCoreSplitLink.prototype,"variant",void 0),__decorate([property({reflect:!0})],GlideCoreSplitLink.prototype,"size",void 0),__decorate([state()],GlideCoreSplitLink.prototype,"hasPrefixSlot",void 0),GlideCoreSplitLink=__decorate([customElement("glide-core-split-link")],GlideCoreSplitLink);export default GlideCoreSplitLink;
|
@@ -1 +0,0 @@
|
|
1
|
-
import './split-link.js';
|
@@ -1,93 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import './split-link.js';
|
3
|
-
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
|
4
|
-
import GlideCoreSplitLink from './split-link.js';
|
5
|
-
import expectArgumentError from './library/expect-argument-error.js';
|
6
|
-
GlideCoreSplitLink.shadowRootOptions.mode = 'open';
|
7
|
-
it('registers', async () => {
|
8
|
-
expect(window.customElements.get('glide-core-split-link')).to.equal(GlideCoreSplitLink);
|
9
|
-
});
|
10
|
-
it('is accessible', async () => {
|
11
|
-
const component = await fixture(html `
|
12
|
-
<glide-core-split-link url="/">Link</glide-core-split-link>
|
13
|
-
`);
|
14
|
-
await expect(component).to.be.accessible();
|
15
|
-
});
|
16
|
-
it('renders a link with href with a label by default', async () => {
|
17
|
-
const component = await fixture(html `
|
18
|
-
<glide-core-split-link url="/">Link</glide-core-split-link>
|
19
|
-
`);
|
20
|
-
const link = component?.shadowRoot?.querySelector('[data-test="split-link"]');
|
21
|
-
expect(link).to.not.be.null;
|
22
|
-
expect(link).to.have.attribute('href', '/');
|
23
|
-
expect(component?.textContent).to.equal('Link');
|
24
|
-
});
|
25
|
-
it('renders with size "large" and variant "primary" by default', async () => {
|
26
|
-
const component = await fixture(html `
|
27
|
-
<glide-core-split-link url="/">Link</glide-core-split-link>
|
28
|
-
`);
|
29
|
-
const link = component?.shadowRoot?.querySelector('[data-test="split-link"]');
|
30
|
-
expect(link?.classList.contains('large')).to.be.true;
|
31
|
-
expect(link?.classList.contains('primary')).to.be.true;
|
32
|
-
});
|
33
|
-
it('adds "small" styling when the "size" attribute is "small" ', async () => {
|
34
|
-
const component = await fixture(html `
|
35
|
-
<glide-core-split-link size="small" url="/">Link</glide-core-split-link>
|
36
|
-
`);
|
37
|
-
const link = component?.shadowRoot?.querySelector('[data-test="split-link"]');
|
38
|
-
expect(link?.classList.contains('small')).to.be.true;
|
39
|
-
});
|
40
|
-
it('adds "secondary" styling when "variant" attribute is "secondary"', async () => {
|
41
|
-
const component = await fixture(html `
|
42
|
-
<glide-core-split-link variant="secondary" url="/"
|
43
|
-
>Link</glide-core-split-link
|
44
|
-
>
|
45
|
-
`);
|
46
|
-
const link = component?.shadowRoot?.querySelector('[data-test="split-link"]');
|
47
|
-
expect(link?.classList.contains('secondary')).to.be.true;
|
48
|
-
});
|
49
|
-
it('becomes a span when the "disabled" attribute exists', async () => {
|
50
|
-
const component = await fixture(html `
|
51
|
-
<glide-core-split-link disabled url="/">Link</glide-core-split-link>
|
52
|
-
`);
|
53
|
-
const link = component?.shadowRoot?.querySelector('[data-test="split-link"]');
|
54
|
-
expect(link).to.have.attribute('aria-disabled', 'true');
|
55
|
-
expect(link).to.have.attribute('role', 'link');
|
56
|
-
});
|
57
|
-
it('renders a prefix slot when given', async () => {
|
58
|
-
const component = await fixture(html `
|
59
|
-
<glide-core-split-link url="/"
|
60
|
-
><div slot="prefix">Prefix</div>
|
61
|
-
Link</glide-core-split-link
|
62
|
-
>
|
63
|
-
`);
|
64
|
-
const link = component?.shadowRoot?.querySelector('[data-test="split-link"]');
|
65
|
-
expect(link).to.not.be.null;
|
66
|
-
expect(component.querySelector('[slot="prefix"]')?.textContent).to.equal('Prefix');
|
67
|
-
});
|
68
|
-
it('renders with prefix class when dynamically added and removed', async () => {
|
69
|
-
const component = await fixture(html `
|
70
|
-
<glide-core-split-link url="/"
|
71
|
-
><span slot="prefix">prefix</span>Link</glide-core-split-link
|
72
|
-
>
|
73
|
-
`);
|
74
|
-
expect(document.querySelector('[slot="prefix"]')).to.be.not.null;
|
75
|
-
expect([
|
76
|
-
...component.shadowRoot.querySelector('[data-test="split-link"]')
|
77
|
-
.classList,
|
78
|
-
]).to.include('has-prefix');
|
79
|
-
component.querySelector('[slot="prefix"]')?.remove();
|
80
|
-
await elementUpdated(component);
|
81
|
-
expect([
|
82
|
-
...component.shadowRoot.querySelector('[data-test="split-link"]')
|
83
|
-
.classList,
|
84
|
-
]).to.not.include('has-prefix');
|
85
|
-
});
|
86
|
-
it('throws an error when there is no link label', async () => {
|
87
|
-
await expectArgumentError(() => fixture(html `<glide-core-split-link url="/"></glide-core-split-link>`));
|
88
|
-
});
|
89
|
-
it('throws an error when there is something other than text in the default slot', async () => {
|
90
|
-
await expectArgumentError(() => fixture(html `<glide-core-split-link url="#"
|
91
|
-
><div>test</div></glide-core-split-link
|
92
|
-
>`));
|
93
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
import './split-link.js';
|
@@ -1,20 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
2
|
-
import './split-link.js';
|
3
|
-
import { expect, fixture, html } from '@open-wc/testing';
|
4
|
-
import { sendKeys } from '@web/test-runner-commands';
|
5
|
-
import GlideCoreSplitLink from './split-link.js';
|
6
|
-
import sinon from 'sinon';
|
7
|
-
GlideCoreSplitLink.shadowRootOptions.mode = 'open';
|
8
|
-
// This behavior exists to make the link behave like a button.
|
9
|
-
it('navigates when the spacebar is pressed', async () => {
|
10
|
-
const windowOpen = window.open;
|
11
|
-
const spy = sinon.spy();
|
12
|
-
window.open = spy;
|
13
|
-
const component = await fixture(html `
|
14
|
-
<glide-core-split-link url="/">Link</glide-core-split-link>
|
15
|
-
`);
|
16
|
-
component.focus();
|
17
|
-
await sendKeys({ press: ' ' });
|
18
|
-
expect(spy.callCount).to.equal(1);
|
19
|
-
window.open = windowOpen;
|
20
|
-
});
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { LitElement } from 'lit';
|
2
|
-
declare global {
|
3
|
-
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-status-indicator': GlideCoreStatusIndicator;
|
5
|
-
}
|
6
|
-
}
|
7
|
-
/**
|
8
|
-
* @cssprop [--size] - The size of the icon.
|
9
|
-
*/
|
10
|
-
export default class GlideCoreStatusIndicator extends LitElement {
|
11
|
-
static shadowRootOptions: ShadowRootInit;
|
12
|
-
static styles: import("lit").CSSResult[];
|
13
|
-
variant: keyof typeof ICONS;
|
14
|
-
render(): import("lit").TemplateResult<1>;
|
15
|
-
}
|
16
|
-
declare const ICONS: {
|
17
|
-
failed: import("lit").TemplateResult<2>;
|
18
|
-
idle: import("lit").TemplateResult<2>;
|
19
|
-
'in-progress': import("lit").TemplateResult<2>;
|
20
|
-
queued: import("lit").TemplateResult<2>;
|
21
|
-
scheduled: import("lit").TemplateResult<2>;
|
22
|
-
success: import("lit").TemplateResult<2>;
|
23
|
-
'warning-critical': import("lit").TemplateResult<2>;
|
24
|
-
'warning-high': import("lit").TemplateResult<2>;
|
25
|
-
'warning-informational': import("lit").TemplateResult<2>;
|
26
|
-
'warning-low': import("lit").TemplateResult<2>;
|
27
|
-
'warning-medium': import("lit").TemplateResult<2>;
|
28
|
-
'warning-zero': import("lit").TemplateResult<2>;
|
29
|
-
};
|
30
|
-
export {};
|