@spectrum-web-components/menu 1.3.0-beta.2 → 1.3.0-testing.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 +11 -12
- package/LICENSE +0 -201
- package/stories/index.js +0 -90
- package/stories/index.js.map +0 -7
- package/stories/menu-divider.stories.js +0 -32
- package/stories/menu-divider.stories.js.map +0 -7
- package/stories/menu-group.stories.js +0 -144
- package/stories/menu-group.stories.js.map +0 -7
- package/stories/menu-item.disconnected.stories.js +0 -178
- package/stories/menu-item.disconnected.stories.js.map +0 -7
- package/stories/menu-item.stories.js +0 -73
- package/stories/menu-item.stories.js.map +0 -7
- package/stories/menu-sizes.stories.js +0 -11
- package/stories/menu-sizes.stories.js.map +0 -7
- package/stories/menu.stories.js +0 -427
- package/stories/menu.stories.js.map +0 -7
- package/stories/submenu.stories.js +0 -415
- package/stories/submenu.stories.js.map +0 -7
- package/test/benchmark/test-basic.js +0 -24
- package/test/benchmark/test-basic.js.map +0 -7
- package/test/menu-divider.test-vrt.js +0 -5
- package/test/menu-divider.test-vrt.js.map +0 -7
- package/test/menu-group.test-vrt.js +0 -5
- package/test/menu-group.test-vrt.js.map +0 -7
- package/test/menu-group.test.js +0 -401
- package/test/menu-group.test.js.map +0 -7
- package/test/menu-item.disconnected.test-vrt.js +0 -5
- package/test/menu-item.disconnected.test-vrt.js.map +0 -7
- package/test/menu-item.test-vrt.js +0 -5
- package/test/menu-item.test-vrt.js.map +0 -7
- package/test/menu-item.test.js +0 -227
- package/test/menu-item.test.js.map +0 -7
- package/test/menu-memory.test.js +0 -5
- package/test/menu-memory.test.js.map +0 -7
- package/test/menu-selects.test.js +0 -523
- package/test/menu-selects.test.js.map +0 -7
- package/test/menu-sizes.test-vrt.js +0 -5
- package/test/menu-sizes.test-vrt.js.map +0 -7
- package/test/menu.test-vrt.js +0 -5
- package/test/menu.test-vrt.js.map +0 -7
- package/test/menu.test.js +0 -563
- package/test/menu.test.js.map +0 -7
- package/test/submenu.test-vrt.js +0 -5
- package/test/submenu.test-vrt.js.map +0 -7
- package/test/submenu.test.js +0 -1028
- package/test/submenu.test.js.map +0 -7
package/test/menu.test.js
DELETED
|
@@ -1,563 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
aTimeout,
|
|
4
|
-
elementUpdated,
|
|
5
|
-
expect,
|
|
6
|
-
html,
|
|
7
|
-
nextFrame,
|
|
8
|
-
waitUntil
|
|
9
|
-
} from "@open-wc/testing";
|
|
10
|
-
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
11
|
-
import "@spectrum-web-components/menu/sp-menu-group.js";
|
|
12
|
-
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
13
|
-
import "@spectrum-web-components/menu/sp-menu.js";
|
|
14
|
-
import { isFirefox, isWebKit } from "@spectrum-web-components/shared";
|
|
15
|
-
import { sendKeys } from "@web/test-runner-commands";
|
|
16
|
-
import { spy } from "sinon";
|
|
17
|
-
import { sendMouse } from "../../../test/plugins/browser.js";
|
|
18
|
-
import {
|
|
19
|
-
arrowDownEvent,
|
|
20
|
-
arrowUpEvent,
|
|
21
|
-
fixture,
|
|
22
|
-
tabEvent,
|
|
23
|
-
testForLitDevWarnings,
|
|
24
|
-
tEvent
|
|
25
|
-
} from "../../../test/testing-helpers.js";
|
|
26
|
-
describe("Menu", () => {
|
|
27
|
-
it("renders empty", async () => {
|
|
28
|
-
const el = await fixture(html`
|
|
29
|
-
<sp-menu tabindex="0"><a href="#anchor">Test</a></sp-menu>
|
|
30
|
-
`);
|
|
31
|
-
const anchor = el.querySelector("a");
|
|
32
|
-
await elementUpdated(el);
|
|
33
|
-
expect(document.activeElement === el, "self not focused, 1").to.be.false;
|
|
34
|
-
expect(document.activeElement === anchor, "child not focused, 1").to.be.false;
|
|
35
|
-
expect(el.getAttribute("role")).to.equal("menu");
|
|
36
|
-
el.focus();
|
|
37
|
-
await elementUpdated(el);
|
|
38
|
-
expect(document.activeElement === el, "self not focused, 2").to.be.false;
|
|
39
|
-
expect(document.activeElement === anchor, "child not focused, 2").to.be.false;
|
|
40
|
-
anchor.focus();
|
|
41
|
-
expect(document.activeElement === el, "self not focused, 3").to.be.false;
|
|
42
|
-
expect(document.activeElement === anchor, "anchor").to.be.true;
|
|
43
|
-
});
|
|
44
|
-
it("renders w/ [disabled] menu items", async () => {
|
|
45
|
-
const focusinSpy = spy();
|
|
46
|
-
const el = await fixture(html`
|
|
47
|
-
<sp-menu tabindex="0" @focusin=${() => focusinSpy()}>
|
|
48
|
-
<sp-menu-item disabled>Disabled item</sp-menu-item>
|
|
49
|
-
</sp-menu>
|
|
50
|
-
`);
|
|
51
|
-
await elementUpdated(el);
|
|
52
|
-
expect(document.activeElement === el, "self not focused, 1").to.be.false;
|
|
53
|
-
el.focus();
|
|
54
|
-
await elementUpdated(el);
|
|
55
|
-
expect(document.activeElement === el, "self not focused, 2").to.be.false;
|
|
56
|
-
expect(focusinSpy.callCount).to.equal(0);
|
|
57
|
-
});
|
|
58
|
-
it("renders w/ all [disabled] menu items", async () => {
|
|
59
|
-
const focusinSpy = spy();
|
|
60
|
-
const el = await fixture(html`
|
|
61
|
-
<sp-menu tabindex="0" @focusin=${() => focusinSpy()}>
|
|
62
|
-
<sp-menu-item disabled>Disabled item 1</sp-menu-item>
|
|
63
|
-
<sp-menu-item disabled>Disabled item 2</sp-menu-item>
|
|
64
|
-
</sp-menu>
|
|
65
|
-
`);
|
|
66
|
-
const firstItem = el.querySelector("sp-menu-item");
|
|
67
|
-
await elementUpdated(el);
|
|
68
|
-
expect(document.activeElement === el, "self not focused, 1").to.be.false;
|
|
69
|
-
el.focus();
|
|
70
|
-
await elementUpdated(el);
|
|
71
|
-
expect(document.activeElement === el, "self not focused, 2").to.be.false;
|
|
72
|
-
expect(focusinSpy.callCount).to.equal(0);
|
|
73
|
-
firstItem.focus();
|
|
74
|
-
await elementUpdated(el);
|
|
75
|
-
expect(document.activeElement === el, "self not focused, 2").to.be.false;
|
|
76
|
-
expect(focusinSpy.callCount).to.equal(0);
|
|
77
|
-
expect(el.matches(":focus-within")).to.be.false;
|
|
78
|
-
});
|
|
79
|
-
it("renders w/ menu items", async () => {
|
|
80
|
-
const el = await fixture(html`
|
|
81
|
-
<sp-menu label="Pick an action:">
|
|
82
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
83
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
84
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
85
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
86
|
-
<sp-menu-divider></sp-menu-divider>
|
|
87
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
88
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
89
|
-
</sp-menu>
|
|
90
|
-
`);
|
|
91
|
-
await elementUpdated(el);
|
|
92
|
-
expect(el.childItems.length).to.equal(6);
|
|
93
|
-
await expect(el).to.be.accessible();
|
|
94
|
-
});
|
|
95
|
-
testForLitDevWarnings(
|
|
96
|
-
async () => await fixture(html`
|
|
97
|
-
<sp-menu selects="single">
|
|
98
|
-
<sp-menu-item>Not Selected</sp-menu-item>
|
|
99
|
-
<sp-menu-item selected>Selected</sp-menu-item>
|
|
100
|
-
<sp-menu-item>Other</sp-menu-item>
|
|
101
|
-
</sp-menu>
|
|
102
|
-
`)
|
|
103
|
-
);
|
|
104
|
-
it("renders w/ selected", async () => {
|
|
105
|
-
const el = await fixture(html`
|
|
106
|
-
<sp-menu selects="single">
|
|
107
|
-
<sp-menu-item>Not Selected</sp-menu-item>
|
|
108
|
-
<sp-menu-item selected>Selected</sp-menu-item>
|
|
109
|
-
<sp-menu-item>Other</sp-menu-item>
|
|
110
|
-
</sp-menu>
|
|
111
|
-
`);
|
|
112
|
-
await elementUpdated(el);
|
|
113
|
-
const selectedItem = el.querySelector(
|
|
114
|
-
"sp-menu-item[selected]"
|
|
115
|
-
);
|
|
116
|
-
expect(selectedItem.selected).to.be.true;
|
|
117
|
-
await expect(el).to.be.accessible();
|
|
118
|
-
});
|
|
119
|
-
it('has a "value" that can be copied during "change" events', async function() {
|
|
120
|
-
if (isWebKit() || isFirefox()) {
|
|
121
|
-
this.skip();
|
|
122
|
-
}
|
|
123
|
-
const el = await fixture(html`
|
|
124
|
-
<sp-menu
|
|
125
|
-
selects="single"
|
|
126
|
-
@change=${({
|
|
127
|
-
target: { value }
|
|
128
|
-
}) => {
|
|
129
|
-
navigator.clipboard.writeText(value);
|
|
130
|
-
}}
|
|
131
|
-
>
|
|
132
|
-
<sp-menu-item>Not Selected</sp-menu-item>
|
|
133
|
-
<sp-menu-item selected>Selected</sp-menu-item>
|
|
134
|
-
<sp-menu-item id="other">Other</sp-menu-item>
|
|
135
|
-
</sp-menu>
|
|
136
|
-
`);
|
|
137
|
-
await elementUpdated(el);
|
|
138
|
-
const selectedItem = el.querySelector(
|
|
139
|
-
"sp-menu-item[selected]"
|
|
140
|
-
);
|
|
141
|
-
selectedItem.focus();
|
|
142
|
-
await elementUpdated(el);
|
|
143
|
-
await sendKeys({
|
|
144
|
-
press: "ArrowDown"
|
|
145
|
-
});
|
|
146
|
-
await elementUpdated(el);
|
|
147
|
-
await sendKeys({
|
|
148
|
-
press: "Enter"
|
|
149
|
-
});
|
|
150
|
-
const clipboardText = await navigator.clipboard.readText();
|
|
151
|
-
await elementUpdated(el);
|
|
152
|
-
expect(clipboardText).to.equal("Other");
|
|
153
|
-
});
|
|
154
|
-
it("accepts Numpad keys", async function() {
|
|
155
|
-
if (isWebKit() || isFirefox()) {
|
|
156
|
-
this.skip();
|
|
157
|
-
}
|
|
158
|
-
const el = await fixture(html`
|
|
159
|
-
<sp-menu
|
|
160
|
-
selects="single"
|
|
161
|
-
@change=${({
|
|
162
|
-
target: { value }
|
|
163
|
-
}) => {
|
|
164
|
-
navigator.clipboard.writeText(value);
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
<sp-menu-item>Not Selected</sp-menu-item>
|
|
168
|
-
<sp-menu-item selected>Selected</sp-menu-item>
|
|
169
|
-
<sp-menu-item id="other">Other</sp-menu-item>
|
|
170
|
-
</sp-menu>
|
|
171
|
-
`);
|
|
172
|
-
await elementUpdated(el);
|
|
173
|
-
const selectedItem = el.querySelector(
|
|
174
|
-
"sp-menu-item[selected]"
|
|
175
|
-
);
|
|
176
|
-
selectedItem.focus();
|
|
177
|
-
await elementUpdated(el);
|
|
178
|
-
await sendKeys({
|
|
179
|
-
press: "ArrowDown"
|
|
180
|
-
});
|
|
181
|
-
await elementUpdated(el);
|
|
182
|
-
await sendKeys({
|
|
183
|
-
press: "NumpadEnter"
|
|
184
|
-
});
|
|
185
|
-
await elementUpdated(el);
|
|
186
|
-
const clipboardText = await navigator.clipboard.readText();
|
|
187
|
-
expect(clipboardText).to.equal("Other");
|
|
188
|
-
});
|
|
189
|
-
it("renders w/ hrefs", async () => {
|
|
190
|
-
const el = await fixture(html`
|
|
191
|
-
<sp-menu>
|
|
192
|
-
<sp-menu-item href="not-selected.html">
|
|
193
|
-
Not Selected
|
|
194
|
-
</sp-menu-item>
|
|
195
|
-
<sp-menu-item href="selected.html">Selected</sp-menu-item>
|
|
196
|
-
<sp-menu-item href="other.html">Other</sp-menu-item>
|
|
197
|
-
</sp-menu>
|
|
198
|
-
`);
|
|
199
|
-
await waitUntil(
|
|
200
|
-
() => el.childItems.length == 3,
|
|
201
|
-
"expected menu to manage 3 items"
|
|
202
|
-
);
|
|
203
|
-
await elementUpdated(el);
|
|
204
|
-
await expect(el).to.be.accessible();
|
|
205
|
-
expect(el.getAttribute("role")).to.equal("menu");
|
|
206
|
-
});
|
|
207
|
-
it("handle focus and keyboard input", async () => {
|
|
208
|
-
const el = await fixture(html`
|
|
209
|
-
<sp-menu>
|
|
210
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
211
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
212
|
-
<sp-menu-item>Feather...</sp-menu-item>
|
|
213
|
-
<sp-menu-item>Select and Mask...</sp-menu-item>
|
|
214
|
-
<sp-menu-divider></sp-menu-divider>
|
|
215
|
-
<sp-menu-item>Save Selection</sp-menu-item>
|
|
216
|
-
<sp-menu-item disabled>Make Work Path</sp-menu-item>
|
|
217
|
-
</sp-menu>
|
|
218
|
-
`);
|
|
219
|
-
await waitUntil(
|
|
220
|
-
() => el.childItems.length == 6,
|
|
221
|
-
"expected menu to manage 6 items"
|
|
222
|
-
);
|
|
223
|
-
await elementUpdated(el);
|
|
224
|
-
const firstItem = el.querySelector(
|
|
225
|
-
"sp-menu-item:nth-of-type(1)"
|
|
226
|
-
);
|
|
227
|
-
const thirdToLastItem = el.querySelector(
|
|
228
|
-
"sp-menu-item:nth-last-of-type(3)"
|
|
229
|
-
);
|
|
230
|
-
const secondToLastItem = el.querySelector(
|
|
231
|
-
"sp-menu-item:nth-last-of-type(2)"
|
|
232
|
-
);
|
|
233
|
-
el.focus();
|
|
234
|
-
await elementUpdated(el);
|
|
235
|
-
expect(document.activeElement === firstItem, "active element").to.be.true;
|
|
236
|
-
expect(firstItem.focused, "first item focused").to.be.true;
|
|
237
|
-
expect(firstItem.textContent, "focused item text").to.equal("Deselect");
|
|
238
|
-
el.dispatchEvent(arrowUpEvent());
|
|
239
|
-
el.dispatchEvent(arrowUpEvent());
|
|
240
|
-
el.dispatchEvent(tEvent());
|
|
241
|
-
expect(
|
|
242
|
-
document.activeElement === thirdToLastItem,
|
|
243
|
-
"active element after arrow up"
|
|
244
|
-
).to.be.true;
|
|
245
|
-
expect(thirdToLastItem.focused, "third to last item focused").to.be.true;
|
|
246
|
-
expect(thirdToLastItem.textContent, "focused item text").to.equal(
|
|
247
|
-
"Select and Mask..."
|
|
248
|
-
);
|
|
249
|
-
el.dispatchEvent(arrowDownEvent());
|
|
250
|
-
expect(
|
|
251
|
-
document.activeElement === secondToLastItem,
|
|
252
|
-
"active element after arrow down"
|
|
253
|
-
).to.be.true;
|
|
254
|
-
expect(secondToLastItem.focused, "second to last item focused").to.be.true;
|
|
255
|
-
expect(secondToLastItem.textContent, "focused item text").to.equal(
|
|
256
|
-
"Save Selection"
|
|
257
|
-
);
|
|
258
|
-
});
|
|
259
|
-
it("handle focus and late descendant additions", async () => {
|
|
260
|
-
const el = await fixture(html`
|
|
261
|
-
<sp-menu>
|
|
262
|
-
<sp-menu-group selects="inherit">
|
|
263
|
-
<span slot="header">Options</span>
|
|
264
|
-
<sp-menu-item id="deselect">Deselect</sp-menu-item>
|
|
265
|
-
</sp-menu-group>
|
|
266
|
-
</sp-menu>
|
|
267
|
-
`);
|
|
268
|
-
await waitUntil(
|
|
269
|
-
() => el.childItems.length == 1,
|
|
270
|
-
"expected menu to manage 1 item"
|
|
271
|
-
);
|
|
272
|
-
await elementUpdated(el);
|
|
273
|
-
const initialLoadedItem = el.querySelector("#deselect");
|
|
274
|
-
el.focus();
|
|
275
|
-
await elementUpdated(el);
|
|
276
|
-
expect(document.activeElement === initialLoadedItem, "active element").to.be.true;
|
|
277
|
-
expect(initialLoadedItem.focused, "visually focused").to.be.true;
|
|
278
|
-
expect(initialLoadedItem.textContent, "focused item text").to.equal(
|
|
279
|
-
"Deselect"
|
|
280
|
-
);
|
|
281
|
-
el.blur();
|
|
282
|
-
const group = el.querySelector("sp-menu-group");
|
|
283
|
-
const prependedItem = document.createElement("sp-menu-item");
|
|
284
|
-
prependedItem.textContent = "Prepended Item";
|
|
285
|
-
const appendedItem = document.createElement("sp-menu-item");
|
|
286
|
-
appendedItem.textContent = "Appended Item";
|
|
287
|
-
group.prepend(prependedItem);
|
|
288
|
-
group.append(appendedItem);
|
|
289
|
-
await elementUpdated(el);
|
|
290
|
-
await waitUntil(() => {
|
|
291
|
-
return el.childItems.length == 3;
|
|
292
|
-
}, "expected menu to manage 3 items");
|
|
293
|
-
await elementUpdated(el);
|
|
294
|
-
expect(el.childItems.length).to.equal(3);
|
|
295
|
-
el.focus();
|
|
296
|
-
expect(
|
|
297
|
-
document.activeElement === prependedItem,
|
|
298
|
-
"prepended item is active element?"
|
|
299
|
-
).to.be.true;
|
|
300
|
-
expect(prependedItem.focused, "prepended item visibly focused").to.be.true;
|
|
301
|
-
await sendKeys({ press: "ArrowUp" });
|
|
302
|
-
expect(
|
|
303
|
-
document.activeElement === appendedItem,
|
|
304
|
-
"appended item is active element"
|
|
305
|
-
).to.be.true;
|
|
306
|
-
expect(appendedItem.focused, "appended visibly focused").to.be.true;
|
|
307
|
-
});
|
|
308
|
-
it("cleans up when tabbing away", async () => {
|
|
309
|
-
const el = await fixture(html`
|
|
310
|
-
<sp-menu>
|
|
311
|
-
<sp-menu-item>Deselect</sp-menu-item>
|
|
312
|
-
<sp-menu-item>Select Inverse</sp-menu-item>
|
|
313
|
-
<sp-menu-item>Third Item</sp-menu-item>
|
|
314
|
-
</sp-menu>
|
|
315
|
-
`);
|
|
316
|
-
await elementUpdated(el);
|
|
317
|
-
const firstItem = el.querySelector(
|
|
318
|
-
"sp-menu-item:nth-of-type(1)"
|
|
319
|
-
);
|
|
320
|
-
const thirdItem = el.querySelector(
|
|
321
|
-
"sp-menu-item:nth-of-type(3)"
|
|
322
|
-
);
|
|
323
|
-
el.focus();
|
|
324
|
-
expect(
|
|
325
|
-
document.activeElement === firstItem,
|
|
326
|
-
"first item is active element"
|
|
327
|
-
).to.be.true;
|
|
328
|
-
expect(firstItem.focused, "first item focused").to.be.true;
|
|
329
|
-
el.dispatchEvent(arrowDownEvent());
|
|
330
|
-
el.dispatchEvent(arrowDownEvent());
|
|
331
|
-
expect(thirdItem.focused, "third item focused").to.be.true;
|
|
332
|
-
thirdItem.dispatchEvent(tabEvent());
|
|
333
|
-
el.dispatchEvent(
|
|
334
|
-
new CustomEvent("focusout", {
|
|
335
|
-
composed: true,
|
|
336
|
-
bubbles: true
|
|
337
|
-
})
|
|
338
|
-
);
|
|
339
|
-
await nextFrame();
|
|
340
|
-
el.focus();
|
|
341
|
-
await sendKeys({ press: "ArrowDown" });
|
|
342
|
-
expect(firstItem.focused, "first item focused again").to.be.true;
|
|
343
|
-
});
|
|
344
|
-
it("handles focus across focused MenuItem removals", async () => {
|
|
345
|
-
const el = await fixture(html`
|
|
346
|
-
<sp-menu id="remove">
|
|
347
|
-
<sp-menu-item id="#deselect">Deselect</sp-menu-item>
|
|
348
|
-
<sp-menu-item selected>Select Inverse</sp-menu-item>
|
|
349
|
-
<sp-menu-item>Third Item</sp-menu-item>
|
|
350
|
-
</sp-menu>
|
|
351
|
-
`);
|
|
352
|
-
await waitUntil(
|
|
353
|
-
() => el.childItems.length == 3,
|
|
354
|
-
"expected menu to manage 3 items",
|
|
355
|
-
{ timeout: 100 }
|
|
356
|
-
);
|
|
357
|
-
expect(el.children.length).to.equal(el.childItems.length);
|
|
358
|
-
el.focus();
|
|
359
|
-
const children = [...el.children];
|
|
360
|
-
expect(children[1], "selected element is focused").to.equal(
|
|
361
|
-
document.activeElement
|
|
362
|
-
);
|
|
363
|
-
await sendKeys({ press: "ArrowUp" });
|
|
364
|
-
expect(children[0], "first element is focused").to.equal(
|
|
365
|
-
document.activeElement
|
|
366
|
-
);
|
|
367
|
-
if (isFirefox() || isWebKit()) {
|
|
368
|
-
children[0].remove();
|
|
369
|
-
await elementUpdated(el);
|
|
370
|
-
expect(children[1], "selected element is focused").to.equal(
|
|
371
|
-
document.activeElement
|
|
372
|
-
);
|
|
373
|
-
await sendKeys({ press: "ArrowUp" });
|
|
374
|
-
expect(children[2], "last element is focused").to.equal(
|
|
375
|
-
document.activeElement
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
it("handles single selection", async () => {
|
|
380
|
-
const el = await fixture(html`
|
|
381
|
-
<sp-menu selects="single">
|
|
382
|
-
<sp-menu-item selected>First</sp-menu-item>
|
|
383
|
-
<sp-menu-item>Second</sp-menu-item>
|
|
384
|
-
<sp-menu-item>Third</sp-menu-item>
|
|
385
|
-
</sp-menu>
|
|
386
|
-
`);
|
|
387
|
-
await elementUpdated(el);
|
|
388
|
-
const firstItem = el.querySelector(
|
|
389
|
-
"sp-menu-item:nth-of-type(1)"
|
|
390
|
-
);
|
|
391
|
-
const secondItem = el.querySelector(
|
|
392
|
-
"sp-menu-item:nth-of-type(2)"
|
|
393
|
-
);
|
|
394
|
-
expect(firstItem.getAttribute("role")).to.equal("menuitemradio");
|
|
395
|
-
expect(secondItem.getAttribute("role")).to.equal("menuitemradio");
|
|
396
|
-
expect(firstItem.selected).to.be.true;
|
|
397
|
-
expect(secondItem.selected).to.be.false;
|
|
398
|
-
expect(firstItem.getAttribute("aria-checked")).to.equal("true");
|
|
399
|
-
expect(secondItem.getAttribute("aria-checked")).to.equal("false");
|
|
400
|
-
expect(el.value).to.equal("First");
|
|
401
|
-
secondItem.click();
|
|
402
|
-
await elementUpdated(el);
|
|
403
|
-
await elementUpdated(firstItem);
|
|
404
|
-
await elementUpdated(secondItem);
|
|
405
|
-
expect(firstItem.selected).to.be.false;
|
|
406
|
-
expect(secondItem.selected).to.be.true;
|
|
407
|
-
expect(firstItem.getAttribute("aria-checked")).to.equal("false");
|
|
408
|
-
expect(secondItem.getAttribute("aria-checked")).to.equal("true");
|
|
409
|
-
expect(el.value).to.equal("Second");
|
|
410
|
-
});
|
|
411
|
-
it("does not make a selection on a right/middle mouse click", async () => {
|
|
412
|
-
const changeSpy = spy();
|
|
413
|
-
const el = await fixture(html`
|
|
414
|
-
<sp-menu
|
|
415
|
-
selects="single"
|
|
416
|
-
@change=${() => {
|
|
417
|
-
changeSpy();
|
|
418
|
-
}}
|
|
419
|
-
>
|
|
420
|
-
<sp-menu-item>First</sp-menu-item>
|
|
421
|
-
<sp-menu-item>Second</sp-menu-item>
|
|
422
|
-
<sp-menu-item>Third</sp-menu-item>
|
|
423
|
-
</sp-menu>
|
|
424
|
-
`);
|
|
425
|
-
await waitUntil(
|
|
426
|
-
() => el.childItems.length == 3,
|
|
427
|
-
"expected menu to manage 3 items"
|
|
428
|
-
);
|
|
429
|
-
await elementUpdated(el);
|
|
430
|
-
const secondItem = el.querySelector(
|
|
431
|
-
"sp-menu-item:nth-of-type(2)"
|
|
432
|
-
);
|
|
433
|
-
const rect = secondItem.getBoundingClientRect();
|
|
434
|
-
sendMouse({
|
|
435
|
-
steps: [
|
|
436
|
-
{
|
|
437
|
-
position: [
|
|
438
|
-
rect.left + rect.width / 2,
|
|
439
|
-
rect.top + rect.height / 2
|
|
440
|
-
],
|
|
441
|
-
type: "click",
|
|
442
|
-
options: {
|
|
443
|
-
button: "right"
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
]
|
|
447
|
-
});
|
|
448
|
-
await elementUpdated(el);
|
|
449
|
-
await elementUpdated(secondItem);
|
|
450
|
-
await aTimeout(150);
|
|
451
|
-
expect(changeSpy.callCount, "no change").to.equal(0);
|
|
452
|
-
sendMouse({
|
|
453
|
-
steps: [
|
|
454
|
-
{
|
|
455
|
-
position: [
|
|
456
|
-
rect.left + rect.width / 2,
|
|
457
|
-
rect.top + rect.height / 2
|
|
458
|
-
],
|
|
459
|
-
type: "click",
|
|
460
|
-
options: {
|
|
461
|
-
button: "middle"
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
]
|
|
465
|
-
});
|
|
466
|
-
await elementUpdated(el);
|
|
467
|
-
await elementUpdated(secondItem);
|
|
468
|
-
await aTimeout(150);
|
|
469
|
-
expect(changeSpy.callCount, "no change").to.equal(0);
|
|
470
|
-
});
|
|
471
|
-
it("handles multiple selection", async () => {
|
|
472
|
-
const changeSpy = spy();
|
|
473
|
-
const el = await fixture(html`
|
|
474
|
-
<sp-menu selects="multiple" @change=${() => changeSpy()}>
|
|
475
|
-
<sp-menu-item selected>First</sp-menu-item>
|
|
476
|
-
<sp-menu-item>Second</sp-menu-item>
|
|
477
|
-
<sp-menu-item>Third</sp-menu-item>
|
|
478
|
-
</sp-menu>
|
|
479
|
-
`);
|
|
480
|
-
await waitUntil(
|
|
481
|
-
() => el.childItems.length == 3,
|
|
482
|
-
"expected menu to manage 3 items"
|
|
483
|
-
);
|
|
484
|
-
await elementUpdated(el);
|
|
485
|
-
const firstItem = el.querySelector(
|
|
486
|
-
"sp-menu-item:nth-of-type(1)"
|
|
487
|
-
);
|
|
488
|
-
const secondItem = el.querySelector(
|
|
489
|
-
"sp-menu-item:nth-of-type(2)"
|
|
490
|
-
);
|
|
491
|
-
expect(firstItem.getAttribute("role")).to.equal("menuitemcheckbox");
|
|
492
|
-
expect(secondItem.getAttribute("role")).to.equal("menuitemcheckbox");
|
|
493
|
-
expect(firstItem.selected).to.be.true;
|
|
494
|
-
expect(secondItem.selected).to.be.false;
|
|
495
|
-
expect(firstItem.getAttribute("aria-checked")).to.equal("true");
|
|
496
|
-
expect(secondItem.getAttribute("aria-checked")).to.equal("false");
|
|
497
|
-
expect(el.value).to.equal("First");
|
|
498
|
-
expect(el.selectedItems.length).to.equal(1);
|
|
499
|
-
secondItem.click();
|
|
500
|
-
await elementUpdated(el);
|
|
501
|
-
await elementUpdated(firstItem);
|
|
502
|
-
await elementUpdated(secondItem);
|
|
503
|
-
expect(changeSpy.callCount, "one change").to.equal(1);
|
|
504
|
-
expect(firstItem.selected).to.be.true;
|
|
505
|
-
expect(secondItem.selected).to.be.true;
|
|
506
|
-
expect(firstItem.getAttribute("aria-checked")).to.equal("true");
|
|
507
|
-
expect(secondItem.getAttribute("aria-checked")).to.equal("true");
|
|
508
|
-
expect(el.value).to.equal("First,Second");
|
|
509
|
-
expect(el.selectedItems.length).to.equal(2);
|
|
510
|
-
firstItem.click();
|
|
511
|
-
await elementUpdated(el);
|
|
512
|
-
await elementUpdated(firstItem);
|
|
513
|
-
await elementUpdated(secondItem);
|
|
514
|
-
expect(changeSpy.callCount, "two changes").to.equal(2);
|
|
515
|
-
expect(firstItem.selected).to.be.false;
|
|
516
|
-
expect(secondItem.selected).to.be.true;
|
|
517
|
-
expect(firstItem.getAttribute("aria-checked")).to.equal("false");
|
|
518
|
-
expect(secondItem.getAttribute("aria-checked")).to.equal("true");
|
|
519
|
-
expect(el.value).to.equal("Second");
|
|
520
|
-
expect(el.selectedItems.length).to.equal(1);
|
|
521
|
-
});
|
|
522
|
-
it("can be controlled to manage a single togglable selection", async () => {
|
|
523
|
-
const toggleSingleSelected = (event) => {
|
|
524
|
-
event.preventDefault();
|
|
525
|
-
const selected = [];
|
|
526
|
-
if (event.target.selected.length) {
|
|
527
|
-
selected.push(event.target.selected.at(-1));
|
|
528
|
-
}
|
|
529
|
-
event.target.updateComplete.then(() => {
|
|
530
|
-
event.target.selected = selected;
|
|
531
|
-
});
|
|
532
|
-
};
|
|
533
|
-
const el = await fixture(html`
|
|
534
|
-
<sp-menu selects="multiple" @change=${toggleSingleSelected}>
|
|
535
|
-
<sp-menu-item value="1">First</sp-menu-item>
|
|
536
|
-
<sp-menu-item value="2">Second</sp-menu-item>
|
|
537
|
-
<sp-menu-item value="3">Third</sp-menu-item>
|
|
538
|
-
</sp-menu>
|
|
539
|
-
`);
|
|
540
|
-
await nextFrame();
|
|
541
|
-
await nextFrame();
|
|
542
|
-
expect(el.selected).to.deep.equal([]);
|
|
543
|
-
const items = [...el.children];
|
|
544
|
-
await Promise.all(items.map((child) => child.updateComplete));
|
|
545
|
-
items[0].click();
|
|
546
|
-
await nextFrame();
|
|
547
|
-
await nextFrame();
|
|
548
|
-
expect(el.selected).to.deep.equal(["1"]);
|
|
549
|
-
items[0].click();
|
|
550
|
-
await nextFrame();
|
|
551
|
-
await nextFrame();
|
|
552
|
-
expect(el.selected).to.deep.equal([]);
|
|
553
|
-
items[1].click();
|
|
554
|
-
await nextFrame();
|
|
555
|
-
await nextFrame();
|
|
556
|
-
expect(el.selected).to.deep.equal(["2"]);
|
|
557
|
-
items[2].click();
|
|
558
|
-
await nextFrame();
|
|
559
|
-
await nextFrame();
|
|
560
|
-
expect(el.selected).to.deep.equal(["3"]);
|
|
561
|
-
});
|
|
562
|
-
});
|
|
563
|
-
//# sourceMappingURL=menu.test.js.map
|
package/test/menu.test.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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*/\n\nimport {\n aTimeout,\n elementUpdated,\n expect,\n html,\n nextFrame,\n waitUntil,\n} from '@open-wc/testing';\nimport { Menu, MenuItem } from '@spectrum-web-components/menu';\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 '@spectrum-web-components/menu/sp-menu.js';\nimport { isFirefox, isWebKit } from '@spectrum-web-components/shared';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\nimport { sendMouse } from '../../../test/plugins/browser.js';\nimport {\n arrowDownEvent,\n arrowUpEvent,\n fixture,\n tabEvent,\n testForLitDevWarnings,\n tEvent,\n} from '../../../test/testing-helpers.js';\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 elementUpdated(el);\n\n expect(el.childItems.length).to.equal(6);\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 const selectedItem = el.querySelector(\n 'sp-menu-item[selected]'\n ) as MenuItem;\n\n expect(selectedItem.selected).to.be.true;\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() || isFirefox()) {\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 selectedItem = el.querySelector(\n 'sp-menu-item[selected]'\n ) as MenuItem;\n\n selectedItem.focus();\n\n await elementUpdated(el);\n await sendKeys({\n press: 'ArrowDown',\n });\n await elementUpdated(el);\n await sendKeys({\n press: 'Enter',\n });\n\n const clipboardText = await navigator.clipboard.readText();\n await elementUpdated(el);\n\n expect(clipboardText).to.equal('Other');\n });\n\n it('accepts Numpad keys', async function () {\n if (isWebKit() || isFirefox()) {\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 const selectedItem = el.querySelector(\n 'sp-menu-item[selected]'\n ) as MenuItem;\n selectedItem.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\n expect(document.activeElement === firstItem, 'active element').to.be\n .true;\n expect(firstItem.focused, 'first item focused').to.be.true;\n expect(firstItem.textContent, 'focused item text').to.equal('Deselect');\n\n el.dispatchEvent(arrowUpEvent());\n el.dispatchEvent(arrowUpEvent());\n el.dispatchEvent(tEvent());\n\n expect(\n document.activeElement === thirdToLastItem,\n 'active element after arrow up'\n ).to.be.true;\n expect(thirdToLastItem.focused, 'third to last item focused').to.be\n .true;\n expect(thirdToLastItem.textContent, 'focused item text').to.equal(\n 'Select and Mask...'\n );\n\n el.dispatchEvent(arrowDownEvent());\n\n expect(\n document.activeElement === secondToLastItem,\n 'active element after arrow down'\n ).to.be.true;\n expect(secondToLastItem.focused, 'second to last item focused').to.be\n .true;\n expect(secondToLastItem.textContent, 'focused item text').to.equal(\n 'Save Selection'\n );\n });\n\n it('handle focus and late descendant 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 id=\"deselect\">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 initialLoadedItem = el.querySelector('#deselect') as MenuItem;\n\n el.focus();\n\n await elementUpdated(el);\n\n expect(document.activeElement === initialLoadedItem, 'active element')\n .to.be.true;\n expect(initialLoadedItem.focused, 'visually focused').to.be.true;\n expect(initialLoadedItem.textContent, 'focused item text').to.equal(\n 'Deselect'\n );\n\n el.blur();\n\n const group = el.querySelector('sp-menu-group') as HTMLElement;\n\n const prependedItem = document.createElement('sp-menu-item');\n prependedItem.textContent = 'Prepended Item';\n\n const appendedItem = document.createElement('sp-menu-item');\n appendedItem.textContent = 'Appended Item';\n\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\n await elementUpdated(el);\n\n expect(el.childItems.length).to.equal(3);\n el.focus();\n\n expect(\n document.activeElement === prependedItem,\n 'prepended item is active element?'\n ).to.be.true;\n expect(prependedItem.focused, 'prepended item visibly focused').to.be\n .true;\n\n await sendKeys({ press: 'ArrowUp' });\n\n expect(\n document.activeElement === appendedItem,\n 'appended item is active element'\n ).to.be.true;\n expect(appendedItem.focused, 'appended visibly focused').to.be.true;\n });\n\n it('cleans up when tabbing away', 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>Third Item</sp-menu-item>\n </sp-menu>\n `);\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-menu-item:nth-of-type(1)'\n ) as MenuItem;\n const thirdItem = el.querySelector(\n 'sp-menu-item:nth-of-type(3)'\n ) as MenuItem;\n\n el.focus();\n\n expect(\n document.activeElement === firstItem,\n 'first item is active element'\n ).to.be.true;\n expect(firstItem.focused, 'first item focused').to.be.true;\n el.dispatchEvent(arrowDownEvent());\n el.dispatchEvent(arrowDownEvent());\n expect(thirdItem.focused, 'third item focused').to.be.true;\n // imitate tabbing away\n thirdItem.dispatchEvent(tabEvent());\n el.dispatchEvent(\n new CustomEvent('focusout', {\n composed: true,\n bubbles: true,\n })\n );\n await nextFrame();\n\n el.focus();\n // focus management should start again from the first item.\n await sendKeys({ press: 'ArrowDown' });\n expect(firstItem.focused, 'first item focused again').to.be.true;\n });\n\n it('handles focus across focused MenuItem removals', async () => {\n const el = await fixture<Menu>(html`\n <sp-menu id=\"remove\">\n <sp-menu-item id=\"#deselect\">Deselect</sp-menu-item>\n <sp-menu-item selected>Select Inverse</sp-menu-item>\n <sp-menu-item>Third Item</sp-menu-item>\n </sp-menu>\n `);\n await waitUntil(\n () => el.childItems.length == 3,\n 'expected menu to manage 3 items',\n { timeout: 100 }\n );\n\n expect(el.children.length).to.equal(el.childItems.length);\n\n el.focus();\n\n const children = [...el.children];\n\n expect(children[1], 'selected element is focused').to.equal(\n document.activeElement\n );\n\n await sendKeys({ press: 'ArrowUp' });\n\n expect(children[0], 'first element is focused').to.equal(\n document.activeElement\n );\n //@todo this test fails on Chromium\n if (isFirefox() || isWebKit()) {\n children[0].remove();\n await elementUpdated(el);\n expect(children[1], 'selected element is focused').to.equal(\n document.activeElement\n );\n\n await sendKeys({ press: 'ArrowUp' });\n expect(children[2], 'last element is focused').to.equal(\n document.activeElement\n );\n }\n });\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 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('does not make a selection on a right/middle mouse click', async () => {\n const changeSpy = spy();\n const el = await fixture<Menu>(html`\n <sp-menu\n selects=\"single\"\n @change=${() => {\n changeSpy();\n }}\n >\n <sp-menu-item>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 secondItem = el.querySelector(\n 'sp-menu-item:nth-of-type(2)'\n ) as MenuItem;\n\n // send right mouse click to the secondItem\n const rect = secondItem.getBoundingClientRect();\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n options: {\n button: 'right',\n },\n },\n ],\n });\n await elementUpdated(el);\n await elementUpdated(secondItem);\n await aTimeout(150);\n expect(changeSpy.callCount, 'no change').to.equal(0);\n\n // send middle mouse click to the secondItem\n sendMouse({\n steps: [\n {\n position: [\n rect.left + rect.width / 2,\n rect.top + rect.height / 2,\n ],\n type: 'click',\n options: {\n button: 'middle',\n },\n },\n ],\n });\n await elementUpdated(el);\n await elementUpdated(secondItem);\n await aTimeout(150);\n expect(changeSpy.callCount, 'no change').to.equal(0);\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": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,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,QAAQ,EAAE,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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/test/submenu.test-vrt.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["submenu.test-vrt.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*/\n\nimport * as stories from '../stories/submenu.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('SubmenuStories', stories as unknown as TestsType);\n"],
|
|
5
|
-
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,kBAAkB,OAA+B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|