@spectrum-web-components/action-group 0.11.0 → 0.11.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.
@@ -1,18 +1,55 @@
1
- import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}from"@open-wc/testing";import"@spectrum-web-components/action-button/sp-action-button.js";import{LitElement as p}from"@spectrum-web-components/base";import"@spectrum-web-components/overlay/overlay-trigger.js";import"@spectrum-web-components/tooltip/sp-tooltip.js";import{arrowDownEvent as f,arrowLeftEvent as w,arrowRightEvent as b,arrowUpEvent as g,endEvent as q,homeEvent as S,testForLitDevWarnings as y}from"../../../test/testing-helpers";import{sendKeys as u}from"@web/test-runner-commands";import"@spectrum-web-components/action-group/sp-action-group.js";class A extends p{render(){return c`
1
+ "use strict";
2
+ import {
3
+ elementUpdated,
4
+ expect,
5
+ fixture,
6
+ html,
7
+ waitUntil
8
+ } from "@open-wc/testing";
9
+ import "@spectrum-web-components/action-button/sp-action-button.js";
10
+ import { LitElement } from "@spectrum-web-components/base";
11
+ import "@spectrum-web-components/overlay/overlay-trigger.js";
12
+ import "@spectrum-web-components/tooltip/sp-tooltip.js";
13
+ import {
14
+ arrowDownEvent,
15
+ arrowLeftEvent,
16
+ arrowRightEvent,
17
+ arrowUpEvent,
18
+ endEvent,
19
+ homeEvent,
20
+ testForLitDevWarnings
21
+ } from "../../../test/testing-helpers";
22
+ import { sendKeys } from "@web/test-runner-commands";
23
+ import "@spectrum-web-components/action-group/sp-action-group.js";
24
+ class QuietActionGroup extends LitElement {
25
+ render() {
26
+ return html`
2
27
  <sp-action-group quiet>
3
28
  <slot name="first"></slot>
4
29
  <slot name="second"></slot>
5
30
  </sp-action-group>
6
- `}}customElements.define("quiet-action-group",A);class m extends p{render(){return c`
31
+ `;
32
+ }
33
+ }
34
+ customElements.define("quiet-action-group", QuietActionGroup);
35
+ class EmphasizedActionGroup extends LitElement {
36
+ render() {
37
+ return html`
7
38
  <sp-action-group emphasized>
8
39
  <slot name="first"></slot>
9
40
  <slot name="second"></slot>
10
41
  </sp-action-group>
11
- `}}customElements.define("emphasized-action-group",m);async function r(a){return await i(c`
42
+ `;
43
+ }
44
+ }
45
+ customElements.define("emphasized-action-group", EmphasizedActionGroup);
46
+ async function singleSelectedActionGroup(selected) {
47
+ const el = await fixture(
48
+ html`
12
49
  <sp-action-group
13
50
  label="Selects User-Chosen Buttons"
14
51
  selects="single"
15
- .selected=${a}
52
+ .selected=${selected}
16
53
  >
17
54
  <sp-action-button value="first" class="first">
18
55
  First
@@ -21,11 +58,17 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
21
58
  Second
22
59
  </sp-action-button>
23
60
  </sp-action-group>
24
- `)}async function v(a){return await i(c`
61
+ `
62
+ );
63
+ return el;
64
+ }
65
+ async function multipleSelectedActionGroup(selected) {
66
+ const el = await fixture(
67
+ html`
25
68
  <sp-action-group
26
69
  label="Selects User-Chosen Buttons"
27
70
  selects="multiple"
28
- .selected=${a}
71
+ .selected=${selected}
29
72
  >
30
73
  <sp-action-button value="first" class="first">
31
74
  First
@@ -34,26 +77,67 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
34
77
  Second
35
78
  </sp-action-button>
36
79
  </sp-action-group>
37
- `)}describe("ActionGroup",()=>{it("loads empty action-group accessibly",async()=>{const t=await i(c`
80
+ `
81
+ );
82
+ return el;
83
+ }
84
+ describe("ActionGroup", () => {
85
+ it("loads empty action-group accessibly", async () => {
86
+ const el = await fixture(
87
+ html`
38
88
  <sp-action-group></sp-action-group>
39
- `);await n(t),await e(t).to.be.accessible()}),y(async()=>await i(c`
89
+ `
90
+ );
91
+ await elementUpdated(el);
92
+ await expect(el).to.be.accessible();
93
+ });
94
+ testForLitDevWarnings(
95
+ async () => await fixture(
96
+ html`
40
97
  <sp-action-group aria-label="Default Group">
41
98
  <sp-action-button>First</sp-action-button>
42
99
  <sp-action-button>Second</sp-action-button>
43
100
  <sp-action-button>Third</sp-action-button>
44
101
  </sp-action-group>
45
- `)),it("loads default action-group accessibly",async()=>{const t=await i(c`
102
+ `
103
+ )
104
+ );
105
+ it("loads default action-group accessibly", async () => {
106
+ const el = await fixture(
107
+ html`
46
108
  <sp-action-group aria-label="Default Group">
47
109
  <sp-action-button>First</sp-action-button>
48
110
  <sp-action-button>Second</sp-action-button>
49
111
  <sp-action-button>Third</sp-action-button>
50
112
  </sp-action-group>
51
- `);await n(t),await e(t).to.be.accessible(),e(t.getAttribute("aria-label")).to.equal("Default Group"),e(t.hasAttribute("role")).to.be.false,e(t.children[0].getAttribute("role")).to.equal("button")}),it("applies `quiet` attribute to its children",async()=>{const t=await i(c`
113
+ `
114
+ );
115
+ await elementUpdated(el);
116
+ await expect(el).to.be.accessible();
117
+ expect(el.getAttribute("aria-label")).to.equal("Default Group");
118
+ expect(el.hasAttribute("role")).to.be.false;
119
+ expect(el.children[0].getAttribute("role")).to.equal("button");
120
+ });
121
+ it("applies `quiet` attribute to its children", async () => {
122
+ const el = await fixture(
123
+ html`
52
124
  <sp-action-group quiet>
53
125
  <sp-action-button id="first">First</sp-action-button>
54
126
  <sp-action-button id="second">Second</sp-action-button>
55
127
  </sp-action-group>
56
- `),o=t.querySelector("#first"),s=t.querySelector("#second");await n(t),e(o.hasAttribute("quiet")).to.be.true,e(o.quiet).to.be.true,e(s.hasAttribute("quiet")).to.be.true,e(s.quiet).to.be.true}),it("applies `quiet` attribute to its slotted children",async()=>{const t=await i(c`
128
+ `
129
+ );
130
+ const firstButton = el.querySelector("#first");
131
+ const secondButton = el.querySelector("#second");
132
+ await elementUpdated(el);
133
+ expect(firstButton.hasAttribute("quiet")).to.be.true;
134
+ expect(firstButton.quiet).to.be.true;
135
+ expect(secondButton.hasAttribute("quiet")).to.be.true;
136
+ expect(secondButton.quiet).to.be.true;
137
+ });
138
+ it("applies `quiet` attribute to its slotted children", async () => {
139
+ const el = await fixture(
140
+ html`
57
141
  <quiet-action-group>
58
142
  <sp-action-button slot="first" id="first">
59
143
  First
@@ -62,7 +146,19 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
62
146
  Second
63
147
  </sp-action-button>
64
148
  </quiet-action-group>
65
- `),o=t.querySelector("#first"),s=t.querySelector("#second");await n(t),e(o.hasAttribute("quiet")).to.be.true,e(o.quiet).to.be.true,e(s.hasAttribute("quiet")).to.be.true,e(s.quiet).to.be.true}),it("applies `emphasized` attribute to its slotted children",async()=>{const t=await i(c`
149
+ `
150
+ );
151
+ const firstButton = el.querySelector("#first");
152
+ const secondButton = el.querySelector("#second");
153
+ await elementUpdated(el);
154
+ expect(firstButton.hasAttribute("quiet")).to.be.true;
155
+ expect(firstButton.quiet).to.be.true;
156
+ expect(secondButton.hasAttribute("quiet")).to.be.true;
157
+ expect(secondButton.quiet).to.be.true;
158
+ });
159
+ it("applies `emphasized` attribute to its slotted children", async () => {
160
+ const el = await fixture(
161
+ html`
66
162
  <emphasized-action-group>
67
163
  <sp-action-button slot="first" id="first">
68
164
  First
@@ -71,7 +167,19 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
71
167
  Second
72
168
  </sp-action-button>
73
169
  </emphasized-action-group>
74
- `),o=t.querySelector("#first"),s=t.querySelector("#second");await n(t),e(o.hasAttribute("emphasized")).to.be.true,e(o.emphasized).to.be.true,e(s.hasAttribute("emphasized")).to.be.true,e(s.emphasized).to.be.true}),it("applies `quiet` attribute to slotted children with overlays",async()=>{const t=await i(c`
170
+ `
171
+ );
172
+ const firstButton = el.querySelector("#first");
173
+ const secondButton = el.querySelector("#second");
174
+ await elementUpdated(el);
175
+ expect(firstButton.hasAttribute("emphasized")).to.be.true;
176
+ expect(firstButton.emphasized).to.be.true;
177
+ expect(secondButton.hasAttribute("emphasized")).to.be.true;
178
+ expect(secondButton.emphasized).to.be.true;
179
+ });
180
+ it("applies `quiet` attribute to slotted children with overlays", async () => {
181
+ const el = await fixture(
182
+ html`
75
183
  <quiet-action-group>
76
184
  <overlay-trigger slot="first">
77
185
  <sp-action-button slot="trigger" id="first">
@@ -84,7 +192,19 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
84
192
  </sp-action-button>
85
193
  </overlay-trigger>
86
194
  </quiet-action-group>
87
- `),o=t.querySelector("#first"),s=t.querySelector("#second");await n(t),e(o.hasAttribute("quiet")).to.be.true,e(o.quiet).to.be.true,e(s.hasAttribute("quiet")).to.be.true,e(s.quiet).to.be.true}),it("applies `emphasized` attribute to slotted children with overlays",async()=>{const t=await i(c`
195
+ `
196
+ );
197
+ const firstButton = el.querySelector("#first");
198
+ const secondButton = el.querySelector("#second");
199
+ await elementUpdated(el);
200
+ expect(firstButton.hasAttribute("quiet")).to.be.true;
201
+ expect(firstButton.quiet).to.be.true;
202
+ expect(secondButton.hasAttribute("quiet")).to.be.true;
203
+ expect(secondButton.quiet).to.be.true;
204
+ });
205
+ it("applies `emphasized` attribute to slotted children with overlays", async () => {
206
+ const el = await fixture(
207
+ html`
88
208
  <emphasized-action-group>
89
209
  <overlay-trigger slot="first">
90
210
  <sp-action-button slot="trigger" id="first">
@@ -97,19 +217,48 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
97
217
  </sp-action-button>
98
218
  </overlay-trigger>
99
219
  </emphasized-action-group>
100
- `),o=t.querySelector("#first"),s=t.querySelector("#second");await n(t),e(o.hasAttribute("emphasized")).to.be.true,e(o.emphasized).to.be.true,e(s.hasAttribute("emphasized")).to.be.true,e(s.emphasized).to.be.true}),it('loads [selects="single"] action-group accessibly',async()=>{const t=await i(c`
220
+ `
221
+ );
222
+ const firstButton = el.querySelector("#first");
223
+ const secondButton = el.querySelector("#second");
224
+ await elementUpdated(el);
225
+ expect(firstButton.hasAttribute("emphasized")).to.be.true;
226
+ expect(firstButton.emphasized).to.be.true;
227
+ expect(secondButton.hasAttribute("emphasized")).to.be.true;
228
+ expect(secondButton.emphasized).to.be.true;
229
+ });
230
+ it('loads [selects="single"] action-group accessibly', async () => {
231
+ const el = await fixture(
232
+ html`
101
233
  <sp-action-group label="Selects Single Group" selects="single">
102
234
  <sp-action-button>First</sp-action-button>
103
235
  <sp-action-button>Second</sp-action-button>
104
236
  <sp-action-button>Third</sp-action-button>
105
237
  </sp-action-group>
106
- `);await n(t),await e(t).to.be.accessible(),e(t.getAttribute("aria-label")).to.equal("Selects Single Group"),e(t.getAttribute("role")).to.equal("radiogroup"),e(t.children[0].getAttribute("role")).to.equal("radio")}),it('loads [selects="single"] action-group w/ selection accessibly',async()=>{const t=await i(c`
238
+ `
239
+ );
240
+ await elementUpdated(el);
241
+ await expect(el).to.be.accessible();
242
+ expect(el.getAttribute("aria-label")).to.equal("Selects Single Group");
243
+ expect(el.getAttribute("role")).to.equal("radiogroup");
244
+ expect(el.children[0].getAttribute("role")).to.equal("radio");
245
+ });
246
+ it('loads [selects="single"] action-group w/ selection accessibly', async () => {
247
+ const el = await fixture(
248
+ html`
107
249
  <sp-action-group label="Selects Single Group" selects="single">
108
250
  <sp-action-button>First</sp-action-button>
109
251
  <sp-action-button>Second</sp-action-button>
110
252
  <sp-action-button selected>Third</sp-action-button>
111
253
  </sp-action-group>
112
- `);await n(t),await e(t).to.be.accessible()}),it('loads [selects="multiple"] action-group accessibly',async()=>{const t=await i(c`
254
+ `
255
+ );
256
+ await elementUpdated(el);
257
+ await expect(el).to.be.accessible();
258
+ });
259
+ it('loads [selects="multiple"] action-group accessibly', async () => {
260
+ const el = await fixture(
261
+ html`
113
262
  <sp-action-group
114
263
  label="Selects Multiple Group"
115
264
  selects="multiple"
@@ -118,7 +267,19 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
118
267
  <sp-action-button>Second</sp-action-button>
119
268
  <sp-action-button>Third</sp-action-button>
120
269
  </sp-action-group>
121
- `);await n(t),await e(t).to.be.accessible(),e(t.getAttribute("aria-label")).to.equal("Selects Multiple Group"),e(t.getAttribute("role")).to.equal("group"),e(t.children[0].getAttribute("role")).to.equal("checkbox")}),it('loads [selects="multiple"] action-group w/ selection accessibly',async()=>{const t=await i(c`
270
+ `
271
+ );
272
+ await elementUpdated(el);
273
+ await expect(el).to.be.accessible();
274
+ expect(el.getAttribute("aria-label")).to.equal(
275
+ "Selects Multiple Group"
276
+ );
277
+ expect(el.getAttribute("role")).to.equal("group");
278
+ expect(el.children[0].getAttribute("role")).to.equal("checkbox");
279
+ });
280
+ it('loads [selects="multiple"] action-group w/ selection accessibly', async () => {
281
+ const el = await fixture(
282
+ html`
122
283
  <sp-action-group
123
284
  label="Selects Multiple Group"
124
285
  selects="multiple"
@@ -127,19 +288,42 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
127
288
  <sp-action-button selected>Second</sp-action-button>
128
289
  <sp-action-button selected>Third</sp-action-button>
129
290
  </sp-action-group>
130
- `);await n(t),await e(t).to.be.accessible()}),it('sets tab stop when [selects="single"] and the initial button is [disabled]',async()=>{const t=await i(c`
291
+ `
292
+ );
293
+ await elementUpdated(el);
294
+ await expect(el).to.be.accessible();
295
+ });
296
+ it('sets tab stop when [selects="single"] and the initial button is [disabled]', async () => {
297
+ const el = await fixture(
298
+ html`
131
299
  <sp-action-group label="Selects Single Group" selects="single">
132
300
  <sp-action-button disabled>First</sp-action-button>
133
301
  <sp-action-button class="second">Second</sp-action-button>
134
302
  <sp-action-button>Third</sp-action-button>
135
303
  </sp-action-group>
136
- `),o=t.querySelector(".second");await n(t),e(o.hasAttribute("tabindex")),e(o.getAttribute("tabindex")).to.equal("0")}),it('surfaces [selects="single"] selection',async()=>{const t=await i(c`
304
+ `
305
+ );
306
+ const secondButton = el.querySelector(".second");
307
+ await elementUpdated(el);
308
+ expect(secondButton.hasAttribute("tabindex"));
309
+ expect(secondButton.getAttribute("tabindex")).to.equal("0");
310
+ });
311
+ it('surfaces [selects="single"] selection', async () => {
312
+ const el = await fixture(
313
+ html`
137
314
  <sp-action-group label="Selects Single Group" selects="single">
138
315
  <sp-action-button>First</sp-action-button>
139
316
  <sp-action-button>Second</sp-action-button>
140
317
  <sp-action-button selected>Third</sp-action-button>
141
318
  </sp-action-group>
142
- `);await n(t),e(t.selected,'"Third" selected').to.deep.equal(["Third"])}),it('surfaces [selects="multiple"] selection',async()=>{const t=await i(c`
319
+ `
320
+ );
321
+ await elementUpdated(el);
322
+ expect(el.selected, '"Third" selected').to.deep.equal(["Third"]);
323
+ });
324
+ it('surfaces [selects="multiple"] selection', async () => {
325
+ const el = await fixture(
326
+ html`
143
327
  <sp-action-group
144
328
  label="Selects Multiple Group"
145
329
  selects="multiple"
@@ -148,13 +332,34 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
148
332
  <sp-action-button selected>Second</sp-action-button>
149
333
  <sp-action-button selected>Third</sp-action-button>
150
334
  </sp-action-group>
151
- `);await n(t),e(t.selected,'"Second" and "Third" selected').to.deep.equal(["Second","Third"])}),it("does not select without [selects]",async()=>{const t=await i(c`
335
+ `
336
+ );
337
+ await elementUpdated(el);
338
+ expect(el.selected, '"Second" and "Third" selected').to.deep.equal([
339
+ "Second",
340
+ "Third"
341
+ ]);
342
+ });
343
+ it("does not select without [selects]", async () => {
344
+ const el = await fixture(
345
+ html`
152
346
  <sp-action-group label="No Selects Group">
153
347
  <sp-action-button>First</sp-action-button>
154
348
  <sp-action-button selected>Second</sp-action-button>
155
349
  <sp-action-button class="third">Third</sp-action-button>
156
350
  </sp-action-group>
157
- `),o=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(1),o.click(),await n(t),e(t.selected.length).to.equal(1)}),it('selects via `click` while [selects="single"]',async()=>{const t=await i(c`
351
+ `
352
+ );
353
+ const thirdElement = el.querySelector(".third");
354
+ await elementUpdated(el);
355
+ expect(el.selected.length).to.equal(1);
356
+ thirdElement.click();
357
+ await elementUpdated(el);
358
+ expect(el.selected.length).to.equal(1);
359
+ });
360
+ it('selects via `click` while [selects="single"]', async () => {
361
+ const el = await fixture(
362
+ html`
158
363
  <sp-action-group label="Selects Single Group" selects="single">
159
364
  <sp-action-button value="first">First</sp-action-button>
160
365
  <sp-action-button value="second" selected>
@@ -164,7 +369,23 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
164
369
  Third
165
370
  </sp-action-button>
166
371
  </sp-action-group>
167
- `),o=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(1),e(t.selected.includes("second")),o.click(),await n(t),e(o.selected,"third child selected").to.be.true,await d(()=>t.selected.length===1&&t.selected.includes("third"),"Updates value of `selected`")}),it('selects via `click` while [selects="multiple"] selection',async()=>{const t=await i(c`
372
+ `
373
+ );
374
+ const thirdElement = el.querySelector(".third");
375
+ await elementUpdated(el);
376
+ expect(el.selected.length).to.equal(1);
377
+ expect(el.selected.includes("second"));
378
+ thirdElement.click();
379
+ await elementUpdated(el);
380
+ expect(thirdElement.selected, "third child selected").to.be.true;
381
+ await waitUntil(
382
+ () => el.selected.length === 1 && el.selected.includes("third"),
383
+ "Updates value of `selected`"
384
+ );
385
+ });
386
+ it('selects via `click` while [selects="multiple"] selection', async () => {
387
+ const el = await fixture(
388
+ html`
168
389
  <sp-action-group
169
390
  label="Selects Multiple Group"
170
391
  selects="multiple"
@@ -175,27 +396,100 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
175
396
  <sp-action-button class="second">Second</sp-action-button>
176
397
  <sp-action-button class="third">Third</sp-action-button>
177
398
  </sp-action-group>
178
- `),o=t.querySelector(".first"),s=t.querySelector(".second"),l=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(1),e(t.selected.includes("First")),o.click(),s.click(),l.click(),await n(t),e(s.selected,"second child selected").to.be.true,e(l.selected,"third child selected").to.be.true,await d(()=>t.selected.length===2&&t.selected.includes("Second")&&t.selected.includes("Third"),"Updates value of `selected`")}),it("does not respond to clicks on itself",async()=>{const t=await i(c`
399
+ `
400
+ );
401
+ const firstElement = el.querySelector(".first");
402
+ const secondElement = el.querySelector(".second");
403
+ const thirdElement = el.querySelector(".third");
404
+ await elementUpdated(el);
405
+ expect(el.selected.length).to.equal(1);
406
+ expect(el.selected.includes("First"));
407
+ firstElement.click();
408
+ secondElement.click();
409
+ thirdElement.click();
410
+ await elementUpdated(el);
411
+ expect(secondElement.selected, "second child selected").to.be.true;
412
+ expect(thirdElement.selected, "third child selected").to.be.true;
413
+ await waitUntil(
414
+ () => el.selected.length === 2 && el.selected.includes("Second") && el.selected.includes("Third"),
415
+ "Updates value of `selected`"
416
+ );
417
+ });
418
+ it("does not respond to clicks on itself", async () => {
419
+ const el = await fixture(
420
+ html`
179
421
  <sp-action-group label="Selects Single Group" selects="single">
180
422
  <sp-action-button>First</sp-action-button>
181
423
  <sp-action-button>Second</sp-action-button>
182
424
  <sp-action-button class="third">Third</sp-action-button>
183
425
  </sp-action-group>
184
- `);await n(t),e(t.selected.length).to.equal(0),t.click(),await n(t),e(t.selected.length).to.equal(0)}),it("selection can be prevented",async()=>{const t=await i(c`
426
+ `
427
+ );
428
+ await elementUpdated(el);
429
+ expect(el.selected.length).to.equal(0);
430
+ el.click();
431
+ await elementUpdated(el);
432
+ expect(el.selected.length).to.equal(0);
433
+ });
434
+ it("selection can be prevented", async () => {
435
+ const el = await fixture(
436
+ html`
185
437
  <sp-action-group
186
438
  label="Selects Single Group"
187
439
  selects="single"
188
- @change=${s=>{s.preventDefault()}}
440
+ @change=${(event) => {
441
+ event.preventDefault();
442
+ }}
189
443
  >
190
444
  <sp-action-button>First</sp-action-button>
191
445
  <sp-action-button>Second</sp-action-button>
192
446
  <sp-action-button class="third">Third</sp-action-button>
193
447
  </sp-action-group>
194
- `),o=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(0),o.click(),await n(t),e(o.selected,"third child not selected").to.be.false,e(t.selected.length).to.equal(0)}),it('selects user-passed value while [selects="single"]',async()=>{const t=await r(["first"]);await n(t),e(t.selected.length).to.equal(1);const o=t.querySelector(".first"),s=t.querySelector(".second");e(o.selected,"first button selected").to.be.true,e(s.selected,"second button not selected").to.be.false,s.click(),await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first button not selected").to.be.false,e(s.selected,"second button selected").to.be.true}),it('selects can be updated while [selects="single"]',async()=>{const t=await r(["first"]);await n(t),e(t.selected.length).to.equal(1);const o=t.querySelector(".first"),s=t.querySelector(".second");e(o.selected,"first button selected").to.be.true,e(s.selected,"second button not selected").to.be.false,t.selected=["second"],await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first button not selected").to.be.false,e(s.selected,"second button selected").to.be.true}),it('selects user-passed value while [selects="multiple"]',async()=>{const t=await i(c`
448
+ `
449
+ );
450
+ const thirdElement = el.querySelector(".third");
451
+ await elementUpdated(el);
452
+ expect(el.selected.length).to.equal(0);
453
+ thirdElement.click();
454
+ await elementUpdated(el);
455
+ expect(thirdElement.selected, "third child not selected").to.be.false;
456
+ expect(el.selected.length).to.equal(0);
457
+ });
458
+ it('selects user-passed value while [selects="single"]', async () => {
459
+ const el = await singleSelectedActionGroup(["first"]);
460
+ await elementUpdated(el);
461
+ expect(el.selected.length).to.equal(1);
462
+ const firstButton = el.querySelector(".first");
463
+ const secondButton = el.querySelector(".second");
464
+ expect(firstButton.selected, "first button selected").to.be.true;
465
+ expect(secondButton.selected, "second button not selected").to.be.false;
466
+ secondButton.click();
467
+ await elementUpdated(el);
468
+ expect(el.selected.length).to.equal(1);
469
+ expect(firstButton.selected, "first button not selected").to.be.false;
470
+ expect(secondButton.selected, "second button selected").to.be.true;
471
+ });
472
+ it('selects can be updated while [selects="single"]', async () => {
473
+ const el = await singleSelectedActionGroup(["first"]);
474
+ await elementUpdated(el);
475
+ expect(el.selected.length).to.equal(1);
476
+ const firstButton = el.querySelector(".first");
477
+ const secondButton = el.querySelector(".second");
478
+ expect(firstButton.selected, "first button selected").to.be.true;
479
+ expect(secondButton.selected, "second button not selected").to.be.false;
480
+ el.selected = ["second"];
481
+ await elementUpdated(el);
482
+ expect(el.selected.length).to.equal(1);
483
+ expect(firstButton.selected, "first button not selected").to.be.false;
484
+ expect(secondButton.selected, "second button selected").to.be.true;
485
+ });
486
+ it('selects user-passed value while [selects="multiple"]', async () => {
487
+ const el = await fixture(
488
+ html`
195
489
  <sp-action-group
196
490
  label="Selects Multiple Group"
197
491
  selects="multiple"
198
- .selected=${["first","second"]}
492
+ .selected=${["first", "second"]}
199
493
  >
200
494
  <sp-action-button class="first" value="first">
201
495
  First
@@ -207,11 +501,36 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
207
501
  Third
208
502
  </sp-action-button>
209
503
  </sp-action-group>
210
- `);await n(t);const o=t.querySelector(".first"),s=t.querySelector(".second"),l=t.querySelector(".third");e(t.selected.length).to.equal(2),e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.true,e(l.selected,"third button not selected").to.be.false,l.click(),await n(t),e(t.selected.length).to.equal(3),e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.true,e(l.selected,"third button selected").to.be.true,o.click(),await n(t),e(t.selected.length).to.equal(2),e(o.selected,"first button not selected").to.be.false,e(s.selected,"second button selected").to.be.true,e(l.selected,"third button selected").to.be.true}),it('selects can be updated while [selects="multiple"]',async()=>{const t=await i(c`
504
+ `
505
+ );
506
+ await elementUpdated(el);
507
+ const firstButton = el.querySelector(".first");
508
+ const secondButton = el.querySelector(".second");
509
+ const thirdButton = el.querySelector(".third");
510
+ expect(el.selected.length).to.equal(2);
511
+ expect(firstButton.selected, "first button selected").to.be.true;
512
+ expect(secondButton.selected, "second button selected").to.be.true;
513
+ expect(thirdButton.selected, "third button not selected").to.be.false;
514
+ thirdButton.click();
515
+ await elementUpdated(el);
516
+ expect(el.selected.length).to.equal(3);
517
+ expect(firstButton.selected, "first button selected").to.be.true;
518
+ expect(secondButton.selected, "second button selected").to.be.true;
519
+ expect(thirdButton.selected, "third button selected").to.be.true;
520
+ firstButton.click();
521
+ await elementUpdated(el);
522
+ expect(el.selected.length).to.equal(2);
523
+ expect(firstButton.selected, "first button not selected").to.be.false;
524
+ expect(secondButton.selected, "second button selected").to.be.true;
525
+ expect(thirdButton.selected, "third button selected").to.be.true;
526
+ });
527
+ it('selects can be updated while [selects="multiple"]', async () => {
528
+ const el = await fixture(
529
+ html`
211
530
  <sp-action-group
212
531
  label="Selects Multiple Group"
213
532
  selects="multiple"
214
- .selected=${["first","second"]}
533
+ .selected=${["first", "second"]}
215
534
  >
216
535
  <sp-action-button class="first" value="first">
217
536
  First
@@ -223,7 +542,55 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
223
542
  Third
224
543
  </sp-action-button>
225
544
  </sp-action-group>
226
- `);await n(t);const o=t.querySelector(".first"),s=t.querySelector(".second"),l=t.querySelector(".third");e(t.selected.length).to.equal(2),e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.true,e(l.selected,"third button not selected").to.be.false,t.selected=["first","second","third"],await n(t),e(t.selected.length).to.equal(3),e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.true,e(l.selected,"third button selected").to.be.true,t.selected=["second","third"],await n(t),e(t.selected.length,JSON.stringify(t.selected)).to.equal(2),e(o.selected,"first button not selected").to.be.false,e(s.selected,"second button selected").to.be.true,e(l.selected,"third button selected").to.be.true}),it('selects multiple user-passed values while [selects="single"], but then proceeds with radio-button style functionality',async()=>{const t=await r(["first","second"]);await n(t),e(t.selected.length).to.equal(2);const o=t.querySelector(".first"),s=t.querySelector(".second");e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.true,s.click(),await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first button selected").to.be.false,e(s.selected,"second button selected").to.be.true}),it('only selects user-passed buttons if present in action-group while [selects="multiple"]',async()=>{const t=await v(["second","fourth"]);await n(t),e(t.selected.length).to.equal(1);const o=t.querySelector(".second");e(o.selected,"second button selected").to.be.true;const s=t.querySelector(".first");e(s.selected,"first button selected").to.be.false}),it("selects user-passed values with no .selects value, but does not allow interaction afterwards",async()=>{const t=await i(c`
545
+ `
546
+ );
547
+ await elementUpdated(el);
548
+ const firstButton = el.querySelector(".first");
549
+ const secondButton = el.querySelector(".second");
550
+ const thirdButton = el.querySelector(".third");
551
+ expect(el.selected.length).to.equal(2);
552
+ expect(firstButton.selected, "first button selected").to.be.true;
553
+ expect(secondButton.selected, "second button selected").to.be.true;
554
+ expect(thirdButton.selected, "third button not selected").to.be.false;
555
+ el.selected = ["first", "second", "third"];
556
+ await elementUpdated(el);
557
+ expect(el.selected.length).to.equal(3);
558
+ expect(firstButton.selected, "first button selected").to.be.true;
559
+ expect(secondButton.selected, "second button selected").to.be.true;
560
+ expect(thirdButton.selected, "third button selected").to.be.true;
561
+ el.selected = ["second", "third"];
562
+ await elementUpdated(el);
563
+ expect(el.selected.length, JSON.stringify(el.selected)).to.equal(2);
564
+ expect(firstButton.selected, "first button not selected").to.be.false;
565
+ expect(secondButton.selected, "second button selected").to.be.true;
566
+ expect(thirdButton.selected, "third button selected").to.be.true;
567
+ });
568
+ it('selects multiple user-passed values while [selects="single"], but then proceeds with radio-button style functionality', async () => {
569
+ const el = await singleSelectedActionGroup(["first", "second"]);
570
+ await elementUpdated(el);
571
+ expect(el.selected.length).to.equal(2);
572
+ const firstButton = el.querySelector(".first");
573
+ const secondButton = el.querySelector(".second");
574
+ expect(firstButton.selected, "first button selected").to.be.true;
575
+ expect(secondButton.selected, "second button selected").to.be.true;
576
+ secondButton.click();
577
+ await elementUpdated(el);
578
+ expect(el.selected.length).to.equal(1);
579
+ expect(firstButton.selected, "first button selected").to.be.false;
580
+ expect(secondButton.selected, "second button selected").to.be.true;
581
+ });
582
+ it('only selects user-passed buttons if present in action-group while [selects="multiple"]', async () => {
583
+ const el = await multipleSelectedActionGroup(["second", "fourth"]);
584
+ await elementUpdated(el);
585
+ expect(el.selected.length).to.equal(1);
586
+ const secondButton = el.querySelector(".second");
587
+ expect(secondButton.selected, "second button selected").to.be.true;
588
+ const firstButton = el.querySelector(".first");
589
+ expect(firstButton.selected, "first button selected").to.be.false;
590
+ });
591
+ it("selects user-passed values with no .selects value, but does not allow interaction afterwards", async () => {
592
+ const el = await fixture(
593
+ html`
227
594
  <sp-action-group
228
595
  label="Selects User-Chosen Buttons"
229
596
  .selected=${["first"]}
@@ -235,10 +602,26 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
235
602
  Second
236
603
  </sp-action-button>
237
604
  </sp-action-group>
238
- `);await n(t),e(t.selected.length).to.equal(1);const o=t.querySelector(".first"),s=t.querySelector(".second");e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.false,s.click(),await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.false}),it("selects multiple buttons if .selected is passed in, but does not allow further interaction afterwards",async()=>{const t=await i(c`
605
+ `
606
+ );
607
+ await elementUpdated(el);
608
+ expect(el.selected.length).to.equal(1);
609
+ const firstButton = el.querySelector(".first");
610
+ const secondButton = el.querySelector(".second");
611
+ expect(firstButton.selected, "first button selected").to.be.true;
612
+ expect(secondButton.selected, "second button selected").to.be.false;
613
+ secondButton.click();
614
+ await elementUpdated(el);
615
+ expect(el.selected.length).to.equal(1);
616
+ expect(firstButton.selected, "first button selected").to.be.true;
617
+ expect(secondButton.selected, "second button selected").to.be.false;
618
+ });
619
+ it("selects multiple buttons if .selected is passed in, but does not allow further interaction afterwards", async () => {
620
+ const el = await fixture(
621
+ html`
239
622
  <sp-action-group
240
623
  label="Selects User-Chosen Buttons"
241
- .selected=${["first","second"]}
624
+ .selected=${["first", "second"]}
242
625
  >
243
626
  <sp-action-button class="first" value="first">
244
627
  First
@@ -247,12 +630,30 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
247
630
  Second
248
631
  </sp-action-button>
249
632
  </sp-action-group>
250
- `);await n(t),e(t.selected.length).to.equal(2);const o=t.querySelector(".first");e(o.selected,"first button selected").to.be.true;const s=t.querySelector(".second");e(s.selected,"second button selected").to.be.true,o.click(),await n(t),e(t.selected.length).to.equal(2),e(o.selected,"first button selected").to.be.true,e(s.selected,"second button selected").to.be.true}),it('will not change .selected state if event is prevented while [selects="multiple"]',async()=>{const t=await i(c`
633
+ `
634
+ );
635
+ await elementUpdated(el);
636
+ expect(el.selected.length).to.equal(2);
637
+ const firstButton = el.querySelector(".first");
638
+ expect(firstButton.selected, "first button selected").to.be.true;
639
+ const secondButton = el.querySelector(".second");
640
+ expect(secondButton.selected, "second button selected").to.be.true;
641
+ firstButton.click();
642
+ await elementUpdated(el);
643
+ expect(el.selected.length).to.equal(2);
644
+ expect(firstButton.selected, "first button selected").to.be.true;
645
+ expect(secondButton.selected, "second button selected").to.be.true;
646
+ });
647
+ it('will not change .selected state if event is prevented while [selects="multiple"]', async () => {
648
+ const el = await fixture(
649
+ html`
251
650
  <sp-action-group
252
651
  label="Selects Multiple Group"
253
652
  selects="multiple"
254
- .selected=${["first","second"]}
255
- @change=${h=>{h.preventDefault()}}
653
+ .selected=${["first", "second"]}
654
+ @change=${(event) => {
655
+ event.preventDefault();
656
+ }}
256
657
  >
257
658
  <sp-action-button class="first" value="first">
258
659
  First
@@ -264,12 +665,33 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
264
665
  Third
265
666
  </sp-action-button>
266
667
  </sp-action-group>
267
- `),o=t.querySelector(".first"),s=t.querySelector(".second"),l=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(2),e(o.selected,"first child selected").to.be.true,e(s.selected,"second child selected").to.be.true,l.click(),await n(t),e(l.selected,"third child not selected").to.be.false,e(t.selected.length).to.equal(2),s.click(),await n(t),e(s.selected,"second element still selected").to.be.true}),it('will not change .selected state if event is prevented while [selects="single"]',async()=>{const t=await i(c`
668
+ `
669
+ );
670
+ const firstElement = el.querySelector(".first");
671
+ const secondElement = el.querySelector(".second");
672
+ const thirdElement = el.querySelector(".third");
673
+ await elementUpdated(el);
674
+ expect(el.selected.length).to.equal(2);
675
+ expect(firstElement.selected, "first child selected").to.be.true;
676
+ expect(secondElement.selected, "second child selected").to.be.true;
677
+ thirdElement.click();
678
+ await elementUpdated(el);
679
+ expect(thirdElement.selected, "third child not selected").to.be.false;
680
+ expect(el.selected.length).to.equal(2);
681
+ secondElement.click();
682
+ await elementUpdated(el);
683
+ expect(secondElement.selected, "second element still selected").to.be.true;
684
+ });
685
+ it('will not change .selected state if event is prevented while [selects="single"]', async () => {
686
+ const el = await fixture(
687
+ html`
268
688
  <sp-action-group
269
689
  label="Selects Single Group"
270
690
  selects="single"
271
691
  .selected=${["first"]}
272
- @change=${l=>{l.preventDefault()}}
692
+ @change=${(event) => {
693
+ event.preventDefault();
694
+ }}
273
695
  >
274
696
  <sp-action-button class="first" value="first">
275
697
  First
@@ -278,11 +700,30 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
278
700
  Second
279
701
  </sp-action-button>
280
702
  </sp-action-group>
281
- `),o=t.querySelector(".first"),s=t.querySelector(".second");await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first child selected").to.be.true,s.click(),await n(t),e(s.selected,"second child not selected").to.be.false,e(t.selected.length).to.equal(1),o.click(),await n(t),e(o.selected,"first element still selected").to.be.true}),it("will not change .selected state if event is prevented while selects is undefined",async()=>{const t=await i(c`
703
+ `
704
+ );
705
+ const firstElement = el.querySelector(".first");
706
+ const secondElement = el.querySelector(".second");
707
+ await elementUpdated(el);
708
+ expect(el.selected.length).to.equal(1);
709
+ expect(firstElement.selected, "first child selected").to.be.true;
710
+ secondElement.click();
711
+ await elementUpdated(el);
712
+ expect(secondElement.selected, "second child not selected").to.be.false;
713
+ expect(el.selected.length).to.equal(1);
714
+ firstElement.click();
715
+ await elementUpdated(el);
716
+ expect(firstElement.selected, "first element still selected").to.be.true;
717
+ });
718
+ it("will not change .selected state if event is prevented while selects is undefined", async () => {
719
+ const el = await fixture(
720
+ html`
282
721
  <sp-action-group
283
722
  label="Selects Single Group"
284
723
  .selected=${["first"]}
285
- @change=${l=>{l.preventDefault()}}
724
+ @change=${(event) => {
725
+ event.preventDefault();
726
+ }}
286
727
  >
287
728
  <sp-action-button class="first" value="first">
288
729
  First
@@ -291,7 +732,22 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
291
732
  Second
292
733
  </sp-action-button>
293
734
  </sp-action-group>
294
- `),o=t.querySelector(".first"),s=t.querySelector(".second");await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first child selected").to.be.true,s.click(),await n(t),e(t.selected.length).to.equal(1),e(o.selected,"first child selected").to.be.true,e(s.selected,"second child not selected").to.be.false}),it("will accept selected as a JSON string",async()=>{const t=await i(c`
735
+ `
736
+ );
737
+ const firstElement = el.querySelector(".first");
738
+ const secondElement = el.querySelector(".second");
739
+ await elementUpdated(el);
740
+ expect(el.selected.length).to.equal(1);
741
+ expect(firstElement.selected, "first child selected").to.be.true;
742
+ secondElement.click();
743
+ await elementUpdated(el);
744
+ expect(el.selected.length).to.equal(1);
745
+ expect(firstElement.selected, "first child selected").to.be.true;
746
+ expect(secondElement.selected, "second child not selected").to.be.false;
747
+ });
748
+ it("will accept selected as a JSON string", async () => {
749
+ const el = await fixture(
750
+ html`
295
751
  <sp-action-group
296
752
  label="Selects Single Group"
297
753
  selects="single"
@@ -304,13 +760,64 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
304
760
  Second
305
761
  </sp-action-button>
306
762
  </sp-action-group>
307
- `);await n(t);const o=t.querySelector(".first"),s=t.querySelector(".second");e(t.selected.length).to.equal(1),e(o.selected,"first child selected").to.be.true,e(s.selected,"second child selected").to.be.false});const a=async t=>{const o=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Second"),o.click(),await n(t),e(o.selected,"third child selected").to.be.true,e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Third"),t.dispatchEvent(b()),await u({press:"Enter"}),await n(t),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("First"),t.dispatchEvent(w()),t.dispatchEvent(g()),await u({press:"Enter"}),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Second"),t.dispatchEvent(q()),await u({press:"Enter"}),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Third"),await u({press:"Enter"}),t.dispatchEvent(S()),await u({press:"Enter"}),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("First"),t.dispatchEvent(f()),await u({press:"Enter"}),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Second")};it("accepts keybord input",async()=>{const t=await i(c`
763
+ `
764
+ );
765
+ await elementUpdated(el);
766
+ const firstElement = el.querySelector(".first");
767
+ const secondElement = el.querySelector(".second");
768
+ expect(el.selected.length).to.equal(1);
769
+ expect(firstElement.selected, "first child selected").to.be.true;
770
+ expect(secondElement.selected, "second child selected").to.be.false;
771
+ });
772
+ const acceptKeyboardInput = async (el) => {
773
+ const thirdElement = el.querySelector(".third");
774
+ await elementUpdated(el);
775
+ expect(el.selected.length).to.equal(1);
776
+ expect(el.selected[0]).to.equal("Second");
777
+ thirdElement.click();
778
+ await elementUpdated(el);
779
+ expect(thirdElement.selected, "third child selected").to.be.true;
780
+ expect(el.selected.length).to.equal(1);
781
+ expect(el.selected[0]).to.equal("Third");
782
+ el.dispatchEvent(arrowRightEvent());
783
+ await sendKeys({ press: "Enter" });
784
+ await elementUpdated(el);
785
+ expect(el.selected.length).to.equal(1);
786
+ expect(el.selected[0]).to.equal("First");
787
+ el.dispatchEvent(arrowLeftEvent());
788
+ el.dispatchEvent(arrowUpEvent());
789
+ await sendKeys({ press: "Enter" });
790
+ expect(el.selected.length).to.equal(1);
791
+ expect(el.selected[0]).to.equal("Second");
792
+ el.dispatchEvent(endEvent());
793
+ await sendKeys({ press: "Enter" });
794
+ expect(el.selected.length).to.equal(1);
795
+ expect(el.selected[0]).to.equal("Third");
796
+ await sendKeys({ press: "Enter" });
797
+ el.dispatchEvent(homeEvent());
798
+ await sendKeys({ press: "Enter" });
799
+ expect(el.selected.length).to.equal(1);
800
+ expect(el.selected[0]).to.equal("First");
801
+ el.dispatchEvent(arrowDownEvent());
802
+ await sendKeys({ press: "Enter" });
803
+ expect(el.selected.length).to.equal(1);
804
+ expect(el.selected[0]).to.equal("Second");
805
+ };
806
+ it("accepts keybord input", async () => {
807
+ const el = await fixture(
808
+ html`
308
809
  <sp-action-group label="Selects Single Group" selects="single">
309
810
  <sp-action-button>First</sp-action-button>
310
811
  <sp-action-button selected>Second</sp-action-button>
311
812
  <sp-action-button class="third">Third</sp-action-button>
312
813
  </sp-action-group>
313
- `);await a(t)}),it("accepts keybord input with tooltip",async()=>{const t=await i(c`
814
+ `
815
+ );
816
+ await acceptKeyboardInput(el);
817
+ });
818
+ it("accepts keybord input with tooltip", async () => {
819
+ const el = await fixture(
820
+ html`
314
821
  <sp-action-group label="Selects Single Group" selects="single">
315
822
  <overlay-trigger>
316
823
  <sp-action-button slot="trigger">
@@ -335,7 +842,13 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
335
842
  <sp-tooltip slot="hover-content">Select me.</sp-tooltip>
336
843
  </overlay-trigger>
337
844
  </sp-action-group>
338
- `);await a(t)}),it('accepts keybord input when [dir="ltr"]',async()=>{const t=await i(c`
845
+ `
846
+ );
847
+ await acceptKeyboardInput(el);
848
+ });
849
+ it('accepts keybord input when [dir="ltr"]', async () => {
850
+ const el = await fixture(
851
+ html`
339
852
  <sp-action-group
340
853
  label="Selects Single Group"
341
854
  selects="single"
@@ -345,5 +858,25 @@ import{elementUpdated as n,expect as e,fixture as i,html as c,waitUntil as d}fro
345
858
  <sp-action-button disabled>Second</sp-action-button>
346
859
  <sp-action-button class="third">Third</sp-action-button>
347
860
  </sp-action-group>
348
- `),o=t.querySelector(".third");await n(t),e(t.selected.length).to.equal(0),o.click(),await n(t),e(o.selected,"third child selected").to.be.true,e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Third"),t.dispatchEvent(b()),await u({press:"Enter"}),await n(t),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("First"),t.dispatchEvent(g()),await u({press:"Enter"}),e(t.selected.length).to.equal(1),e(t.selected[0]).to.equal("Third")})});
861
+ `
862
+ );
863
+ const thirdElement = el.querySelector(".third");
864
+ await elementUpdated(el);
865
+ expect(el.selected.length).to.equal(0);
866
+ thirdElement.click();
867
+ await elementUpdated(el);
868
+ expect(thirdElement.selected, "third child selected").to.be.true;
869
+ expect(el.selected.length).to.equal(1);
870
+ expect(el.selected[0]).to.equal("Third");
871
+ el.dispatchEvent(arrowRightEvent());
872
+ await sendKeys({ press: "Enter" });
873
+ await elementUpdated(el);
874
+ expect(el.selected.length).to.equal(1);
875
+ expect(el.selected[0]).to.equal("First");
876
+ el.dispatchEvent(arrowUpEvent());
877
+ await sendKeys({ press: "Enter" });
878
+ expect(el.selected.length).to.equal(1);
879
+ expect(el.selected[0]).to.equal("Third");
880
+ });
881
+ });
349
882
  //# sourceMappingURL=action-group.test.js.map