@crowdstrike/glide-core 0.12.0 → 0.12.2

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.
Files changed (49) hide show
  1. package/dist/dropdown.d.ts +1 -0
  2. package/dist/dropdown.js +43 -27
  3. package/dist/dropdown.option.d.ts +3 -0
  4. package/dist/dropdown.option.js +1 -1
  5. package/dist/dropdown.option.styles.js +79 -16
  6. package/dist/dropdown.option.test.basics.js +4 -33
  7. package/dist/dropdown.option.test.basics.multiple.js +9 -0
  8. package/dist/dropdown.option.test.basics.single.js +8 -0
  9. package/dist/dropdown.option.test.interactions.multiple.js +12 -0
  10. package/dist/dropdown.option.test.interactions.single.js +11 -0
  11. package/dist/dropdown.styles.js +20 -17
  12. package/dist/dropdown.test.events.js +67 -0
  13. package/dist/dropdown.test.events.single.js +87 -0
  14. package/dist/dropdown.test.focus.filterable.js +2 -2
  15. package/dist/dropdown.test.focus.js +2 -2
  16. package/dist/dropdown.test.focus.multiple.js +14 -8
  17. package/dist/dropdown.test.focus.single.js +6 -6
  18. package/dist/dropdown.test.form.js +22 -0
  19. package/dist/dropdown.test.interactions.filterable.js +3 -3
  20. package/dist/dropdown.test.interactions.js +175 -3
  21. package/dist/dropdown.test.interactions.multiple.js +74 -5
  22. package/dist/dropdown.test.interactions.single.js +42 -13
  23. package/dist/icons/pencil.d.ts +2 -0
  24. package/dist/icons/pencil.js +1 -0
  25. package/dist/library/localize.d.ts +2 -0
  26. package/dist/menu.js +1 -1
  27. package/dist/menu.options.js +1 -1
  28. package/dist/menu.options.test.events.d.ts +1 -0
  29. package/dist/menu.options.test.events.js +19 -0
  30. package/dist/menu.test.interactions.d.ts +1 -0
  31. package/dist/menu.test.interactions.js +38 -0
  32. package/dist/tab.group.d.ts +8 -1
  33. package/dist/tab.group.js +1 -1
  34. package/dist/tab.group.styles.js +11 -1
  35. package/dist/tab.group.test.basics.js +77 -1
  36. package/dist/tab.panel.js +1 -1
  37. package/dist/tab.panel.styles.js +18 -0
  38. package/dist/tag.d.ts +2 -0
  39. package/dist/tag.js +1 -1
  40. package/dist/tag.styles.js +46 -5
  41. package/dist/tag.test.basics.js +1 -1
  42. package/dist/tag.test.events.js +76 -3
  43. package/dist/tag.test.focus.js +1 -1
  44. package/dist/translations/en.js +1 -1
  45. package/dist/translations/fr.d.ts +1 -1
  46. package/dist/translations/fr.js +1 -1
  47. package/dist/translations/ja.d.ts +1 -1
  48. package/dist/translations/ja.js +1 -1
  49. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";import visuallyHidden from"./styles/visually-hidden.js";export default[css`
1
+ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";import visuallyHidden from"./styles/visually-hidden.js";export default[css`
2
+ ${focusOutline(".edit-button:focus-visible")}
2
3
  ${opacityAndScaleAnimation(".options:popover-open")}
3
4
  ${visuallyHidden(".selected-option-labels")}
4
5
  `,css`
@@ -67,27 +68,23 @@ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-s
67
68
  }
68
69
 
