@spectrum-web-components/menu 0.42.4 → 0.43.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/package.json +12 -12
- package/src/Menu.dev.js +10 -10
- package/src/Menu.dev.js.map +2 -2
- package/src/Menu.js +2 -2
- package/src/Menu.js.map +3 -3
- package/src/menu-item.css.dev.js +1 -1
- package/src/menu-item.css.dev.js.map +1 -1
- package/src/menu-item.css.js +1 -1
- package/src/menu-item.css.js.map +1 -1
- package/src/spectrum-menu-item.css.dev.js +1 -1
- package/src/spectrum-menu-item.css.dev.js.map +1 -1
- package/src/spectrum-menu-item.css.js +3 -3
- package/src/spectrum-menu-item.css.js.map +1 -1
- package/test/menu.test.js +150 -147
- package/test/menu.test.js.map +2 -2
package/test/menu.test.js
CHANGED
|
@@ -23,11 +23,9 @@ import { sendKeys } from "@web/test-runner-commands";
|
|
|
23
23
|
import { isWebKit } from "@spectrum-web-components/shared";
|
|
24
24
|
describe("Menu", () => {
|
|
25
25
|
it("renders empty", async () => {
|
|
26
|
-
const el = await fixture(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`
|
|
30
|
-
);
|
|
26
|
+
const el = await fixture(html`
|
|
27
|
+
<sp-menu tabindex="0"><a href="#anchor">Test</a></sp-menu>
|
|
28
|
+
`);
|
|
31
29
|
const anchor = el.querySelector("a");
|
|
32
30
|
await elementUpdated(el);
|
|
33
31
|
expect(document.activeElement === el, "self not focused, 1").to.be.false;
|
|
@@ -43,13 +41,11 @@ describe("Menu", () => {
|
|
|
43
41
|
});
|
|
44
42
|
it("renders w/ [disabled] menu items", async () => {
|
|
45
43
|
const focusinSpy = spy();
|
|
46
|
-
const el = await fixture(
|
|
47
|
-
|
|
48
|
-
<sp-menu
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
`
|
|
52
|
-
);
|
|
44
|
+
const el = await fixture(html`
|
|
45
|
+
<sp-menu tabindex="0" @focusin=${() => focusinSpy()}>
|
|
46
|
+
<sp-menu-item disabled>Disabled item</sp-menu-item>
|
|
47
|
+
</sp-menu>
|
|
48
|
+
`);
|
|
53
49
|
await elementUpdated(el);
|
|
54
50
|
expect(document.activeElement === el, "self not focused, 1").to.be.false;
|
|
55
51
|
el.focus();
|
|
@@ -59,14 +55,12 @@ describe("Menu", () => {
|
|
|
59
55
|
});
|
|
60
56
|
it("renders w/ all [disabled] menu items", async () => {
|
|
61
57
|
const focusinSpy = spy();
|
|
62
|
-
const el = await fixture(
|
|
63
|
-
|
|
64
|
-
<sp-menu
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`
|
|
69
|
-
);
|
|
58
|
+
const el = await fixture(html`
|
|
59
|
+
<sp-menu tabindex="0" @focusin=${() => focusinSpy()}>
|
|
60
|
+
<sp-menu-item disabled>Disabled item 1</sp-menu-item>
|
|
61
|
+
<sp-menu-item disabled>Disabled item 2</sp-menu-item>
|
|
62
|
+
</sp-menu>
|
|
63
|
+
`);
|
|
70
64
|
const firstItem = el.querySelector("sp-menu-item");
|
|
71
65
|
await elementUpdated(el);
|
|
72
66
|
expect(document.activeElement === el, "self not focused, 1").to.be.false;
|
|
@@ -81,19 +75,17 @@ describe("Menu", () => {
|
|
|
81
75
|
expect(el.matches(":focus-within")).to.be.false;
|
|
82
76
|
});
|
|
83
77
|
it("renders w/ menu items", async () => {
|
|
84
|
-
const el = await fixture(
|
|
85
|
-
|
|
86
|
-
<sp-menu
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`
|
|
96
|
-
);
|
|
78
|
+
const el = await fixture(html`
|
|
79
|
+
<sp-menu label="Pick an action:">
|
|
80
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
81
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
82
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
83
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
84
|
+
<sp-menu-divider></sp-menu-divider>
|
|
85
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
86
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
87
|
+
</sp-menu>
|
|
88
|
+
`);
|
|
97
89
|
await waitUntil(
|
|
98
90
|
() => el.childItems.length == 6,
|
|
99
91
|
"expected menu to manage 6 menu items"
|
|
@@ -106,26 +98,22 @@ describe("Menu", () => {
|
|
|
106
98
|
await expect(el).to.be.accessible();
|
|
107
99
|
});
|
|
108
100
|
testForLitDevWarnings(
|
|
109
|
-
async () => await fixture(
|
|
110
|
-
html`
|
|
111
|
-
<sp-menu selects="single">
|
|
112
|
-
<sp-menu-item>Not Selected</sp-menu-item>
|
|
113
|
-
<sp-menu-item selected>Selected</sp-menu-item>
|
|
114
|
-
<sp-menu-item>Other</sp-menu-item>
|
|
115
|
-
</sp-menu>
|
|
116
|
-
`
|
|
117
|
-
)
|
|
118
|
-
);
|
|
119
|
-
it("renders w/ selected", async () => {
|
|
120
|
-
const el = await fixture(
|
|
121
|
-
html`
|
|
101
|
+
async () => await fixture(html`
|
|
122
102
|
<sp-menu selects="single">
|
|
123
103
|
<sp-menu-item>Not Selected</sp-menu-item>
|
|
124
104
|
<sp-menu-item selected>Selected</sp-menu-item>
|
|
125
105
|
<sp-menu-item>Other</sp-menu-item>
|
|
126
106
|
</sp-menu>
|
|
127
|
-
`
|
|
128
|
-
|
|
107
|
+
`)
|
|
108
|
+
);
|
|
109
|
+
it("renders w/ selected", async () => {
|
|
110
|
+
const el = await fixture(html`
|
|
111
|
+
<sp-menu selects="single">
|
|
112
|
+
<sp-menu-item>Not Selected</sp-menu-item>
|
|
113
|
+
<sp-menu-item selected>Selected</sp-menu-item>
|
|
114
|
+
<sp-menu-item>Other</sp-menu-item>
|
|
115
|
+
</sp-menu>
|
|
116
|
+
`);
|
|
129
117
|
await elementUpdated(el);
|
|
130
118
|
await expect(el).to.be.accessible();
|
|
131
119
|
});
|
|
@@ -133,22 +121,20 @@ describe("Menu", () => {
|
|
|
133
121
|
if (isWebKit()) {
|
|
134
122
|
this.skip();
|
|
135
123
|
}
|
|
136
|
-
const el = await fixture(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
`
|
|
151
|
-
);
|
|
124
|
+
const el = await fixture(html`
|
|
125
|
+
<sp-menu
|
|
126
|
+
selects="single"
|
|
127
|
+
@change=${({
|
|
128
|
+
target: { value }
|
|
129
|
+
}) => {
|
|
130
|
+
navigator.clipboard.writeText(value);
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<sp-menu-item>Not Selected</sp-menu-item>
|
|
134
|
+
<sp-menu-item selected>Selected</sp-menu-item>
|
|
135
|
+
<sp-menu-item id="other">Other</sp-menu-item>
|
|
136
|
+
</sp-menu>
|
|
137
|
+
`);
|
|
152
138
|
await elementUpdated(el);
|
|
153
139
|
const otherItem = el.querySelector("#other");
|
|
154
140
|
otherItem.focus();
|
|
@@ -164,18 +150,49 @@ describe("Menu", () => {
|
|
|
164
150
|
const clipboardText = await navigator.clipboard.readText();
|
|
165
151
|
expect(clipboardText).to.equal("Other");
|
|
166
152
|
});
|
|
153
|
+
it("accepts Numpad keys", async function() {
|
|
154
|
+
if (isWebKit()) {
|
|
155
|
+
this.skip();
|
|
156
|
+
}
|
|
157
|
+
const el = await fixture(html`
|
|
158
|
+
<sp-menu
|
|
159
|
+
selects="single"
|
|
160
|
+
@change=${({
|
|
161
|
+
target: { value }
|
|
162
|
+
}) => {
|
|
163
|
+
navigator.clipboard.writeText(value);
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
<sp-menu-item>Not Selected</sp-menu-item>
|
|
167
|
+
<sp-menu-item selected>Selected</sp-menu-item>
|
|
168
|
+
<sp-menu-item id="other">Other</sp-menu-item>
|
|
169
|
+
</sp-menu>
|
|
170
|
+
`);
|
|
171
|
+
await elementUpdated(el);
|
|
172
|
+
const otherItem = el.querySelector("#other");
|
|
173
|
+
otherItem.focus();
|
|
174
|
+
await elementUpdated(el);
|
|
175
|
+
await sendKeys({
|
|
176
|
+
press: "ArrowDown"
|
|
177
|
+
});
|
|
178
|
+
await elementUpdated(el);
|
|
179
|
+
await sendKeys({
|
|
180
|
+
press: "NumpadEnter"
|
|
181
|
+
});
|
|
182
|
+
await elementUpdated(el);
|
|
183
|
+
const clipboardText = await navigator.clipboard.readText();
|
|
184
|
+
expect(clipboardText).to.equal("Other");
|
|
185
|
+
});
|
|
167
186
|
it("renders w/ hrefs", async () => {
|
|
168
|
-
const el = await fixture(
|
|
169
|
-
|
|
170
|
-
<sp-menu>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
`
|
|
178
|
-
);
|
|
187
|
+
const el = await fixture(html`
|
|
188
|
+
<sp-menu>
|
|
189
|
+
<sp-menu-item href="not-selected.html">
|
|
190
|
+
Not Selected
|
|
191
|
+
</sp-menu-item>
|
|
192
|
+
<sp-menu-item href="selected.html">Selected</sp-menu-item>
|
|
193
|
+
<sp-menu-item href="other.html">Other</sp-menu-item>
|
|
194
|
+
</sp-menu>
|
|
195
|
+
`);
|
|
179
196
|
await waitUntil(
|
|
180
197
|
() => el.childItems.length == 3,
|
|
181
198
|
"expected menu to manage 3 items"
|
|
@@ -185,19 +202,17 @@ describe("Menu", () => {
|
|
|
185
202
|
expect(el.getAttribute("role")).to.equal("menu");
|
|
186
203
|
});
|
|
187
204
|
it("handle focus and keyboard input", async () => {
|
|
188
|
-
const el = await fixture(
|
|
189
|
-
|
|
190
|
-
<sp-menu>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
`
|
|
200
|
-
);
|
|
205
|
+
const el = await fixture(html`
|
|
206
|
+
<sp-menu>
|
|
207
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
208
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
209
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
210
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
211
|
+
<sp-menu-divider></sp-menu-divider>
|
|
212
|
+
<sp-menu-item>Save Selection</sp-menu-item>
|
|
213
|
+
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
214
|
+
</sp-menu>
|
|
215
|
+
`);
|
|
201
216
|
await waitUntil(
|
|
202
217
|
() => el.childItems.length == 6,
|
|
203
218
|
"expected menu to manage 6 items"
|
|
@@ -228,16 +243,14 @@ describe("Menu", () => {
|
|
|
228
243
|
expect(secondToLastItem.focused).to.be.true;
|
|
229
244
|
});
|
|
230
245
|
it("handle focus and late descendent additions", async () => {
|
|
231
|
-
const el = await fixture(
|
|
232
|
-
|
|
233
|
-
<sp-menu>
|
|
234
|
-
<
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
`
|
|
240
|
-
);
|
|
246
|
+
const el = await fixture(html`
|
|
247
|
+
<sp-menu>
|
|
248
|
+
<sp-menu-group selects="inherit">
|
|
249
|
+
<span slot="header">Options</span>
|
|
250
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
251
|
+
</sp-menu-group>
|
|
252
|
+
</sp-menu>
|
|
253
|
+
`);
|
|
241
254
|
await waitUntil(
|
|
242
255
|
() => el.childItems.length == 1,
|
|
243
256
|
"expected menu to manage 1 item"
|
|
@@ -278,15 +291,13 @@ describe("Menu", () => {
|
|
|
278
291
|
expect(appendedItem.focused, "last visibly focused").to.be.true;
|
|
279
292
|
});
|
|
280
293
|
it("cleans up when tabbing away", async () => {
|
|
281
|
-
const el = await fixture(
|
|
282
|
-
|
|
283
|
-
<sp-menu
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
`
|
|
289
|
-
);
|
|
294
|
+
const el = await fixture(html`
|
|
295
|
+
<sp-menu tabindex="0">
|
|
296
|
+
<sp-menu-item>Deselect</sp-menu-item>
|
|
297
|
+
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
298
|
+
<sp-menu-item>Third Item</sp-menu-item>
|
|
299
|
+
</sp-menu>
|
|
300
|
+
`);
|
|
290
301
|
await waitUntil(
|
|
291
302
|
() => el.childItems.length == 3,
|
|
292
303
|
"expected menu to manage 3 items"
|
|
@@ -322,19 +333,17 @@ describe("Menu", () => {
|
|
|
322
333
|
expect(secondItem.focused, "second").to.be.true;
|
|
323
334
|
});
|
|
324
335
|
it("handles focus across focused MenuItem removals", async () => {
|
|
325
|
-
const el = await fixture(
|
|
326
|
-
|
|
327
|
-
<sp-menu
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
`
|
|
337
|
-
);
|
|
336
|
+
const el = await fixture(html`
|
|
337
|
+
<sp-menu id="test">
|
|
338
|
+
<sp-menu-item class="first">Deselect</sp-menu-item>
|
|
339
|
+
<sp-menu-item>Invert Selection</sp-menu-item>
|
|
340
|
+
<sp-menu-item>Feather...</sp-menu-item>
|
|
341
|
+
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
342
|
+
<sp-menu-item selected class="selected">
|
|
343
|
+
Save Selection
|
|
344
|
+
</sp-menu-item>
|
|
345
|
+
</sp-menu>
|
|
346
|
+
`);
|
|
338
347
|
const firstItem = el.querySelector(".first");
|
|
339
348
|
const selectedItem = el.querySelector(".selected");
|
|
340
349
|
await elementUpdated(el);
|
|
@@ -354,15 +363,13 @@ describe("Menu", () => {
|
|
|
354
363
|
expect(firstItem.focused).to.be.true;
|
|
355
364
|
});
|
|
356
365
|
it("handles single selection", async () => {
|
|
357
|
-
const el = await fixture(
|
|
358
|
-
|
|
359
|
-
<sp-menu
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
`
|
|
365
|
-
);
|
|
366
|
+
const el = await fixture(html`
|
|
367
|
+
<sp-menu selects="single">
|
|
368
|
+
<sp-menu-item selected>First</sp-menu-item>
|
|
369
|
+
<sp-menu-item>Second</sp-menu-item>
|
|
370
|
+
<sp-menu-item>Third</sp-menu-item>
|
|
371
|
+
</sp-menu>
|
|
372
|
+
`);
|
|
366
373
|
await waitUntil(
|
|
367
374
|
() => el.childItems.length == 3,
|
|
368
375
|
"expected menu to manage 3 items"
|
|
@@ -397,15 +404,13 @@ describe("Menu", () => {
|
|
|
397
404
|
});
|
|
398
405
|
it("handles multiple selection", async () => {
|
|
399
406
|
const changeSpy = spy();
|
|
400
|
-
const el = await fixture(
|
|
401
|
-
|
|
402
|
-
<sp-menu
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
`
|
|
408
|
-
);
|
|
407
|
+
const el = await fixture(html`
|
|
408
|
+
<sp-menu selects="multiple" @change=${() => changeSpy()}>
|
|
409
|
+
<sp-menu-item selected>First</sp-menu-item>
|
|
410
|
+
<sp-menu-item>Second</sp-menu-item>
|
|
411
|
+
<sp-menu-item>Third</sp-menu-item>
|
|
412
|
+
</sp-menu>
|
|
413
|
+
`);
|
|
409
414
|
await waitUntil(
|
|
410
415
|
() => el.childItems.length == 3,
|
|
411
416
|
"expected menu to manage 3 items"
|
|
@@ -459,15 +464,13 @@ describe("Menu", () => {
|
|
|
459
464
|
event.target.selected = selected;
|
|
460
465
|
});
|
|
461
466
|
};
|
|
462
|
-
const el = await fixture(
|
|
463
|
-
|
|
464
|
-
<sp-menu
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
`
|
|
470
|
-
);
|
|
467
|
+
const el = await fixture(html`
|
|
468
|
+
<sp-menu selects="multiple" @change=${toggleSingleSelected}>
|
|
469
|
+
<sp-menu-item value="1">First</sp-menu-item>
|
|
470
|
+
<sp-menu-item value="2">Second</sp-menu-item>
|
|
471
|
+
<sp-menu-item value="3">Third</sp-menu-item>
|
|
472
|
+
</sp-menu>
|
|
473
|
+
`);
|
|
471
474
|
await nextFrame();
|
|
472
475
|
await nextFrame();
|
|
473
476
|
expect(el.selected).to.deep.equal([]);
|
package/test/menu.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["menu.test.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-group.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n elementUpdated,\n expect,\n html,\n nextFrame,\n waitUntil,\n} from '@open-wc/testing';\nimport {\n arrowDownEvent,\n arrowUpEvent,\n fixture,\n tabEvent,\n testForLitDevWarnings,\n tEvent,\n} from '../../../test/testing-helpers.js';\nimport { spy } from 'sinon';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { isWebKit } from '@spectrum-web-components/shared';\n\ndescribe('Menu', () => {\n it('renders empty', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu tabindex=\"0\"><a href=\"#anchor\">Test</a></sp-menu>\n `\n );\n\n const anchor = el.querySelector('a') as HTMLAnchorElement;\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 1').to.be\n .false;\n expect(document.activeElement === anchor, 'child not focused, 1').to.be\n .false;\n\n expect(el.getAttribute('role')).to.equal('menu');\n\n el.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(document.activeElement === anchor, 'child not focused, 2').to.be\n .false;\n\n anchor.focus();\n expect(document.activeElement === el, 'self not focused, 3').to.be\n .false;\n expect(document.activeElement === anchor, 'anchor').to.be.true;\n });\n it('renders w/ [disabled] menu items', async () => {\n const focusinSpy = spy();\n const el = await fixture<Menu>(\n html`\n <sp-menu tabindex=\"0\" @focusin=${() => focusinSpy()}>\n <sp-menu-item disabled>Disabled item</sp-menu-item>\n </sp-menu>\n `\n );\n\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 1').to.be\n .false;\n\n el.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(focusinSpy.callCount).to.equal(0);\n });\n it('renders w/ all [disabled] menu items', async () => {\n const focusinSpy = spy();\n const el = await fixture<Menu>(\n html`\n <sp-menu tabindex=\"0\" @focusin=${() => focusinSpy()}>\n <sp-menu-item disabled>Disabled item 1</sp-menu-item>\n <sp-menu-item disabled>Disabled item 2</sp-menu-item>\n </sp-menu>\n `\n );\n const firstItem = el.querySelector('sp-menu-item') as MenuItem;\n\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 1').to.be\n .false;\n\n el.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(focusinSpy.callCount).to.equal(0);\n firstItem.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(focusinSpy.callCount).to.equal(0);\n expect(el.matches(':focus-within')).to.be.false;\n });\n it('renders w/ menu items', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu label=\"Pick an action:\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 6,\n 'expected menu to manage 6 menu items'\n );\n await elementUpdated(el);\n\n const inTabindexElement = el.querySelector(\n '[tabindex]:not([tabindex=\"-1\"])'\n );\n expect(inTabindexElement).to.be.null;\n await expect(el).to.be.accessible();\n });\n\n testForLitDevWarnings(\n async () =>\n await fixture<Menu>(\n html`\n <sp-menu selects=\"single\">\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item>Other</sp-menu-item>\n </sp-menu>\n `\n )\n );\n\n it('renders w/ selected', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu selects=\"single\">\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item>Other</sp-menu-item>\n </sp-menu>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('has a \"value\" that can be copied during \"change\" events', async function () {\n if (isWebKit()) {\n this.skip();\n }\n const el = await fixture<Menu>(\n html`\n <sp-menu\n selects=\"single\"\n @change=${({\n target: { value },\n }: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(value);\n }}\n >\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item id=\"other\">Other</sp-menu-item>\n </sp-menu>\n `\n );\n\n await elementUpdated(el);\n\n const otherItem = el.querySelector('#other') as MenuItem;\n otherItem.focus();\n await elementUpdated(el);\n await sendKeys({\n press: 'ArrowDown',\n });\n await elementUpdated(el);\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n const clipboardText = await navigator.clipboard.readText();\n expect(clipboardText).to.equal('Other');\n });\n\n it('renders w/ hrefs', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu>\n <sp-menu-item href=\"not-selected.html\">\n Not Selected\n </sp-menu-item>\n <sp-menu-item href=\"selected.html\">Selected</sp-menu-item>\n <sp-menu-item href=\"other.html\">Other</sp-menu-item>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n\n expect(el.getAttribute('role')).to.equal('menu');\n });\n\n it('handle focus and keyboard input', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 6,\n 'expected menu to manage 6 items'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n const thirdToLastItem = el.querySelector(\n 'sp-menu-item:nth-last-of-type(3)'\n ) as MenuItem;\n const secondToLastItem = el.querySelector(\n 'sp-menu-item:nth-last-of-type(2)'\n ) as MenuItem;\n\n el.focus();\n await elementUpdated(el);\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n\n expect(document.activeElement === el).to.be.true;\n expect(firstItem.focused).to.be.true;\n\n el.dispatchEvent(arrowUpEvent());\n el.dispatchEvent(arrowUpEvent());\n el.dispatchEvent(tEvent());\n\n expect(document.activeElement === el).to.be.true;\n expect(thirdToLastItem.focused).to.be.true;\n\n el.dispatchEvent(arrowDownEvent());\n\n expect(document.activeElement === el).to.be.true;\n expect(secondToLastItem.focused).to.be.true;\n });\n\n it('handle focus and late descendent additions', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu>\n <sp-menu-group selects=\"inherit\">\n <span slot=\"header\">Options</span>\n <sp-menu-item>Deselect</sp-menu-item>\n </sp-menu-group>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 1,\n 'expected menu to manage 1 item'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n\n el.focus();\n\n await elementUpdated(el);\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n\n expect(document.activeElement === el, 'active element').to.be.true;\n expect(firstItem.focused, 'visually focused').to.be.true;\n\n el.blur();\n\n const group = el.querySelector('sp-menu-group') as HTMLElement;\n const prependedItem = document.createElement('sp-menu-item');\n prependedItem.textContent = 'Prepended Item';\n const appendedItem = document.createElement('sp-menu-item');\n appendedItem.textContent = 'Appended Item';\n group.prepend(prependedItem);\n group.append(appendedItem);\n await elementUpdated(el);\n\n await waitUntil(() => {\n return el.childItems.length == 3;\n }, 'expected menu to manage 3 items');\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n expect(firstItem.focused).to.be.false;\n expect(prependedItem.focused).to.be.false;\n\n el.focus();\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n\n expect(document.activeElement === el, 'another active element').to.be\n .true;\n expect(prependedItem.focused, 'another visibly focused').to.be.true;\n\n el.dispatchEvent(arrowUpEvent());\n\n expect(document.activeElement === el, 'last active element').to.be.true;\n expect(appendedItem.focused, 'last visibly focused').to.be.true;\n });\n it('cleans up when tabbing away', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu tabindex=\"0\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Third Item</sp-menu-item>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n const secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n\n el.focus();\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n expect(document.activeElement === el).to.be.true;\n expect(firstItem.focused, 'first').to.be.true;\n el.dispatchEvent(arrowDownEvent());\n el.dispatchEvent(arrowDownEvent());\n expect(thirdItem.focused, 'third').to.be.true;\n // imitate tabbing away\n el.dispatchEvent(tabEvent());\n el.dispatchEvent(\n new CustomEvent('focusout', {\n composed: true,\n bubbles: true,\n })\n );\n await nextFrame();\n // re-bind keyevents\n el.startListeningToKeyboard();\n // focus management should start again from the first item.\n el.dispatchEvent(arrowDownEvent());\n expect(secondItem.focused, 'second').to.be.true;\n });\n it('handles focus across focused MenuItem removals', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu id=\"test\">\n <sp-menu-item class=\"first\">Deselect</sp-menu-item>\n <sp-menu-item>Invert Selection</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-item selected class=\"selected\">\n Save Selection\n </sp-menu-item>\n </sp-menu>\n `\n );\n const firstItem = el.querySelector('.first') as MenuItem;\n const selectedItem = el.querySelector('.selected') as MenuItem;\n\n await elementUpdated(el);\n await nextFrame();\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n // Enforce visible focus\n await sendKeys({\n press: 'ArrowUp',\n });\n await sendKeys({\n press: 'ArrowDown',\n });\n expect(selectedItem.focused).to.be.true;\n\n selectedItem.remove();\n await elementUpdated(el);\n\n expect(document.activeElement).to.equal(el);\n expect(firstItem.focused).to.be.true;\n });\n it('handles single selection', async () => {\n const el = await fixture<Menu>(\n html`\n <sp-menu selects=\"single\">\n <sp-menu-item selected>First</sp-menu-item>\n <sp-menu-item>Second</sp-menu-item>\n <sp-menu-item>Third</sp-menu-item>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await waitUntil(\n () => el.selectedItems.length == 1,\n 'expected menu to have 1 selected item'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n\n const secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n\n expect(firstItem.getAttribute('role')).to.equal('menuitemradio');\n expect(secondItem.getAttribute('role')).to.equal('menuitemradio');\n\n expect(firstItem.selected).to.be.true;\n expect(secondItem.selected).to.be.false;\n expect(firstItem.getAttribute('aria-checked')).to.equal('true');\n expect(secondItem.getAttribute('aria-checked')).to.equal('false');\n expect(el.value).to.equal('First');\n\n secondItem.click();\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n await elementUpdated(secondItem);\n\n expect(firstItem.selected).to.be.false;\n expect(secondItem.selected).to.be.true;\n expect(firstItem.getAttribute('aria-checked')).to.equal('false');\n expect(secondItem.getAttribute('aria-checked')).to.equal('true');\n expect(el.value).to.equal('Second');\n });\n it('handles multiple selection', async () => {\n const changeSpy = spy();\n const el = await fixture<Menu>(\n html`\n <sp-menu selects=\"multiple\" @change=${() => changeSpy()}>\n <sp-menu-item selected>First</sp-menu-item>\n <sp-menu-item>Second</sp-menu-item>\n <sp-menu-item>Third</sp-menu-item>\n </sp-menu>\n `\n );\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n\n const secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n\n expect(firstItem.getAttribute('role')).to.equal('menuitemcheckbox');\n expect(secondItem.getAttribute('role')).to.equal('menuitemcheckbox');\n\n expect(firstItem.selected).to.be.true;\n expect(secondItem.selected).to.be.false;\n expect(firstItem.getAttribute('aria-checked')).to.equal('true');\n expect(secondItem.getAttribute('aria-checked')).to.equal('false');\n expect(el.value).to.equal('First');\n expect(el.selectedItems.length).to.equal(1);\n\n secondItem.click();\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n await elementUpdated(secondItem);\n\n expect(changeSpy.callCount, 'one change').to.equal(1);\n expect(firstItem.selected).to.be.true;\n expect(secondItem.selected).to.be.true;\n expect(firstItem.getAttribute('aria-checked')).to.equal('true');\n expect(secondItem.getAttribute('aria-checked')).to.equal('true');\n expect(el.value).to.equal('First,Second');\n expect(el.selectedItems.length).to.equal(2);\n\n firstItem.click();\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n await elementUpdated(secondItem);\n\n expect(changeSpy.callCount, 'two changes').to.equal(2);\n expect(firstItem.selected).to.be.false;\n expect(secondItem.selected).to.be.true;\n expect(firstItem.getAttribute('aria-checked')).to.equal('false');\n expect(secondItem.getAttribute('aria-checked')).to.equal('true');\n expect(el.value).to.equal('Second');\n expect(el.selectedItems.length).to.equal(1);\n });\n it('can be controlled to manage a single togglable selection', async () => {\n const toggleSingleSelected = (\n event: Event & { target: Menu }\n ): void => {\n event.preventDefault();\n const selected: string[] = [];\n if (event.target.selected.length) {\n selected.push(event.target.selected.at(-1) as string);\n }\n event.target.updateComplete.then(() => {\n event.target.selected = selected;\n });\n };\n const el = await fixture<Menu>(\n html`\n <sp-menu selects=\"multiple\" @change=${toggleSingleSelected}>\n <sp-menu-item value=\"1\">First</sp-menu-item>\n <sp-menu-item value=\"2\">Second</sp-menu-item>\n <sp-menu-item value=\"3\">Third</sp-menu-item>\n </sp-menu>\n `\n );\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal([]);\n\n const items = [...el.children] as MenuItem[];\n await Promise.all(items.map((child) => child.updateComplete));\n\n items[0].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal(['1']);\n\n items[0].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal([]);\n\n items[1].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal(['2']);\n\n items[2].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal(['3']);\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAWA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,MAAM;AACnB,KAAG,iBAAiB,YAAY;AAC5B,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,SAAS,GAAG,cAAc,GAAG;AACnC,UAAM,eAAe,EAAE;AACvB,WAAO,SAAS,kBAAkB,IAAI,qBAAqB,EAAE,GAAG,GAC3D;AACL,WAAO,SAAS,kBAAkB,QAAQ,sBAAsB,EAAE,GAAG,GAChE;AAEL,WAAO,GAAG,aAAa,MAAM,CAAC,EAAE,GAAG,MAAM,MAAM;AAE/C,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AACvB,WAAO,SAAS,kBAAkB,IAAI,qBAAqB,EAAE,GAAG,GAC3D;AACL,WAAO,SAAS,kBAAkB,QAAQ,sBAAsB,EAAE,GAAG,GAChE;AAEL,WAAO,MAAM;AACb,WAAO,SAAS,kBAAkB,IAAI,qBAAqB,EAAE,GAAG,GAC3D;AACL,WAAO,SAAS,kBAAkB,QAAQ,QAAQ,EAAE,GAAG,GAAG;AAAA,EAC9D,CAAC;AACD,KAAG,oCAAoC,YAAY;AAC/C,UAAM,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GAAG,KAAK,MAAM,CAAC,CAAC;AAEpC,UAAM,QAAQ,CAAC,GAAG,GAAG,QAAQ;AAC7B,UAAM,QAAQ,IAAI,MAAM,IAAI,CAAC,UAAU,MAAM,cAAc,CAAC;AAE5D,UAAM,CAAC,EAAE,MAAM;AACf,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC;AAEvC,UAAM,CAAC,EAAE,MAAM;AACf,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;AAEpC,UAAM,CAAC,EAAE,MAAM;AACf,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC;AAEvC,UAAM,CAAC,EAAE,MAAM;AACf,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC;AAAA,EAC3C,CAAC;AACL,CAAC;",
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-divider.js';\nimport '@spectrum-web-components/menu/sp-menu-group.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { Menu, MenuItem } from '@spectrum-web-components/menu';\nimport {\n elementUpdated,\n expect,\n html,\n nextFrame,\n waitUntil,\n} from '@open-wc/testing';\nimport {\n arrowDownEvent,\n arrowUpEvent,\n fixture,\n tabEvent,\n testForLitDevWarnings,\n tEvent,\n} from '../../../test/testing-helpers.js';\nimport { spy } from 'sinon';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { isWebKit } from '@spectrum-web-components/shared';\n\ndescribe('Menu', () => {\n it('renders empty', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu tabindex=\"0\"><a href=\"#anchor\">Test</a></sp-menu>\n `);\n\n const anchor = el.querySelector('a') as HTMLAnchorElement;\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 1').to.be\n .false;\n expect(document.activeElement === anchor, 'child not focused, 1').to.be\n .false;\n\n expect(el.getAttribute('role')).to.equal('menu');\n\n el.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(document.activeElement === anchor, 'child not focused, 2').to.be\n .false;\n\n anchor.focus();\n expect(document.activeElement === el, 'self not focused, 3').to.be\n .false;\n expect(document.activeElement === anchor, 'anchor').to.be.true;\n });\n it('renders w/ [disabled] menu items', async () => {\n const focusinSpy = spy();\n const el = await fixture<Menu>(html`\n <sp-menu tabindex=\"0\" @focusin=${() => focusinSpy()}>\n <sp-menu-item disabled>Disabled item</sp-menu-item>\n </sp-menu>\n `);\n\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 1').to.be\n .false;\n\n el.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(focusinSpy.callCount).to.equal(0);\n });\n it('renders w/ all [disabled] menu items', async () => {\n const focusinSpy = spy();\n const el = await fixture<Menu>(html`\n <sp-menu tabindex=\"0\" @focusin=${() => focusinSpy()}>\n <sp-menu-item disabled>Disabled item 1</sp-menu-item>\n <sp-menu-item disabled>Disabled item 2</sp-menu-item>\n </sp-menu>\n `);\n const firstItem = el.querySelector('sp-menu-item') as MenuItem;\n\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 1').to.be\n .false;\n\n el.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(focusinSpy.callCount).to.equal(0);\n firstItem.focus();\n await elementUpdated(el);\n expect(document.activeElement === el, 'self not focused, 2').to.be\n .false;\n expect(focusinSpy.callCount).to.equal(0);\n expect(el.matches(':focus-within')).to.be.false;\n });\n it('renders w/ menu items', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu label=\"Pick an action:\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 6,\n 'expected menu to manage 6 menu items'\n );\n await elementUpdated(el);\n\n const inTabindexElement = el.querySelector(\n '[tabindex]:not([tabindex=\"-1\"])'\n );\n expect(inTabindexElement).to.be.null;\n await expect(el).to.be.accessible();\n });\n\n testForLitDevWarnings(\n async () =>\n await fixture<Menu>(html`\n <sp-menu selects=\"single\">\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item>Other</sp-menu-item>\n </sp-menu>\n `)\n );\n\n it('renders w/ selected', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu selects=\"single\">\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item>Other</sp-menu-item>\n </sp-menu>\n `);\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('has a \"value\" that can be copied during \"change\" events', async function () {\n if (isWebKit()) {\n this.skip();\n }\n const el = await fixture<Menu>(html`\n <sp-menu\n selects=\"single\"\n @change=${({\n target: { value },\n }: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(value);\n }}\n >\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item id=\"other\">Other</sp-menu-item>\n </sp-menu>\n `);\n\n await elementUpdated(el);\n\n const otherItem = el.querySelector('#other') as MenuItem;\n otherItem.focus();\n await elementUpdated(el);\n await sendKeys({\n press: 'ArrowDown',\n });\n await elementUpdated(el);\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n const clipboardText = await navigator.clipboard.readText();\n expect(clipboardText).to.equal('Other');\n });\n\n it('accepts Numpad keys', async function () {\n if (isWebKit()) {\n this.skip();\n }\n const el = await fixture<Menu>(html`\n <sp-menu\n selects=\"single\"\n @change=${({\n target: { value },\n }: Event & { target: Menu }): void => {\n navigator.clipboard.writeText(value);\n }}\n >\n <sp-menu-item>Not Selected</sp-menu-item>\n <sp-menu-item selected>Selected</sp-menu-item>\n <sp-menu-item id=\"other\">Other</sp-menu-item>\n </sp-menu>\n `);\n\n await elementUpdated(el);\n\n const otherItem = el.querySelector('#other') as MenuItem;\n otherItem.focus();\n await elementUpdated(el);\n await sendKeys({\n press: 'ArrowDown',\n });\n await elementUpdated(el);\n await sendKeys({\n press: 'NumpadEnter',\n });\n\n await elementUpdated(el);\n\n const clipboardText = await navigator.clipboard.readText();\n expect(clipboardText).to.equal('Other');\n });\n\n it('renders w/ hrefs', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu>\n <sp-menu-item href=\"not-selected.html\">\n Not Selected\n </sp-menu-item>\n <sp-menu-item href=\"selected.html\">Selected</sp-menu-item>\n <sp-menu-item href=\"other.html\">Other</sp-menu-item>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n\n expect(el.getAttribute('role')).to.equal('menu');\n });\n\n it('handle focus and keyboard input', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 6,\n 'expected menu to manage 6 items'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n const thirdToLastItem = el.querySelector(\n 'sp-menu-item:nth-last-of-type(3)'\n ) as MenuItem;\n const secondToLastItem = el.querySelector(\n 'sp-menu-item:nth-last-of-type(2)'\n ) as MenuItem;\n\n el.focus();\n await elementUpdated(el);\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n\n expect(document.activeElement === el).to.be.true;\n expect(firstItem.focused).to.be.true;\n\n el.dispatchEvent(arrowUpEvent());\n el.dispatchEvent(arrowUpEvent());\n el.dispatchEvent(tEvent());\n\n expect(document.activeElement === el).to.be.true;\n expect(thirdToLastItem.focused).to.be.true;\n\n el.dispatchEvent(arrowDownEvent());\n\n expect(document.activeElement === el).to.be.true;\n expect(secondToLastItem.focused).to.be.true;\n });\n\n it('handle focus and late descendent additions', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu>\n <sp-menu-group selects=\"inherit\">\n <span slot=\"header\">Options</span>\n <sp-menu-item>Deselect</sp-menu-item>\n </sp-menu-group>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 1,\n 'expected menu to manage 1 item'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n\n el.focus();\n\n await elementUpdated(el);\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n\n expect(document.activeElement === el, 'active element').to.be.true;\n expect(firstItem.focused, 'visually focused').to.be.true;\n\n el.blur();\n\n const group = el.querySelector('sp-menu-group') as HTMLElement;\n const prependedItem = document.createElement('sp-menu-item');\n prependedItem.textContent = 'Prepended Item';\n const appendedItem = document.createElement('sp-menu-item');\n appendedItem.textContent = 'Appended Item';\n group.prepend(prependedItem);\n group.append(appendedItem);\n await elementUpdated(el);\n\n await waitUntil(() => {\n return el.childItems.length == 3;\n }, 'expected menu to manage 3 items');\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n expect(firstItem.focused).to.be.false;\n expect(prependedItem.focused).to.be.false;\n\n el.focus();\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n\n expect(document.activeElement === el, 'another active element').to.be\n .true;\n expect(prependedItem.focused, 'another visibly focused').to.be.true;\n\n el.dispatchEvent(arrowUpEvent());\n\n expect(document.activeElement === el, 'last active element').to.be.true;\n expect(appendedItem.focused, 'last visibly focused').to.be.true;\n });\n it('cleans up when tabbing away', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu tabindex=\"0\">\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Third Item</sp-menu-item>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n const secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n\n el.focus();\n // Activate :focus-visible\n await sendKeys({ press: 'ArrowDown' });\n await sendKeys({ press: 'ArrowUp' });\n expect(document.activeElement === el).to.be.true;\n expect(firstItem.focused, 'first').to.be.true;\n el.dispatchEvent(arrowDownEvent());\n el.dispatchEvent(arrowDownEvent());\n expect(thirdItem.focused, 'third').to.be.true;\n // imitate tabbing away\n el.dispatchEvent(tabEvent());\n el.dispatchEvent(\n new CustomEvent('focusout', {\n composed: true,\n bubbles: true,\n })\n );\n await nextFrame();\n // re-bind keyevents\n el.startListeningToKeyboard();\n // focus management should start again from the first item.\n el.dispatchEvent(arrowDownEvent());\n expect(secondItem.focused, 'second').to.be.true;\n });\n it('handles focus across focused MenuItem removals', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu id=\"test\">\n <sp-menu-item class=\"first\">Deselect</sp-menu-item>\n <sp-menu-item>Invert Selection</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-item selected class=\"selected\">\n Save Selection\n </sp-menu-item>\n </sp-menu>\n `);\n const firstItem = el.querySelector('.first') as MenuItem;\n const selectedItem = el.querySelector('.selected') as MenuItem;\n\n await elementUpdated(el);\n await nextFrame();\n el.focus();\n\n expect(document.activeElement).to.equal(el);\n // Enforce visible focus\n await sendKeys({\n press: 'ArrowUp',\n });\n await sendKeys({\n press: 'ArrowDown',\n });\n expect(selectedItem.focused).to.be.true;\n\n selectedItem.remove();\n await elementUpdated(el);\n\n expect(document.activeElement).to.equal(el);\n expect(firstItem.focused).to.be.true;\n });\n it('handles single selection', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu selects=\"single\">\n <sp-menu-item selected>First</sp-menu-item>\n <sp-menu-item>Second</sp-menu-item>\n <sp-menu-item>Third</sp-menu-item>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await waitUntil(\n () => el.selectedItems.length == 1,\n 'expected menu to have 1 selected item'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n\n const secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n\n expect(firstItem.getAttribute('role')).to.equal('menuitemradio');\n expect(secondItem.getAttribute('role')).to.equal('menuitemradio');\n\n expect(firstItem.selected).to.be.true;\n expect(secondItem.selected).to.be.false;\n expect(firstItem.getAttribute('aria-checked')).to.equal('true');\n expect(secondItem.getAttribute('aria-checked')).to.equal('false');\n expect(el.value).to.equal('First');\n\n secondItem.click();\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n await elementUpdated(secondItem);\n\n expect(firstItem.selected).to.be.false;\n expect(secondItem.selected).to.be.true;\n expect(firstItem.getAttribute('aria-checked')).to.equal('false');\n expect(secondItem.getAttribute('aria-checked')).to.equal('true');\n expect(el.value).to.equal('Second');\n });\n it('handles multiple selection', async () => {\n const changeSpy = spy();\n const el = await fixture<Menu>(html`\n <sp-menu selects=\"multiple\" @change=${() => changeSpy()}>\n <sp-menu-item selected>First</sp-menu-item>\n <sp-menu-item>Second</sp-menu-item>\n <sp-menu-item>Third</sp-menu-item>\n </sp-menu>\n `);\n\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items'\n );\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n\n const secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n\n expect(firstItem.getAttribute('role')).to.equal('menuitemcheckbox');\n expect(secondItem.getAttribute('role')).to.equal('menuitemcheckbox');\n\n expect(firstItem.selected).to.be.true;\n expect(secondItem.selected).to.be.false;\n expect(firstItem.getAttribute('aria-checked')).to.equal('true');\n expect(secondItem.getAttribute('aria-checked')).to.equal('false');\n expect(el.value).to.equal('First');\n expect(el.selectedItems.length).to.equal(1);\n\n secondItem.click();\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n await elementUpdated(secondItem);\n\n expect(changeSpy.callCount, 'one change').to.equal(1);\n expect(firstItem.selected).to.be.true;\n expect(secondItem.selected).to.be.true;\n expect(firstItem.getAttribute('aria-checked')).to.equal('true');\n expect(secondItem.getAttribute('aria-checked')).to.equal('true');\n expect(el.value).to.equal('First,Second');\n expect(el.selectedItems.length).to.equal(2);\n\n firstItem.click();\n\n await elementUpdated(el);\n await elementUpdated(firstItem);\n await elementUpdated(secondItem);\n\n expect(changeSpy.callCount, 'two changes').to.equal(2);\n expect(firstItem.selected).to.be.false;\n expect(secondItem.selected).to.be.true;\n expect(firstItem.getAttribute('aria-checked')).to.equal('false');\n expect(secondItem.getAttribute('aria-checked')).to.equal('true');\n expect(el.value).to.equal('Second');\n expect(el.selectedItems.length).to.equal(1);\n });\n it('can be controlled to manage a single togglable selection', async () => {\n const toggleSingleSelected = (\n event: Event & { target: Menu }\n ): void => {\n event.preventDefault();\n const selected: string[] = [];\n if (event.target.selected.length) {\n selected.push(event.target.selected.at(-1) as string);\n }\n event.target.updateComplete.then(() => {\n event.target.selected = selected;\n });\n };\n const el = await fixture<Menu>(html`\n <sp-menu selects=\"multiple\" @change=${toggleSingleSelected}>\n <sp-menu-item value=\"1\">First</sp-menu-item>\n <sp-menu-item value=\"2\">Second</sp-menu-item>\n <sp-menu-item value=\"3\">Third</sp-menu-item>\n </sp-menu>\n `);\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal([]);\n\n const items = [...el.children] as MenuItem[];\n await Promise.all(items.map((child) => child.updateComplete));\n\n items[0].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal(['1']);\n\n items[0].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal([]);\n\n items[1].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal(['2']);\n\n items[2].click();\n await nextFrame();\n await nextFrame();\n expect(el.selected).to.deep.equal(['3']);\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP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