69
70
  &.quiet {
70
- &:is(:hover, :has(.button:focus-visible, .input:focus-visible)):not(
71
- &.error,
72
- &.disabled,
73
- &.multiple,
74
- &.readonly
75
- ) {
71
+ &:is(
72
+ :hover,
73
+ :has(.primary-button:focus-visible, .input:focus-visible)
74
+ ):not(&.error, &.disabled, &.multiple, &.readonly) {
76
75
  background-color: var(--glide-core-surface-hover);
77
76
  color: var(--glide-core-text-body-1);
78
77
  }
79
78
  }
80
79
 
81
- &:is(:hover, :has(.button:focus-visible, .input:focus-visible)):not(
82
- &.disabled,
83
- &.error,
84
- &.quiet,
85
- &.readonly
86
- ) {
80
+ &:is(
81
+ :hover,
82
+ :has(.primary-button:focus-visible, .input:focus-visible)
83
+ ):not(&.disabled, &.error, &.quiet, &.readonly) {
87
84
  border-color: var(--glide-core-border-focus);
88
85
  }
89
86
 
90
- &:has(.button:focus-visible, .input:focus-visible) {
87
+ &:has(.primary-button:focus-visible, .input:focus-visible) {
91
88
  &.quiet {
92
89
  border-color: var(--glide-core-border-focus);
93
90
  }
@@ -172,8 +169,8 @@ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-s
172
169
  }
173
170
  }
174
171
 
175
- .tag-overflow-text-and-button {
176
- column-gap: var(--glide-core-spacing-md);
172
+ .tag-overflow-and-buttons {
173
+ align-items: center;
177
174
  display: flex;
178
175
  margin-inline-start: auto;
179
176
  }
@@ -181,6 +178,7 @@ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-s
181
178
  .tag-overflow-text {
182
179
  align-content: center;
183
180
  color: var(--glide-core-text-link);
181
+ margin-inline-end: var(--glide-core-spacing-md);
184
182
  }
185
183
 
186
184
  .single-select-icon-slot {
@@ -205,7 +203,7 @@ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-s
205
203
  padding-block-start: 0.125rem;
206
204
  }
207
205
 
208
- .button {
206
+ .primary-button {
209
207
  align-items: center;
210
208
  background: none;
211
209
  block-size: var(--button-and-input-height);
@@ -219,6 +217,11 @@ import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-s
219
217
  }
220
218
  }
221
219
 
220
+ .edit-button {
221
+ display: flex;
222
+ margin-inline-end: var(--glide-core-spacing-xxs);
223
+ }
224
+
222
225
  .input {
223
226
  background-color: transparent;
224
227
  block-size: var(--button-and-input-height);
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-expressions */
2
2
  import * as sinon from 'sinon';
3
3
  import { aTimeout, assert, expect, fixture, html, oneEvent, } from '@open-wc/testing';
4
+ import { sendKeys } from '@web/test-runner-commands';
4
5
  import GlideCoreDropdown from './dropdown.js';
5
6
  import GlideCoreDropdownOption from './dropdown.option.js';
6
7
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
@@ -10,6 +11,72 @@ GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
10
11
  // timeout, which would make for a slow test. Its timeout can likely be
11
12
  // configured. But waiting a turn of the event loop, when which the event
12
13
  // will have been dispatched, gets the job done as well.
14
+ it('dispatches an "edit" event on click', async () => {
15
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
16
+ <glide-core-dropdown-option
17
+ label="Label"
18
+ editable
19
+ ></glide-core-dropdown-option>
20
+ </glide-core-dropdown>`);
21
+ setTimeout(() => {
22
+ const button = component
23
+ .querySelector('glide-core-dropdown-option')
24
+ ?.shadowRoot?.querySelector('[data-test="edit-button"]');
25
+ button?.dispatchEvent(new Event('mouseover'));
26
+ button?.click();
27
+ });
28
+ const option = component.querySelector('glide-core-dropdown-option');
29
+ assert(option);
30
+ const event = await oneEvent(option, 'edit');
31
+ expect(event instanceof Event).to.be.true;
32
+ expect(event.bubbles).to.be.true;
33
+ expect(event.composed).to.be.true;
34
+ expect(event.target).to.equal(option);
35
+ });
36
+ it('dispatches an "edit" event on Enter', async () => {
37
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
38
+ <glide-core-dropdown-option
39
+ label="Label"
40
+ editable
41
+ ></glide-core-dropdown-option>
42
+ </glide-core-dropdown>`);
43
+ component
44
+ .querySelector('glide-core-dropdown-option')
45
+ ?.shadowRoot?.querySelector('[data-test="edit-button"]')
46
+ ?.dispatchEvent(new Event('mouseover'));
47
+ component.focus();
48
+ await sendKeys({ press: 'ArrowDown' });
49
+ sendKeys({ press: 'Enter' });
50
+ const option = component.querySelector('glide-core-dropdown-option');
51
+ assert(option);
52
+ const event = await oneEvent(option, 'edit');
53
+ expect(event instanceof Event).to.be.true;
54
+ expect(event.bubbles).to.be.true;
55
+ expect(event.composed).to.be.true;
56
+ expect(event.target).to.equal(option);
57
+ });
58
+ it('dispatches an "edit" event on Space', async () => {
59
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
60
+ <glide-core-dropdown-option
61
+ label="Label"
62
+ editable
63
+ ></glide-core-dropdown-option>
64
+ </glide-core-dropdown>`);
65
+ component
66
+ .querySelector('glide-core-dropdown-option')
67
+ ?.shadowRoot?.querySelector('[data-test="edit-button"]')
68
+ ?.dispatchEvent(new Event('mouseover'));
69
+ component.focus();
70
+ await sendKeys({ press: 'ArrowDown' });
71
+ sendKeys({ press: ' ' });
72
+ const option = component.querySelector('glide-core-dropdown-option');
73
+ assert(option);
74
+ const event = await oneEvent(option, 'edit');
75
+ expect(event instanceof Event).to.be.true;
76
+ expect(event.bubbles).to.be.true;
77
+ expect(event.composed).to.be.true;
78
+ expect(event.target).to.equal(option);
79
+ });
13
80
  it('dispatches an "invalid" event on submit when required and no option is selected', async () => {
14
81
  const form = document.createElement('form');
15
82
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" required>
@@ -82,6 +82,93 @@ it('dispatches one "change" event when an option is selected via Space', async (
82
82
  expect(event.bubbles).to.be.true;
83
83
  expect(spy.callCount).to.equal(1);
84
84
  });
85
+ it('dispatches an "edit" event on click', async () => {
86
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
87
+ <glide-core-dropdown-option
88
+ label="Label"
89
+ editable
90
+ selected
91
+ ></glide-core-dropdown-option>
92
+ </glide-core-dropdown>`);
93
+ setTimeout(() => {
94
+ component?.shadowRoot
95
+ ?.querySelector('[data-test="edit-button"]')
96
+ ?.click();
97
+ });
98
+ const event = await oneEvent(component, 'edit');
99
+ const option = component.querySelector('glide-core-dropdown-option');
100
+ expect(event instanceof Event).to.be.true;
101
+ expect(event.bubbles).to.be.true;
102
+ expect(event.composed).to.be.true;
103
+ expect(event.target).to.equal(option);
104
+ });
105
+ it('dispatches an "edit" event on Enter', async () => {
106
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
107
+ <glide-core-dropdown-option
108
+ label="Label"
109
+ editable
110
+ selected
111
+ ></glide-core-dropdown-option>
112
+ </glide-core-dropdown>`);
113
+ component?.shadowRoot
114
+ ?.querySelector('[data-test="edit-button"]')
115
+ ?.focus();
116
+ sendKeys({ press: 'Enter' });
117
+ const event = await oneEvent(component, 'edit');
118
+ const option = component.querySelector('glide-core-dropdown-option');
119
+ expect(event instanceof Event).to.be.true;
120
+ expect(event.bubbles).to.be.true;
121
+ expect(event.composed).to.be.true;
122
+ expect(event.target).to.equal(option);
123
+ });
124
+ it('dispatches an "edit" event on Space', async () => {
125
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
126
+ <glide-core-dropdown-option
127
+ label="Label"
128
+ editable
129
+ selected
130
+ ></glide-core-dropdown-option>
131
+ </glide-core-dropdown>`);
132
+ component?.shadowRoot
133
+ ?.querySelector('[data-test="edit-button"]')
134
+ ?.focus();
135
+ sendKeys({ press: ' ' });
136
+ const event = await oneEvent(component, 'edit');
137
+ const option = component.querySelector('glide-core-dropdown-option');
138
+ expect(event instanceof Event).to.be.true;
139
+ expect(event.bubbles).to.be.true;
140
+ expect(event.target).to.equal(option);
141
+ });
142
+ it('does not dispatch an "edit" event when `disabled`', async () => {
143
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" disabled>
144
+ <glide-core-dropdown-option
145
+ label="Label"
146
+ editable
147
+ selected
148
+ ></glide-core-dropdown-option>
149
+ </glide-core-dropdown>`);
150
+ const spy = sinon.spy();
151
+ component.addEventListener('edit', spy);
152
+ component?.shadowRoot
153
+ ?.querySelector('[data-test="edit-button"]')
154
+ ?.click();
155
+ expect(spy.callCount).to.equal(0);
156
+ });
157
+ it('does not dispatch an "edit" event when `readonly`', async () => {
158
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" readonly>
159
+ <glide-core-dropdown-option
160
+ label="Label"
161
+ editable
162
+ selected
163
+ ></glide-core-dropdown-option>
164
+ </glide-core-dropdown>`);
165
+ const spy = sinon.spy();
166
+ component.addEventListener('edit', spy);
167
+ component?.shadowRoot
168
+ ?.querySelector('[data-test="edit-button"]')
169
+ ?.click();
170
+ expect(spy.callCount).to.equal(0);
171
+ });
85
172
  it('dispatches one "input" event when an option is selected via click', async () => {
86
173
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
87
174
  <glide-core-dropdown-option
@@ -109,12 +109,12 @@ it('retains focus on the the input when an option is selected via Enter', async
109
109
  const input = component.shadowRoot?.querySelector('[data-test="input"]');
110
110
  expect(component.shadowRoot?.activeElement).to.equal(input);
111
111
  });
112
- it('retains focus on the the input when the button is clicked', async () => {
112
+ it('retains focus on the the input when the primary button is clicked', async () => {
113
113
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" open>
114
114
  ${defaultSlot}
115
115
  </glide-core-dropdown>`);
116
116
  component.focus();
117
- const button = component.shadowRoot?.querySelector('[data-test="button"]');
117
+ const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
118
118
  assert(button);
119
119
  const { x, y } = button.getBoundingClientRect();
120
120
  // A simple `option.click()` won't do because we need a "mousedown" so that
@@ -27,7 +27,7 @@ it('closes and reports validity when it loses focus', async () => {
27
27
  expect(component.open).to.be.false;
28
28
  component.open = true;
29
29
  component.focus();
30
- // Move focus to the button.
30
+ // Move focus to the primary button.
31
31
  await sendKeys({ down: 'Shift' });
32
32
  await sendKeys({ press: 'Tab' });
33
33
  await sendKeys({ up: 'Shift' });
@@ -48,7 +48,7 @@ it('is focused when clicked', async () => {
48
48
  // which puts us in a guard in the event handler. `Event` has no `detail` property
49
49
  // and would work. `CustomEvent` is used for completeness and to get us as close as
50
50
  // possible to a real click. See the comment in the handler for more information.
51
- const button = component.shadowRoot?.querySelector('[data-test="button"]');
51
+ const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
52
52
  button?.dispatchEvent(new CustomEvent('click', { bubbles: true, detail: 1 }));
53
53
  expect(component.shadowRoot?.activeElement).to.equal(button);
54
54
  });
@@ -1,10 +1,10 @@
1
1
  import './dropdown.option.js';
2
- import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
2
+ import { aTimeout, elementUpdated, expect, fixture, html, } from '@open-wc/testing';
3
3
  import GlideCoreDropdown from './dropdown.js';
4
4
  import GlideCoreDropdownOption from './dropdown.option.js';
5
5
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
6
6
  GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
7
- it('focuses the button when `focus()` is called', async () => {
7
+ it('focuses the primary button when `focus()` is called', async () => {
8
8
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" multiple>
9
9
  <glide-core-dropdown-option
10
10
  label="One"
@@ -17,9 +17,9 @@ it('focuses the button when `focus()` is called', async () => {
17
17
  ></glide-core-dropdown-option>
18
18
  </glide-core-dropdown>`);
19
19
  component.focus();
20
- expect(component.shadowRoot?.activeElement).to.equal(component.shadowRoot?.querySelector('[data-test="button"]'));
20
+ expect(component.shadowRoot?.activeElement).to.equal(component.shadowRoot?.querySelector('[data-test="primary-button"]'));
21
21
  });
22
- it('focuses the button on submit when required and no options are selected', async () => {
22
+ it('focuses the primary button on submit when required and no options are selected', async () => {
23
23
  const form = document.createElement('form');
24
24
  const component = await fixture(html `<glide-core-dropdown
25
25
  label="Label"
@@ -40,10 +40,10 @@ it('focuses the button on submit when required and no options are selected', asy
40
40
  parentNode: form,
41
41
  });
42
42
  form.requestSubmit();
43
- const button = component.shadowRoot?.querySelector('[data-test="button"]');
43
+ const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
44
44
  expect(component.shadowRoot?.activeElement).to.be.equal(button);
45
45
  });
46
- it('focuses the button when `reportValidity` is called when required and no options are selected', async () => {
46
+ it('focuses the primary button when `reportValidity` is called when required and no options are selected', async () => {
47
47
  const form = document.createElement('form');
48
48
  const component = await fixture(html `<glide-core-dropdown
49
49
  label="Label"
@@ -62,10 +62,10 @@ it('focuses the button when `reportValidity` is called when required and no opti
62
62
  ></glide-core-dropdown-option>
63
63
  </glide-core-dropdown>`, { parentNode: form });
64
64
  component.reportValidity();
65
- const button = component.shadowRoot?.querySelector('[data-test="button"]');
65
+ const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
66
66
  expect(component.shadowRoot?.activeElement).to.equal(button);
67
67
  });
68
- it('does not focus the button when `checkValidity` is called', async () => {
68
+ it('does not focus the primary button when `checkValidity` is called', async () => {
69
69
  const form = document.createElement('form');
70
70
  const component = await fixture(html `<glide-core-dropdown
71
71
  label="Label"
@@ -116,6 +116,8 @@ it('focuses the second tag when the first one is removed', async () => {
116
116
  const tags = component.shadowRoot?.querySelectorAll('[data-test="tag"]');
117
117
  tags?.[0].click();
118
118
  await elementUpdated(component);
119
+ // Wait for the timeout in `#onTagRemove`.
120
+ await aTimeout(0);
119
121
  expect(component.shadowRoot?.activeElement).to.equal(tags?.[1]);
120
122
  });
121
123
  it('focuses the third tag when the second one is removed', async () => {
@@ -146,6 +148,8 @@ it('focuses the third tag when the second one is removed', async () => {
146
148
  const tags = component.shadowRoot?.querySelectorAll('[data-test="tag"]');
147
149
  tags?.[1].click();
148
150
  await elementUpdated(component);
151
+ // Wait for the timeout in `#onTagRemove`.
152
+ await aTimeout(0);
149
153
  expect(component.shadowRoot?.activeElement).to.equal(tags?.[2]);
150
154
  });
151
155
  it('focuses the second tag when the last one removed', async () => {
@@ -176,5 +180,7 @@ it('focuses the second tag when the last one removed', async () => {
176
180
  const tags = component.shadowRoot?.querySelectorAll('[data-test="tag"]');
177
181
  tags?.[2].click();
178
182
  await elementUpdated(component);
183
+ // Wait for the timeout in `#onTagRemove`.
184
+ await aTimeout(0);
179
185
  expect(component.shadowRoot?.activeElement).to.equal(tags?.[1]);
180
186
  });
@@ -4,7 +4,7 @@ import GlideCoreDropdown from './dropdown.js';
4
4
  import GlideCoreDropdownOption from './dropdown.option.js';
5
5
  GlideCoreDropdown.shadowRootOptions.mode = 'open';
6
6
  GlideCoreDropdownOption.shadowRootOptions.mode = 'open';
7
- it('focuses the button when `focus()` is called', async () => {
7
+ it('focuses the primary button when `focus()` is called', async () => {
8
8
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
9
9
  <glide-core-dropdown-option
10
10
  label="Label"
@@ -12,7 +12,7 @@ it('focuses the button when `focus()` is called', async () => {
12
12
  ></glide-core-dropdown-option>
13
13
  </glide-core-dropdown>`);
14
14
  component.focus();
15
- expect(component.shadowRoot?.activeElement).to.equal(component.shadowRoot?.querySelector('[data-test="button"]'));
15
+ expect(component.shadowRoot?.activeElement).to.equal(component.shadowRoot?.querySelector('[data-test="primary-button"]'));
16
16
  });
17
17
  it('focuses the button on submit', async () => {
18
18
  const form = document.createElement('form');
@@ -25,10 +25,10 @@ it('focuses the button on submit', async () => {
25
25
  parentNode: form,
26
26
  });
27
27
  form.requestSubmit();
28
- const button = component.shadowRoot?.querySelector('[data-test="button"]');
28
+ const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
29
29
  expect(component.shadowRoot?.activeElement).to.be.equal(button);
30
30
  });
31
- it('focuses the button when `reportValidity` is called when required and no option is selected', async () => {
31
+ it('focuses the primary button when `reportValidity` is called when required and no option is selected', async () => {
32
32
  const form = document.createElement('form');
33
33
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" required>
34
34
  <glide-core-dropdown-option
@@ -37,10 +37,10 @@ it('focuses the button when `reportValidity` is called when required and no opti
37
37
  ></glide-core-dropdown-option>
38
38
  </glide-core-dropdown>`, { parentNode: form });
39
39
  component.reportValidity();
40
- const button = component.shadowRoot?.querySelector('[data-test="button"]');
40
+ const button = component.shadowRoot?.querySelector('[data-test="primary-button"]');
41
41
  expect(component.shadowRoot?.activeElement).to.equal(button);
42
42
  });
43
- it('does not focus the button when `checkValidity` is called', async () => {
43
+ it('does not focus the primary button when `checkValidity` is called', async () => {
44
44
  const form = document.createElement('form');
45
45
  const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder" required>
46
46
  <glide-core-dropdown-option
@@ -50,3 +50,25 @@ it('does not submit its form on Enter when open', async () => {
50
50
  await sendKeys({ press: 'Enter' });
51
51
  expect(spy.callCount).to.equal(0);
52
52
  });
53
+ it('does not submit its form when Enter is pressed on the Edit button', async () => {
54
+ const form = document.createElement('form');
55
+ const component = await fixture(html `<glide-core-dropdown label="Label" placeholder="Placeholder">
56
+ <glide-core-dropdown-option
57
+ label="Label"
58
+ editable
59
+ selected
60
+ ></glide-core-dropdown-option>
61
+ </glide-core-dropdown>`, {
62
+ parentNode: form,
63
+ });
64
+ const spy = sinon.spy();
65
+ form.addEventListener('submit', (event) => {
66
+ event.preventDefault();
67
+ spy();
68
+ });
69
+ component.shadowRoot
70
+ ?.querySelector('[data-test="edit-button"]')
71
+ ?.focus();
72
+ await sendKeys({ press: 'Enter' });
73
+ expect(spy.callCount).to.equal(0);
74
+ });
@@ -275,7 +275,7 @@ it('sets the first unfiltered option as active when the previously active option
275
275
  expect(option?.privateActive).to.be.true;
276
276
  expect(input?.getAttribute('aria-activedescendant')).to.equal(option?.id);
277
277
  });
278
- it('updates the `value` of its `<input>` when the `label` of a selected option is changed programmatically', async () => {
278
+ it('updates the `value` of its `<input>` when `label` of a selected option is changed programmatically', async () => {
279
279
  const component = await fixture(html `<glide-core-dropdown
280
280
  label="Label"
281
281
  placeholder="Placeholder"
@@ -512,7 +512,7 @@ it('sets `aria-activedescendant` on open via click', async () => {
512
512
  // and would work. `CustomEvent` is used for completeness and to get us as close as
513
513
  // possible to a real click. See the comment in the handler for more information.
514
514
  component.shadowRoot
515
- ?.querySelector('[data-test="button"]')
515
+ ?.querySelector('[data-test="primary-button"]')
516
516
  ?.dispatchEvent(new CustomEvent('click', { bubbles: true, detail: 1 }));
517
517
  // Wait for it to open.
518
518
  await aTimeout(0);
@@ -597,7 +597,7 @@ it('sets `aria-activedescendant` when closed via click', async () => {
597
597
  ${defaultSlot}
598
598
  </glide-core-dropdown>`);
599
599
  component.shadowRoot
600
- ?.querySelector('[data-test="button"]')
600
+ ?.querySelector('[data-test="primary-button"]')
601
601
  ?.click();
602
602
  await elementUpdated(component);
603
603
  const input = component.shadowRoot?.querySelector('[data-test="input"]');