@spectrum-web-components/accordion 0.42.4 → 0.42.5
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 +7 -7
- package/test/a11y-tree.test.js +24 -0
- package/test/a11y-tree.test.js.map +7 -0
- package/test/controlled.test.js +30 -0
- package/test/controlled.test.js.map +7 -0
- package/test/declarative.test.js +62 -0
- package/test/declarative.test.js.map +7 -0
- package/test/dev-mode.test.js +8 -0
- package/test/dev-mode.test.js.map +7 -0
- package/test/imperative.test.js +112 -0
- package/test/imperative.test.js.map +7 -0
- package/test/keyboard.test.js +199 -0
- package/test/keyboard.test.js.map +7 -0
- package/test/{accordion-memory.test.js → memory.test.js} +4 -2
- package/test/{accordion-memory.test.js.map → memory.test.js.map} +3 -3
- package/test/accordion-item.test.js +0 -144
- package/test/accordion-item.test.js.map +0 -7
- package/test/accordion.test.js +0 -271
- package/test/accordion.test.js.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/accordion",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"lit-html"
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@spectrum-web-components/base": "^0.42.
|
|
70
|
-
"@spectrum-web-components/icon": "^0.42.
|
|
71
|
-
"@spectrum-web-components/icons-ui": "^0.42.
|
|
72
|
-
"@spectrum-web-components/reactive-controllers": "^0.42.
|
|
73
|
-
"@spectrum-web-components/shared": "^0.42.
|
|
69
|
+
"@spectrum-web-components/base": "^0.42.5",
|
|
70
|
+
"@spectrum-web-components/icon": "^0.42.5",
|
|
71
|
+
"@spectrum-web-components/icons-ui": "^0.42.5",
|
|
72
|
+
"@spectrum-web-components/reactive-controllers": "^0.42.5",
|
|
73
|
+
"@spectrum-web-components/shared": "^0.42.5"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@spectrum-css/accordion": "^5.1.0"
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"./sp-*.js",
|
|
82
82
|
"./**/*.dev.js"
|
|
83
83
|
],
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f29fd737947945de8cd6f5bc03fb389d386c9c3a"
|
|
85
85
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { elementUpdated, expect, fixture } from "@open-wc/testing";
|
|
4
|
+
import "@spectrum-web-components/accordion/sp-accordion-item.js";
|
|
5
|
+
import { Default } from "../stories/accordion.stories.js";
|
|
6
|
+
describe("Accordion - a11y tree", () => {
|
|
7
|
+
it("renders with items accessibly", async () => {
|
|
8
|
+
const el = await fixture(Default());
|
|
9
|
+
await elementUpdated(el);
|
|
10
|
+
await expect(el).to.be.accessible();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
describe("Accordion Item - a11y tree", () => {
|
|
14
|
+
it("can exist with no parent accessibly", async () => {
|
|
15
|
+
const el = await fixture(html`
|
|
16
|
+
<sp-accordion-item label="item">
|
|
17
|
+
<div>Item 1</div>
|
|
18
|
+
</sp-accordion-item>
|
|
19
|
+
`);
|
|
20
|
+
await elementUpdated(el);
|
|
21
|
+
await expect(el).to.be.accessible();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=a11y-tree.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["a11y-tree.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 { html } from '@spectrum-web-components/base';\nimport { elementUpdated, expect, fixture } from '@open-wc/testing';\n\nimport { Accordion, AccordionItem } from '@spectrum-web-components/accordion';\nimport '@spectrum-web-components/accordion/sp-accordion-item.js';\n\nimport { Default } from '../stories/accordion.stories.js';\n\ndescribe('Accordion - a11y tree', () => {\n it('renders with items accessibly', async () => {\n const el = await fixture<Accordion>(Default());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n});\n\ndescribe('Accordion Item - a11y tree', () => {\n it('can exist with no parent accessibly', async () => {\n const el = await fixture<AccordionItem>(html`\n <sp-accordion-item label=\"item\">\n <div>Item 1</div>\n </sp-accordion-item>\n `);\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAAY;AACrB,SAAS,gBAAgB,QAAQ,eAAe;AAGhD,OAAO;AAEP,SAAS,eAAe;AAExB,SAAS,yBAAyB,MAAM;AACpC,KAAG,iCAAiC,YAAY;AAC5C,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAE7C,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACL,CAAC;AAED,SAAS,8BAA8B,MAAM;AACzC,KAAG,uCAAuC,YAAY;AAClD,UAAM,KAAK,MAAM,QAAuB;AAAA;AAAA;AAAA;AAAA,SAIvC;AAED,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { elementUpdated, expect, fixture } from "@open-wc/testing";
|
|
3
|
+
import { Default } from "../stories/accordion.stories.js";
|
|
4
|
+
describe("Accordion - controlled", () => {
|
|
5
|
+
it("can have `toggle` events canceled", async () => {
|
|
6
|
+
const el = await fixture(Default());
|
|
7
|
+
await elementUpdated(el);
|
|
8
|
+
const firstItem = el.querySelector(
|
|
9
|
+
"sp-accordion-item:nth-of-type(1)"
|
|
10
|
+
);
|
|
11
|
+
const secondItem = el.querySelector(
|
|
12
|
+
"sp-accordion-item:nth-of-type(2)"
|
|
13
|
+
);
|
|
14
|
+
const firstButton = firstItem.focusElement;
|
|
15
|
+
const secondButton = secondItem.focusElement;
|
|
16
|
+
firstButton.click();
|
|
17
|
+
await elementUpdated(el);
|
|
18
|
+
expect(firstItem.open).to.be.true;
|
|
19
|
+
expect(secondItem.open).to.be.false;
|
|
20
|
+
el.addEventListener(
|
|
21
|
+
"sp-accordion-item-toggle",
|
|
22
|
+
(event) => event.preventDefault()
|
|
23
|
+
);
|
|
24
|
+
secondButton.click();
|
|
25
|
+
await elementUpdated(el);
|
|
26
|
+
expect(firstItem.open).to.be.true;
|
|
27
|
+
expect(secondItem.open).to.be.false;
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=controlled.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["controlled.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 { elementUpdated, expect, fixture } from '@open-wc/testing';\n\nimport { Accordion, AccordionItem } from '@spectrum-web-components/accordion';\n\nimport { Default } from '../stories/accordion.stories.js';\n\ndescribe('Accordion - controlled', () => {\n it('can have `toggle` events canceled', async () => {\n const el = await fixture<Accordion>(Default());\n await elementUpdated(el);\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n el.addEventListener('sp-accordion-item-toggle', (event: Event) =>\n event.preventDefault()\n );\n\n secondButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,gBAAgB,QAAQ,eAAe;AAIhD,SAAS,eAAe;AAExB,SAAS,0BAA0B,MAAM;AACrC,KAAG,qCAAqC,YAAY;AAChD,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAC7C,UAAM,eAAe,EAAE;AACvB,UAAM,YAAY,GAAG;AAAA,MACjB;AAAA,IACJ;AACA,UAAM,aAAa,GAAG;AAAA,MAClB;AAAA,IACJ;AAEA,UAAM,cAAc,UAAU;AAC9B,UAAM,eAAe,WAAW;AAEhC,gBAAY,MAAM;AAClB,UAAM,eAAe,EAAE;AACvB,WAAO,UAAU,IAAI,EAAE,GAAG,GAAG;AAC7B,WAAO,WAAW,IAAI,EAAE,GAAG,GAAG;AAE9B,OAAG;AAAA,MAAiB;AAAA,MAA4B,CAAC,UAC7C,MAAM,eAAe;AAAA,IACzB;AAEA,iBAAa,MAAM;AACnB,UAAM,eAAe,EAAE;AACvB,WAAO,UAAU,IAAI,EAAE,GAAG,GAAG;AAC7B,WAAO,WAAW,IAAI,EAAE,GAAG,GAAG;AAAA,EAClC,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { elementUpdated, expect, fixture } from "@open-wc/testing";
|
|
4
|
+
import { spy } from "sinon";
|
|
5
|
+
import "@spectrum-web-components/accordion/sp-accordion.js";
|
|
6
|
+
import "@spectrum-web-components/accordion/sp-accordion-item.js";
|
|
7
|
+
describe("Accordion - declarative", () => {
|
|
8
|
+
it("does not accept focus when empty", async () => {
|
|
9
|
+
const el = await fixture(html`
|
|
10
|
+
<sp-accordion></sp-accordion>
|
|
11
|
+
`);
|
|
12
|
+
await elementUpdated(el);
|
|
13
|
+
expect(document.activeElement === el).to.be.false;
|
|
14
|
+
el.focus();
|
|
15
|
+
await elementUpdated(el);
|
|
16
|
+
expect(document.activeElement === el).to.be.false;
|
|
17
|
+
});
|
|
18
|
+
it("does not accept focus when all children [disabled]", async () => {
|
|
19
|
+
const el = await fixture(html`
|
|
20
|
+
<sp-accordion>
|
|
21
|
+
<sp-accordion-item disabled label="Heading 1">
|
|
22
|
+
<div>Item 1</div>
|
|
23
|
+
</sp-accordion-item>
|
|
24
|
+
<sp-accordion-item disabled label="Heading 2">
|
|
25
|
+
<div>Item 2</div>
|
|
26
|
+
</sp-accordion-item>
|
|
27
|
+
</sp-accordion>
|
|
28
|
+
`);
|
|
29
|
+
await elementUpdated(el);
|
|
30
|
+
expect(document.activeElement === el).to.be.false;
|
|
31
|
+
el.focus();
|
|
32
|
+
await elementUpdated(el);
|
|
33
|
+
expect(document.activeElement === el).to.be.false;
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("Accordion Item - declarative", () => {
|
|
37
|
+
it("can be `[disabled]`", async () => {
|
|
38
|
+
const toggleSpy = spy();
|
|
39
|
+
const handleToggle = () => toggleSpy();
|
|
40
|
+
const el = await fixture(html`
|
|
41
|
+
<sp-accordion-item
|
|
42
|
+
disabled
|
|
43
|
+
@sp-accordion-item-toggle=${handleToggle}
|
|
44
|
+
>
|
|
45
|
+
<div>Item 1</div>
|
|
46
|
+
</sp-accordion-item>
|
|
47
|
+
`);
|
|
48
|
+
const root = el.shadowRoot;
|
|
49
|
+
const button = root.querySelector("#header");
|
|
50
|
+
await elementUpdated(el);
|
|
51
|
+
expect(toggleSpy.callCount).to.equal(0);
|
|
52
|
+
button.click();
|
|
53
|
+
await elementUpdated(el);
|
|
54
|
+
expect(toggleSpy.callCount).to.equal(0);
|
|
55
|
+
el.disabled = false;
|
|
56
|
+
await elementUpdated(el);
|
|
57
|
+
button.click();
|
|
58
|
+
await elementUpdated(el);
|
|
59
|
+
expect(toggleSpy.callCount).to.equal(1);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=declarative.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["declarative.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 { html } from '@spectrum-web-components/base';\nimport { elementUpdated, expect, fixture } from '@open-wc/testing';\nimport { spy } from 'sinon';\n\nimport { Accordion, AccordionItem } from '@spectrum-web-components/accordion';\nimport '@spectrum-web-components/accordion/sp-accordion.js';\nimport '@spectrum-web-components/accordion/sp-accordion-item.js';\n\ndescribe('Accordion - declarative', () => {\n it('does not accept focus when empty', async () => {\n const el = await fixture<Accordion>(html`\n <sp-accordion></sp-accordion>\n `);\n\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n });\n it('does not accept focus when all children [disabled]', async () => {\n const el = await fixture<Accordion>(html`\n <sp-accordion>\n <sp-accordion-item disabled label=\"Heading 1\">\n <div>Item 1</div>\n </sp-accordion-item>\n <sp-accordion-item disabled label=\"Heading 2\">\n <div>Item 2</div>\n </sp-accordion-item>\n </sp-accordion>\n `);\n\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n });\n});\n\ndescribe('Accordion Item - declarative', () => {\n it('can be `[disabled]`', async () => {\n const toggleSpy = spy();\n const handleToggle = (): void => toggleSpy();\n const el = await fixture<AccordionItem>(html`\n <sp-accordion-item\n disabled\n @sp-accordion-item-toggle=${handleToggle}\n >\n <div>Item 1</div>\n </sp-accordion-item>\n `);\n\n const root = el.shadowRoot as ShadowRoot;\n const button = root.querySelector('#header') as HTMLElement;\n\n await elementUpdated(el);\n\n expect(toggleSpy.callCount).to.equal(0);\n\n button.click();\n\n await elementUpdated(el);\n\n expect(toggleSpy.callCount).to.equal(0);\n\n el.disabled = false;\n await elementUpdated(el);\n\n button.click();\n\n await elementUpdated(el);\n\n expect(toggleSpy.callCount).to.equal(1);\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAAY;AACrB,SAAS,gBAAgB,QAAQ,eAAe;AAChD,SAAS,WAAW;AAGpB,OAAO;AACP,OAAO;AAEP,SAAS,2BAA2B,MAAM;AACtC,KAAG,oCAAoC,YAAY;AAC/C,UAAM,KAAK,MAAM,QAAmB;AAAA;AAAA,SAEnC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,kBAAkB,EAAE,EAAE,GAAG,GAAG;AAE5C,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,kBAAkB,EAAE,EAAE,GAAG,GAAG;AAAA,EAChD,CAAC;AACD,KAAG,sDAAsD,YAAY;AACjE,UAAM,KAAK,MAAM,QAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SASnC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,kBAAkB,EAAE,EAAE,GAAG,GAAG;AAE5C,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,kBAAkB,EAAE,EAAE,GAAG,GAAG;AAAA,EAChD,CAAC;AACL,CAAC;AAED,SAAS,gCAAgC,MAAM;AAC3C,KAAG,uBAAuB,YAAY;AAClC,UAAM,YAAY,IAAI;AACtB,UAAM,eAAe,MAAY,UAAU;AAC3C,UAAM,KAAK,MAAM,QAAuB;AAAA;AAAA;AAAA,4CAGJ,YAAY;AAAA;AAAA;AAAA;AAAA,SAI/C;AAED,UAAM,OAAO,GAAG;AAChB,UAAM,SAAS,KAAK,cAAc,SAAS;AAE3C,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,SAAS,EAAE,GAAG,MAAM,CAAC;AAEtC,WAAO,MAAM;AAEb,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,SAAS,EAAE,GAAG,MAAM,CAAC;AAEtC,OAAG,WAAW;AACd,UAAM,eAAe,EAAE;AAEvB,WAAO,MAAM;AAEb,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,SAAS,EAAE,GAAG,MAAM,CAAC;AAAA,EAC1C,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { fixture } from "@open-wc/testing";
|
|
3
|
+
import { Default } from "../stories/accordion.stories.js";
|
|
4
|
+
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
5
|
+
describe("Accordion - dev mode", () => {
|
|
6
|
+
testForLitDevWarnings(async () => await fixture(Default()));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=dev-mode.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["dev-mode.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 { fixture } from '@open-wc/testing';\n\nimport { Accordion } from '@spectrum-web-components/accordion';\n\nimport { Default } from '../stories/accordion.stories.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Accordion - dev mode', () => {\n testForLitDevWarnings(async () => await fixture<Accordion>(Default()));\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,eAAe;AAIxB,SAAS,eAAe;AACxB,SAAS,6BAA6B;AAEtC,SAAS,wBAAwB,MAAM;AACnC,wBAAsB,YAAY,MAAM,QAAmB,QAAQ,CAAC,CAAC;AACzE,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { elementUpdated, expect, fixture } from "@open-wc/testing";
|
|
3
|
+
import { Default } from "../stories/accordion.stories.js";
|
|
4
|
+
import { AccordionMarkup } from "../stories/index.js";
|
|
5
|
+
describe("Accordion - imperative interactions", () => {
|
|
6
|
+
it("manages item size", async () => {
|
|
7
|
+
const el = await fixture(
|
|
8
|
+
AccordionMarkup({
|
|
9
|
+
size: "l"
|
|
10
|
+
})
|
|
11
|
+
);
|
|
12
|
+
const item = el.querySelector("sp-accordion-item");
|
|
13
|
+
expect(el.size).to.equal("l");
|
|
14
|
+
expect(item.size).to.equal("l");
|
|
15
|
+
el.size = "s";
|
|
16
|
+
await elementUpdated(el);
|
|
17
|
+
await elementUpdated(item);
|
|
18
|
+
expect(el.size).to.equal("s");
|
|
19
|
+
expect(item.size).to.equal("s");
|
|
20
|
+
});
|
|
21
|
+
it("only allows one open item by default", async () => {
|
|
22
|
+
const el = await fixture(Default());
|
|
23
|
+
await elementUpdated(el);
|
|
24
|
+
const firstItem = el.querySelector(
|
|
25
|
+
"sp-accordion-item:nth-of-type(1)"
|
|
26
|
+
);
|
|
27
|
+
const secondItem = el.querySelector(
|
|
28
|
+
"sp-accordion-item:nth-of-type(2)"
|
|
29
|
+
);
|
|
30
|
+
const firstButton = firstItem.focusElement;
|
|
31
|
+
const secondButton = secondItem.focusElement;
|
|
32
|
+
firstButton.click();
|
|
33
|
+
await elementUpdated(el);
|
|
34
|
+
let openItems = el.querySelectorAll("sp-accordion-item[open]");
|
|
35
|
+
expect(openItems.length).to.equal(1);
|
|
36
|
+
secondButton.click();
|
|
37
|
+
await elementUpdated(el);
|
|
38
|
+
openItems = el.querySelectorAll("sp-accordion-item[open]");
|
|
39
|
+
expect(openItems.length).to.equal(1);
|
|
40
|
+
});
|
|
41
|
+
it("allows more than one open item when `[allow-multiple]`", async () => {
|
|
42
|
+
const el = await fixture(Default());
|
|
43
|
+
el.allowMultiple = true;
|
|
44
|
+
await elementUpdated(el);
|
|
45
|
+
const firstItem = el.querySelector(
|
|
46
|
+
"sp-accordion-item:nth-of-type(1)"
|
|
47
|
+
);
|
|
48
|
+
const secondItem = el.querySelector(
|
|
49
|
+
"sp-accordion-item:nth-of-type(2)"
|
|
50
|
+
);
|
|
51
|
+
const firstButton = firstItem.focusElement;
|
|
52
|
+
const secondButton = secondItem.focusElement;
|
|
53
|
+
firstButton.click();
|
|
54
|
+
await elementUpdated(el);
|
|
55
|
+
expect(firstItem.open).to.be.true;
|
|
56
|
+
expect(secondItem.open).to.be.false;
|
|
57
|
+
secondButton.click();
|
|
58
|
+
await elementUpdated(el);
|
|
59
|
+
expect(firstItem.open).to.be.true;
|
|
60
|
+
expect(secondItem.open).to.be.true;
|
|
61
|
+
});
|
|
62
|
+
it("ensures that the correct item is open and that items can be closed", async () => {
|
|
63
|
+
const el = await fixture(Default());
|
|
64
|
+
await elementUpdated(el);
|
|
65
|
+
const firstItem = el.querySelector(
|
|
66
|
+
"sp-accordion-item:nth-of-type(1)"
|
|
67
|
+
);
|
|
68
|
+
const secondItem = el.querySelector(
|
|
69
|
+
"sp-accordion-item:nth-of-type(2)"
|
|
70
|
+
);
|
|
71
|
+
const firstButton = firstItem.focusElement;
|
|
72
|
+
const secondButton = secondItem.focusElement;
|
|
73
|
+
firstButton.click();
|
|
74
|
+
await elementUpdated(el);
|
|
75
|
+
expect(firstItem.open).to.be.true;
|
|
76
|
+
expect(secondItem.open).to.be.false;
|
|
77
|
+
secondButton.click();
|
|
78
|
+
await elementUpdated(el);
|
|
79
|
+
expect(firstItem.open).to.be.false;
|
|
80
|
+
expect(secondItem.open).to.be.true;
|
|
81
|
+
secondButton.click();
|
|
82
|
+
await elementUpdated(el);
|
|
83
|
+
expect(firstItem.open).to.be.false;
|
|
84
|
+
expect(secondItem.open).to.be.false;
|
|
85
|
+
});
|
|
86
|
+
it("ensures that the correct item is open and that items can be closed when [allow-multiple]", async () => {
|
|
87
|
+
const el = await fixture(Default());
|
|
88
|
+
el.allowMultiple = true;
|
|
89
|
+
await elementUpdated(el);
|
|
90
|
+
const firstItem = el.querySelector(
|
|
91
|
+
"sp-accordion-item:nth-of-type(1)"
|
|
92
|
+
);
|
|
93
|
+
const secondItem = el.querySelector(
|
|
94
|
+
"sp-accordion-item:nth-of-type(2)"
|
|
95
|
+
);
|
|
96
|
+
const firstButton = firstItem.focusElement;
|
|
97
|
+
const secondButton = secondItem.focusElement;
|
|
98
|
+
firstButton.click();
|
|
99
|
+
await elementUpdated(el);
|
|
100
|
+
expect(firstItem.open).to.be.true;
|
|
101
|
+
expect(secondItem.open).to.be.false;
|
|
102
|
+
secondButton.click();
|
|
103
|
+
await elementUpdated(el);
|
|
104
|
+
expect(firstItem.open).to.be.true;
|
|
105
|
+
expect(secondItem.open).to.be.true;
|
|
106
|
+
secondButton.click();
|
|
107
|
+
await elementUpdated(el);
|
|
108
|
+
expect(firstItem.open).to.be.true;
|
|
109
|
+
expect(secondItem.open).to.be.false;
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=imperative.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["imperative.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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 { elementUpdated, expect, fixture } from '@open-wc/testing';\n\nimport { Accordion, AccordionItem } from '@spectrum-web-components/accordion';\n\nimport { Default } from '../stories/accordion.stories.js';\nimport { AccordionMarkup } from '../stories/index.js';\n\ndescribe('Accordion - imperative interactions', () => {\n it('manages item size', async () => {\n const el = await fixture<Accordion>(\n AccordionMarkup({\n size: 'l',\n })\n );\n const item = el.querySelector('sp-accordion-item') as AccordionItem;\n expect(el.size).to.equal('l');\n expect(item.size).to.equal('l');\n\n el.size = 's';\n await elementUpdated(el);\n await elementUpdated(item);\n expect(el.size).to.equal('s');\n expect(item.size).to.equal('s');\n });\n it('only allows one open item by default', async () => {\n const el = await fixture<Accordion>(Default());\n await elementUpdated(el);\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n let openItems = el.querySelectorAll('sp-accordion-item[open]');\n expect(openItems.length).to.equal(1);\n\n secondButton.click();\n await elementUpdated(el);\n openItems = el.querySelectorAll('sp-accordion-item[open]');\n expect(openItems.length).to.equal(1);\n });\n it('allows more than one open item when `[allow-multiple]`', async () => {\n const el = await fixture<Accordion>(Default());\n el.allowMultiple = true;\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n secondButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.true;\n });\n it('ensures that the correct item is open and that items can be closed', async () => {\n const el = await fixture<Accordion>(Default());\n\n await elementUpdated(el);\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n secondButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.false;\n expect(secondItem.open).to.be.true;\n\n secondButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.false;\n expect(secondItem.open).to.be.false;\n });\n it('ensures that the correct item is open and that items can be closed when [allow-multiple]', async () => {\n const el = await fixture<Accordion>(Default());\n el.allowMultiple = true;\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n secondButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.true;\n\n secondButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,gBAAgB,QAAQ,eAAe;AAIhD,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAEhC,SAAS,uCAAuC,MAAM;AAClD,KAAG,qBAAqB,YAAY;AAChC,UAAM,KAAK,MAAM;AAAA,MACb,gBAAgB;AAAA,QACZ,MAAM;AAAA,MACV,CAAC;AAAA,IACL;AACA,UAAM,OAAO,GAAG,cAAc,mBAAmB;AACjD,WAAO,GAAG,IAAI,EAAE,GAAG,MAAM,GAAG;AAC5B,WAAO,KAAK,IAAI,EAAE,GAAG,MAAM,GAAG;AAE9B,OAAG,OAAO;AACV,UAAM,eAAe,EAAE;AACvB,UAAM,eAAe,IAAI;AACzB,WAAO,GAAG,IAAI,EAAE,GAAG,MAAM,GAAG;AAC5B,WAAO,KAAK,IAAI,EAAE,GAAG,MAAM,GAAG;AAAA,EAClC,CAAC;AACD,KAAG,wCAAwC,YAAY;AACnD,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAC7C,UAAM,eAAe,EAAE;AACvB,UAAM,YAAY,GAAG;AAAA,MACjB;AAAA,IACJ;AACA,UAAM,aAAa,GAAG;AAAA,MAClB;AAAA,IACJ;AAEA,UAAM,cAAc,UAAU;AAC9B,UAAM,eAAe,WAAW;AAEhC,gBAAY,MAAM;AAClB,UAAM,eAAe,EAAE;AACvB,QAAI,YAAY,GAAG,iB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,EAAE,GAAG,GAAG;AAE9B,iBAAa,MAAM;AACnB,UAAM,eAAe,EAAE;AACvB,WAAO,UAAU,IAAI,EAAE,GAAG,GAAG;AAC7B,WAAO,WAAW,IAAI,EAAE,GAAG,GAAG;AAAA,EAClC,CAAC;AACD,KAAG,4FAA4F,YAAY;AACvG,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAC7C,OAAG,gBAAgB;AACnB,UAAM,eAAe,EAAE;AAEvB,UAAM,YAAY,GAAG;AAAA,MACjB;AAAA,IACJ;AACA,UAAM,aAAa,GAAG;AAAA,MAClB;AAAA,IACJ;AAEA,UAAM,cAAc,UAAU;AAC9B,UAAM,eAAe,WAAW;AAEhC,gBAAY,MAAM;AAClB,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,IAAI,EAAE,GAAG,GAAG;AAC7B,WAAO,WAAW,IAAI,EAAE,GAAG,GAAG;AAE9B,iBAAa,MAAM;AACnB,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,IAAI,EAAE,GAAG,GAAG;AAC7B,WAAO,WAAW,IAAI,EAAE,GAAG,GAAG;AAE9B,iBAAa,MAAM;AACnB,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,IAAI,EAAE,GAAG,GAAG;AAC7B,WAAO,WAAW,IAAI,EAAE,GAAG,GAAG;AAAA,EAClC,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { html } from "@spectrum-web-components/base";
|
|
3
|
+
import { elementUpdated, expect, fixture } from "@open-wc/testing";
|
|
4
|
+
import { sendKeys } from "@web/test-runner-commands";
|
|
5
|
+
import { spy } from "sinon";
|
|
6
|
+
import { Accordion, AccordionItem } from "@spectrum-web-components/accordion";
|
|
7
|
+
import "@spectrum-web-components/accordion/sp-accordion.js";
|
|
8
|
+
import "@spectrum-web-components/accordion/sp-accordion-item.js";
|
|
9
|
+
describe("Accordion - keyboard", () => {
|
|
10
|
+
it("does not accept keyboard events when items are not present", async () => {
|
|
11
|
+
const errorSpy = spy();
|
|
12
|
+
const el = await fixture(html`
|
|
13
|
+
<sp-accordion>
|
|
14
|
+
<sp-accordion-item disabled label="Heading 2">
|
|
15
|
+
<div>Item 2</div>
|
|
16
|
+
</sp-accordion-item>
|
|
17
|
+
</sp-accordion>
|
|
18
|
+
`);
|
|
19
|
+
await elementUpdated(el);
|
|
20
|
+
const item = el.querySelector("sp-accordion-item");
|
|
21
|
+
window.addEventListener("error", () => errorSpy());
|
|
22
|
+
el.focus();
|
|
23
|
+
item.remove();
|
|
24
|
+
await elementUpdated(el);
|
|
25
|
+
el.dispatchEvent(
|
|
26
|
+
new KeyboardEvent("keydown", {
|
|
27
|
+
code: "ArrowDown"
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
expect(errorSpy.callCount).to.equal(0);
|
|
31
|
+
});
|
|
32
|
+
it("handles focus and keyboard input and ignores disabled items", async () => {
|
|
33
|
+
var _a;
|
|
34
|
+
const el = await fixture(html`
|
|
35
|
+
<sp-accordion allow-multiple>
|
|
36
|
+
<sp-accordion-item disabled label="Heading 1">
|
|
37
|
+
<div>Item 1</div>
|
|
38
|
+
</sp-accordion-item>
|
|
39
|
+
<sp-accordion-item label="Heading 2">
|
|
40
|
+
<div>Item 2</div>
|
|
41
|
+
</sp-accordion-item>
|
|
42
|
+
<sp-accordion-item label="Heading 3">
|
|
43
|
+
<div>Item 3</div>
|
|
44
|
+
</sp-accordion-item>
|
|
45
|
+
<sp-accordion-item label="Heading 4">
|
|
46
|
+
<div>Item 4</div>
|
|
47
|
+
</sp-accordion-item>
|
|
48
|
+
<sp-accordion-item label="Heading 5">
|
|
49
|
+
<div>Item 5</div>
|
|
50
|
+
</sp-accordion-item>
|
|
51
|
+
<sp-accordion-item disabled label="Heading 6">
|
|
52
|
+
<div>Item 6</div>
|
|
53
|
+
</sp-accordion-item>
|
|
54
|
+
</sp-accordion>
|
|
55
|
+
`);
|
|
56
|
+
await elementUpdated(el);
|
|
57
|
+
const secondItem = el.querySelector(
|
|
58
|
+
"sp-accordion-item:nth-of-type(2)"
|
|
59
|
+
);
|
|
60
|
+
const thirdItem = el.querySelector(
|
|
61
|
+
"sp-accordion-item:nth-of-type(3)"
|
|
62
|
+
);
|
|
63
|
+
const fourthItem = el.querySelector(
|
|
64
|
+
"sp-accordion-item:nth-of-type(4)"
|
|
65
|
+
);
|
|
66
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(
|
|
67
|
+
navigator.userAgent
|
|
68
|
+
);
|
|
69
|
+
const tab = isSafari ? "Alt+Tab" : "Tab";
|
|
70
|
+
const shiftTab = isSafari ? "Alt+Shift+Tab" : "Shift+Tab";
|
|
71
|
+
el.focus();
|
|
72
|
+
await elementUpdated(el);
|
|
73
|
+
expect(
|
|
74
|
+
document.activeElement === secondItem,
|
|
75
|
+
(_a = document.activeElement) == null ? void 0 : _a.localName
|
|
76
|
+
).to.be.true;
|
|
77
|
+
await sendKeys({
|
|
78
|
+
press: tab
|
|
79
|
+
});
|
|
80
|
+
expect(document.activeElement === thirdItem).to.be.true;
|
|
81
|
+
await sendKeys({
|
|
82
|
+
press: tab
|
|
83
|
+
});
|
|
84
|
+
expect(document.activeElement === fourthItem).to.be.true;
|
|
85
|
+
await sendKeys({
|
|
86
|
+
press: shiftTab
|
|
87
|
+
});
|
|
88
|
+
await sendKeys({
|
|
89
|
+
press: shiftTab
|
|
90
|
+
});
|
|
91
|
+
expect(document.activeElement === secondItem).to.be.true;
|
|
92
|
+
document.body.focus();
|
|
93
|
+
el.focus();
|
|
94
|
+
expect(document.activeElement === secondItem).to.be.true;
|
|
95
|
+
await sendKeys({
|
|
96
|
+
press: shiftTab
|
|
97
|
+
});
|
|
98
|
+
await elementUpdated(el);
|
|
99
|
+
const outsideFocused = document.activeElement;
|
|
100
|
+
expect(typeof outsideFocused).not.to.equal(AccordionItem);
|
|
101
|
+
expect(typeof outsideFocused).not.to.equal(Accordion);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe("Accordion Item - keyboard", () => {
|
|
105
|
+
it("dispatches toggle event on enter key", async () => {
|
|
106
|
+
let open = false;
|
|
107
|
+
const onAccordionToggle = () => {
|
|
108
|
+
open = true;
|
|
109
|
+
};
|
|
110
|
+
const el = await fixture(html`
|
|
111
|
+
<sp-accordion-item
|
|
112
|
+
disabled
|
|
113
|
+
@sp-accordion-item-toggle=${onAccordionToggle}
|
|
114
|
+
>
|
|
115
|
+
<div>Item 1</div>
|
|
116
|
+
</sp-accordion-item>
|
|
117
|
+
`);
|
|
118
|
+
await elementUpdated(el);
|
|
119
|
+
expect(open).to.be.false;
|
|
120
|
+
el.focus();
|
|
121
|
+
await sendKeys({
|
|
122
|
+
press: "Enter"
|
|
123
|
+
});
|
|
124
|
+
await elementUpdated(el);
|
|
125
|
+
expect(open).to.be.false;
|
|
126
|
+
el.disabled = false;
|
|
127
|
+
await elementUpdated(el);
|
|
128
|
+
el.focus();
|
|
129
|
+
await sendKeys({
|
|
130
|
+
press: "Enter"
|
|
131
|
+
});
|
|
132
|
+
await elementUpdated(el);
|
|
133
|
+
expect(open).to.be.true;
|
|
134
|
+
});
|
|
135
|
+
it("dispatches toggle event on space key", async () => {
|
|
136
|
+
let open = false;
|
|
137
|
+
const onAccordionToggle = () => {
|
|
138
|
+
open = true;
|
|
139
|
+
};
|
|
140
|
+
const el = await fixture(html`
|
|
141
|
+
<sp-accordion-item
|
|
142
|
+
disabled
|
|
143
|
+
@sp-accordion-item-toggle=${onAccordionToggle}
|
|
144
|
+
>
|
|
145
|
+
<div>Item 1</div>
|
|
146
|
+
</sp-accordion-item>
|
|
147
|
+
`);
|
|
148
|
+
await elementUpdated(el);
|
|
149
|
+
expect(open).to.be.false;
|
|
150
|
+
el.focus();
|
|
151
|
+
await sendKeys({
|
|
152
|
+
press: "Space"
|
|
153
|
+
});
|
|
154
|
+
await elementUpdated(el);
|
|
155
|
+
expect(open).to.be.false;
|
|
156
|
+
el.disabled = false;
|
|
157
|
+
await elementUpdated(el);
|
|
158
|
+
el.focus();
|
|
159
|
+
await sendKeys({
|
|
160
|
+
press: "Space"
|
|
161
|
+
});
|
|
162
|
+
await elementUpdated(el);
|
|
163
|
+
expect(open).to.be.true;
|
|
164
|
+
});
|
|
165
|
+
it("does not dispatch toggle events on key events in Item content", async () => {
|
|
166
|
+
let closed = false;
|
|
167
|
+
const onAccordionToggle = () => {
|
|
168
|
+
closed = true;
|
|
169
|
+
};
|
|
170
|
+
const el = await fixture(html`
|
|
171
|
+
<sp-accordion-item
|
|
172
|
+
open
|
|
173
|
+
@sp-accordion-item-toggle=${onAccordionToggle}
|
|
174
|
+
>
|
|
175
|
+
<div>
|
|
176
|
+
<button>Test Button</button>
|
|
177
|
+
</div>
|
|
178
|
+
</sp-accordion-item>
|
|
179
|
+
`);
|
|
180
|
+
const button = el.querySelector("button");
|
|
181
|
+
await elementUpdated(el);
|
|
182
|
+
expect(el.open).to.be.true;
|
|
183
|
+
expect(closed).to.be.false;
|
|
184
|
+
button.focus();
|
|
185
|
+
await sendKeys({
|
|
186
|
+
press: "Space"
|
|
187
|
+
});
|
|
188
|
+
await elementUpdated(el);
|
|
189
|
+
expect(closed).to.be.false;
|
|
190
|
+
await elementUpdated(el);
|
|
191
|
+
await sendKeys({
|
|
192
|
+
press: "Enter"
|
|
193
|
+
});
|
|
194
|
+
await elementUpdated(el);
|
|
195
|
+
expect(closed).to.be.false;
|
|
196
|
+
expect(el.open).to.be.true;
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
//# sourceMappingURL=keyboard.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["keyboard.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 { html } from '@spectrum-web-components/base';\nimport { elementUpdated, expect, fixture } from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\n\nimport { Accordion, AccordionItem } from '@spectrum-web-components/accordion';\nimport '@spectrum-web-components/accordion/sp-accordion.js';\nimport '@spectrum-web-components/accordion/sp-accordion-item.js';\n\ndescribe('Accordion - keyboard', () => {\n it('does not accept keyboard events when items are not present', async () => {\n const errorSpy = spy();\n const el = await fixture<Accordion>(html`\n <sp-accordion>\n <sp-accordion-item disabled label=\"Heading 2\">\n <div>Item 2</div>\n </sp-accordion-item>\n </sp-accordion>\n `);\n\n await elementUpdated(el);\n const item = el.querySelector('sp-accordion-item') as AccordionItem;\n window.addEventListener('error', () => errorSpy());\n\n el.focus();\n item.remove();\n await elementUpdated(el);\n el.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'ArrowDown',\n })\n );\n\n expect(errorSpy.callCount).to.equal(0);\n });\n it('handles focus and keyboard input and ignores disabled items', async () => {\n const el = await fixture<Accordion>(html`\n <sp-accordion allow-multiple>\n <sp-accordion-item disabled label=\"Heading 1\">\n <div>Item 1</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 2\">\n <div>Item 2</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 3\">\n <div>Item 3</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 4\">\n <div>Item 4</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 5\">\n <div>Item 5</div>\n </sp-accordion-item>\n <sp-accordion-item disabled label=\"Heading 6\">\n <div>Item 6</div>\n </sp-accordion-item>\n </sp-accordion>\n `);\n\n await elementUpdated(el);\n\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n const thirdItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(3)'\n ) as AccordionItem;\n const fourthItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(4)'\n ) as AccordionItem;\n const isSafari = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent\n );\n const tab = isSafari ? 'Alt+Tab' : 'Tab';\n const shiftTab = isSafari ? 'Alt+Shift+Tab' : 'Shift+Tab';\n\n el.focus();\n\n await elementUpdated(el);\n expect(\n document.activeElement === secondItem,\n document.activeElement?.localName\n ).to.be.true;\n\n await sendKeys({\n press: tab,\n });\n\n expect(document.activeElement === thirdItem).to.be.true;\n\n await sendKeys({\n press: tab,\n });\n\n expect(document.activeElement === fourthItem).to.be.true;\n\n await sendKeys({\n press: shiftTab,\n });\n await sendKeys({\n press: shiftTab,\n });\n\n expect(document.activeElement === secondItem).to.be.true;\n\n document.body.focus();\n\n el.focus();\n expect(document.activeElement === secondItem).to.be.true;\n\n await sendKeys({\n press: shiftTab,\n });\n await elementUpdated(el);\n\n const outsideFocused = document.activeElement as HTMLElement;\n\n expect(typeof outsideFocused).not.to.equal(AccordionItem);\n expect(typeof outsideFocused).not.to.equal(Accordion);\n });\n});\n\ndescribe('Accordion Item - keyboard', () => {\n it('dispatches toggle event on enter key', async () => {\n let open = false;\n const onAccordionToggle = (): void => {\n open = true;\n };\n const el = await fixture<AccordionItem>(html`\n <sp-accordion-item\n disabled\n @sp-accordion-item-toggle=${onAccordionToggle}\n >\n <div>Item 1</div>\n </sp-accordion-item>\n `);\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.focus();\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.disabled = false;\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.true;\n });\n it('dispatches toggle event on space key', async () => {\n let open = false;\n const onAccordionToggle = (): void => {\n open = true;\n };\n const el = await fixture<AccordionItem>(html`\n <sp-accordion-item\n disabled\n @sp-accordion-item-toggle=${onAccordionToggle}\n >\n <div>Item 1</div>\n </sp-accordion-item>\n `);\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.disabled = false;\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.true;\n });\n it('does not dispatch toggle events on key events in Item content', async () => {\n let closed = false;\n const onAccordionToggle = (): void => {\n closed = true;\n };\n const el = await fixture<AccordionItem>(html`\n <sp-accordion-item\n open\n @sp-accordion-item-toggle=${onAccordionToggle}\n >\n <div>\n <button>Test Button</button>\n </div>\n </sp-accordion-item>\n `);\n\n const button = el.querySelector('button') as HTMLButtonElement;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n expect(closed).to.be.false;\n\n button.focus();\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(closed).to.be.false;\n\n await elementUpdated(el);\n\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n expect(closed).to.be.false;\n expect(el.open).to.be.true;\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,YAAY;AACrB,SAAS,gBAAgB,QAAQ,eAAe;AAChD,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,SAAS,WAAW,qBAAqB;AACzC,OAAO;AACP,OAAO;AAEP,SAAS,wBAAwB,MAAM;AACnC,KAAG,8DAA8D,YAAY;AACzE,UAAM,WAAW,IAAI;AACrB,UAAM,KAAK,MAAM,QAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAMnC;AAED,UAAM,eAAe,EAAE;AACvB,UAAM,OAAO,GAAG,cAAc,mBAAmB;AACjD,WAAO,iBAAiB,SAAS,MAAM,SAAS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EAAE;AAEvB,WAAO,IAAI,EAAE,GAAG,GAAG;AAEnB,OAAG,WAAW;AACd,UAAM,eAAe,EAAE;AAEvB,OAAG,MAAM;AACT,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,IAAI,EAAE,GAAG,GAAG;AAAA,EACvB,CAAC;AACD,KAAG,iEAAiE,YAAY;AAC5E,QAAI,SAAS;AACb,UAAM,oBAAoB,MAAY;AAClC,eAAS;AAAA,IACb;AACA,UAAM,KAAK,MAAM,QAAuB;AAAA;AAAA;AAAA,4CAGJ,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAMpD;AAED,UAAM,SAAS,GAAG,cAAc,QAAQ;AACxC,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,MAAM,EAAE,GAAG,GAAG;AAErB,WAAO,MAAM;AACb,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,MAAM,EAAE,GAAG,GAAG;AAErB,UAAM,eAAe,EAAE;AAEvB,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,MAAM,EAAE,GAAG,GAAG;AACrB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,EAC1B,CAAC;AACL,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { Default } from "../stories/accordion.stories.js";
|
|
3
3
|
import { testForMemoryLeaks } from "../../../test/testing-helpers.js";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
describe("Accordion - memory usage", () => {
|
|
5
|
+
testForMemoryLeaks(Default());
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=memory.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 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 { Default } from '../stories/accordion.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\
|
|
5
|
-
"mappings": ";AAYA,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAEnC,
|
|
3
|
+
"sources": ["memory.test.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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 { Default } from '../stories/accordion.stories.js';\nimport { testForMemoryLeaks } from '../../../test/testing-helpers.js';\n\ndescribe('Accordion - memory usage', () => {\n testForMemoryLeaks(Default());\n});\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAEnC,SAAS,4BAA4B,MAAM;AACvC,qBAAmB,QAAQ,CAAC;AAChC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
3
|
-
import { spy } from "sinon";
|
|
4
|
-
import "@spectrum-web-components/accordion/sp-accordion-item.js";
|
|
5
|
-
import { sendKeys } from "@web/test-runner-commands";
|
|
6
|
-
describe("Accordion Item", () => {
|
|
7
|
-
it("can exist with no parent accessibly", async () => {
|
|
8
|
-
const el = await fixture(
|
|
9
|
-
html`
|
|
10
|
-
<sp-accordion-item label="item">
|
|
11
|
-
<div>Item 1</div>
|
|
12
|
-
</sp-accordion-item>
|
|
13
|
-
`
|
|
14
|
-
);
|
|
15
|
-
await elementUpdated(el);
|
|
16
|
-
await expect(el).to.be.accessible();
|
|
17
|
-
});
|
|
18
|
-
it("can be `[disabled]`", async () => {
|
|
19
|
-
const toggleSpy = spy();
|
|
20
|
-
const handleToggle = () => toggleSpy();
|
|
21
|
-
const el = await fixture(
|
|
22
|
-
html`
|
|
23
|
-
<sp-accordion-item
|
|
24
|
-
disabled
|
|
25
|
-
@sp-accordion-item-toggle=${handleToggle}
|
|
26
|
-
>
|
|
27
|
-
<div>Item 1</div>
|
|
28
|
-
</sp-accordion-item>
|
|
29
|
-
`
|
|
30
|
-
);
|
|
31
|
-
const root = el.shadowRoot;
|
|
32
|
-
const button = root.querySelector("#header");
|
|
33
|
-
await elementUpdated(el);
|
|
34
|
-
expect(toggleSpy.callCount).to.equal(0);
|
|
35
|
-
button.click();
|
|
36
|
-
await elementUpdated(el);
|
|
37
|
-
expect(toggleSpy.callCount).to.equal(0);
|
|
38
|
-
el.disabled = false;
|
|
39
|
-
await elementUpdated(el);
|
|
40
|
-
button.click();
|
|
41
|
-
await elementUpdated(el);
|
|
42
|
-
expect(toggleSpy.callCount).to.equal(1);
|
|
43
|
-
});
|
|
44
|
-
it("dispatches toggle event on enter key", async () => {
|
|
45
|
-
let open = false;
|
|
46
|
-
const onAccordionToggle = () => {
|
|
47
|
-
open = true;
|
|
48
|
-
};
|
|
49
|
-
const el = await fixture(
|
|
50
|
-
html`
|
|
51
|
-
<sp-accordion-item
|
|
52
|
-
disabled
|
|
53
|
-
@sp-accordion-item-toggle=${onAccordionToggle}
|
|
54
|
-
>
|
|
55
|
-
<div>Item 1</div>
|
|
56
|
-
</sp-accordion-item>
|
|
57
|
-
`
|
|
58
|
-
);
|
|
59
|
-
await elementUpdated(el);
|
|
60
|
-
expect(open).to.be.false;
|
|
61
|
-
el.focus();
|
|
62
|
-
await sendKeys({
|
|
63
|
-
press: "Enter"
|
|
64
|
-
});
|
|
65
|
-
await elementUpdated(el);
|
|
66
|
-
expect(open).to.be.false;
|
|
67
|
-
el.disabled = false;
|
|
68
|
-
await elementUpdated(el);
|
|
69
|
-
el.focus();
|
|
70
|
-
await sendKeys({
|
|
71
|
-
press: "Enter"
|
|
72
|
-
});
|
|
73
|
-
await elementUpdated(el);
|
|
74
|
-
expect(open).to.be.true;
|
|
75
|
-
});
|
|
76
|
-
it("dispatches toggle event on space key", async () => {
|
|
77
|
-
let open = false;
|
|
78
|
-
const onAccordionToggle = () => {
|
|
79
|
-
open = true;
|
|
80
|
-
};
|
|
81
|
-
const el = await fixture(
|
|
82
|
-
html`
|
|
83
|
-
<sp-accordion-item
|
|
84
|
-
disabled
|
|
85
|
-
@sp-accordion-item-toggle=${onAccordionToggle}
|
|
86
|
-
>
|
|
87
|
-
<div>Item 1</div>
|
|
88
|
-
</sp-accordion-item>
|
|
89
|
-
`
|
|
90
|
-
);
|
|
91
|
-
await elementUpdated(el);
|
|
92
|
-
expect(open).to.be.false;
|
|
93
|
-
el.focus();
|
|
94
|
-
await sendKeys({
|
|
95
|
-
press: "Space"
|
|
96
|
-
});
|
|
97
|
-
await elementUpdated(el);
|
|
98
|
-
expect(open).to.be.false;
|
|
99
|
-
el.disabled = false;
|
|
100
|
-
await elementUpdated(el);
|
|
101
|
-
el.focus();
|
|
102
|
-
await sendKeys({
|
|
103
|
-
press: "Space"
|
|
104
|
-
});
|
|
105
|
-
await elementUpdated(el);
|
|
106
|
-
expect(open).to.be.true;
|
|
107
|
-
});
|
|
108
|
-
it("does not dispatch toggle events on key events in Item content", async () => {
|
|
109
|
-
let closed = false;
|
|
110
|
-
const onAccordionToggle = () => {
|
|
111
|
-
closed = true;
|
|
112
|
-
};
|
|
113
|
-
const el = await fixture(
|
|
114
|
-
html`
|
|
115
|
-
<sp-accordion-item
|
|
116
|
-
open
|
|
117
|
-
@sp-accordion-item-toggle=${onAccordionToggle}
|
|
118
|
-
>
|
|
119
|
-
<div>
|
|
120
|
-
<button>Test Button</button>
|
|
121
|
-
</div>
|
|
122
|
-
</sp-accordion-item>
|
|
123
|
-
`
|
|
124
|
-
);
|
|
125
|
-
const button = el.querySelector("button");
|
|
126
|
-
await elementUpdated(el);
|
|
127
|
-
expect(el.open).to.be.true;
|
|
128
|
-
expect(closed).to.be.false;
|
|
129
|
-
button.focus();
|
|
130
|
-
await sendKeys({
|
|
131
|
-
press: "Space"
|
|
132
|
-
});
|
|
133
|
-
await elementUpdated(el);
|
|
134
|
-
expect(closed).to.be.false;
|
|
135
|
-
await elementUpdated(el);
|
|
136
|
-
await sendKeys({
|
|
137
|
-
press: "Enter"
|
|
138
|
-
});
|
|
139
|
-
await elementUpdated(el);
|
|
140
|
-
expect(closed).to.be.false;
|
|
141
|
-
expect(el.open).to.be.true;
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
//# sourceMappingURL=accordion-item.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["accordion-item.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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { spy } from 'sinon';\n\nimport '@spectrum-web-components/accordion/sp-accordion-item.js';\nimport { AccordionItem } from '@spectrum-web-components/accordion/src/AccordionItem.js';\nimport { sendKeys } from '@web/test-runner-commands';\n\ndescribe('Accordion Item', () => {\n it('can exist with no parent accessibly', async () => {\n const el = await fixture<AccordionItem>(\n html`\n <sp-accordion-item label=\"item\">\n <div>Item 1</div>\n </sp-accordion-item>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('can be `[disabled]`', async () => {\n const toggleSpy = spy();\n const handleToggle = (): void => toggleSpy();\n const el = await fixture<AccordionItem>(\n html`\n <sp-accordion-item\n disabled\n @sp-accordion-item-toggle=${handleToggle}\n >\n <div>Item 1</div>\n </sp-accordion-item>\n `\n );\n\n const root = el.shadowRoot as ShadowRoot;\n const button = root.querySelector('#header') as HTMLElement;\n\n await elementUpdated(el);\n\n expect(toggleSpy.callCount).to.equal(0);\n\n button.click();\n\n await elementUpdated(el);\n\n expect(toggleSpy.callCount).to.equal(0);\n\n el.disabled = false;\n await elementUpdated(el);\n\n button.click();\n\n await elementUpdated(el);\n\n expect(toggleSpy.callCount).to.equal(1);\n });\n\n it('dispatches toggle event on enter key', async () => {\n let open = false;\n const onAccordionToggle = (): void => {\n open = true;\n };\n const el = await fixture<AccordionItem>(\n html`\n <sp-accordion-item\n disabled\n @sp-accordion-item-toggle=${onAccordionToggle}\n >\n <div>Item 1</div>\n </sp-accordion-item>\n `\n );\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.focus();\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.disabled = false;\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.true;\n });\n\n it('dispatches toggle event on space key', async () => {\n let open = false;\n const onAccordionToggle = (): void => {\n open = true;\n };\n const el = await fixture<AccordionItem>(\n html`\n <sp-accordion-item\n disabled\n @sp-accordion-item-toggle=${onAccordionToggle}\n >\n <div>Item 1</div>\n </sp-accordion-item>\n `\n );\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.false;\n\n el.disabled = false;\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(open).to.be.true;\n });\n\n it('does not dispatch toggle events on key events in Item content', async () => {\n let closed = false;\n const onAccordionToggle = (): void => {\n closed = true;\n };\n const el = await fixture<AccordionItem>(\n html`\n <sp-accordion-item\n open\n @sp-accordion-item-toggle=${onAccordionToggle}\n >\n <div>\n <button>Test Button</button>\n </div>\n </sp-accordion-item>\n `\n );\n\n const button = el.querySelector('button') as HTMLButtonElement;\n await elementUpdated(el);\n\n expect(el.open).to.be.true;\n expect(closed).to.be.false;\n\n button.focus();\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(closed).to.be.false;\n\n await elementUpdated(el);\n\n await sendKeys({\n press: 'Enter',\n });\n\n await elementUpdated(el);\n\n expect(closed).to.be.false;\n expect(el.open).to.be.true;\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD,SAAS,WAAW;AAEpB,OAAO;AAEP,SAAS,gBAAgB;AAEzB,SAAS,kBAAkB,MAAM;AAC7B,KAAG,uCAAuC,YAAY;AAClD,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA;AAAA;AAAA,IAKJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,uBAAuB,YAAY;AAClC,UAAM,YAAY,IAAI;AACtB,UAAM,eAAe,MAAY,UAAU;AAC3C,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;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,eAAe,EAAE;AAEvB,WAAO,IAAI,EAAE,GAAG,GAAG;AAEnB,OAAG,MAAM;AACT,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,IAAI,EAAE,GAAG,GAAG;AAEnB,OAAG,WAAW;AACd,UAAM,eAAe,EAAE;AAEvB,OAAG,MAAM;AACT,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,IAAI,EAAE,GAAG,GAAG;AAAA,EACvB,CAAC;AAED,KAAG,iEAAiE,YAAY;AAC5E,QAAI,SAAS;AACb,UAAM,oBAAoB,MAAY;AAClC,eAAS;AAAA,IACb;AACA,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,gDAGoC,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOzD;AAEA,UAAM,SAAS,GAAG,cAAc,QAAQ;AACxC,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AACtB,WAAO,MAAM,EAAE,GAAG,GAAG;AAErB,WAAO,MAAM;AACb,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,MAAM,EAAE,GAAG,GAAG;AAErB,UAAM,eAAe,EAAE;AAEvB,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,MAAM,EAAE,GAAG,GAAG;AACrB,WAAO,GAAG,IAAI,EAAE,GAAG,GAAG;AAAA,EAC1B,CAAC;AACL,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/test/accordion.test.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
3
|
-
import "@spectrum-web-components/accordion/sp-accordion.js";
|
|
4
|
-
import { Default } from "../stories/accordion.stories.js";
|
|
5
|
-
import { Accordion, AccordionItem } from "@spectrum-web-components/accordion";
|
|
6
|
-
import { sendKeys } from "@web/test-runner-commands";
|
|
7
|
-
import { spy } from "sinon";
|
|
8
|
-
import { AccordionMarkup } from "../stories/index.js";
|
|
9
|
-
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
10
|
-
describe("Accordion", () => {
|
|
11
|
-
testForLitDevWarnings(async () => await fixture(Default()));
|
|
12
|
-
it("renders with items accessibly", async () => {
|
|
13
|
-
const el = await fixture(Default());
|
|
14
|
-
await elementUpdated(el);
|
|
15
|
-
await expect(el).to.be.accessible();
|
|
16
|
-
});
|
|
17
|
-
it("does not accept focus when empty", async () => {
|
|
18
|
-
const el = await fixture(
|
|
19
|
-
html`
|
|
20
|
-
<sp-accordion></sp-accordion>
|
|
21
|
-
`
|
|
22
|
-
);
|
|
23
|
-
await elementUpdated(el);
|
|
24
|
-
expect(document.activeElement === el).to.be.false;
|
|
25
|
-
el.focus();
|
|
26
|
-
await elementUpdated(el);
|
|
27
|
-
expect(document.activeElement === el).to.be.false;
|
|
28
|
-
});
|
|
29
|
-
it("manages item size", async () => {
|
|
30
|
-
const el = await fixture(
|
|
31
|
-
AccordionMarkup({
|
|
32
|
-
size: "l"
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
const item = el.querySelector("sp-accordion-item");
|
|
36
|
-
expect(el.size).to.equal("l");
|
|
37
|
-
expect(item.size).to.equal("l");
|
|
38
|
-
el.size = "s";
|
|
39
|
-
await elementUpdated(el);
|
|
40
|
-
await elementUpdated(item);
|
|
41
|
-
expect(el.size).to.equal("s");
|
|
42
|
-
expect(item.size).to.equal("s");
|
|
43
|
-
});
|
|
44
|
-
it("does not accept keyboard events when items are not present", async () => {
|
|
45
|
-
const errorSpy = spy();
|
|
46
|
-
const el = await fixture(
|
|
47
|
-
html`
|
|
48
|
-
<sp-accordion>
|
|
49
|
-
<sp-accordion-item disabled label="Heading 2">
|
|
50
|
-
<div>Item 2</div>
|
|
51
|
-
</sp-accordion-item>
|
|
52
|
-
</sp-accordion>
|
|
53
|
-
`
|
|
54
|
-
);
|
|
55
|
-
await elementUpdated(el);
|
|
56
|
-
const item = el.querySelector("sp-accordion-item");
|
|
57
|
-
window.addEventListener("error", () => errorSpy());
|
|
58
|
-
el.focus();
|
|
59
|
-
item.remove();
|
|
60
|
-
await elementUpdated(el);
|
|
61
|
-
el.dispatchEvent(
|
|
62
|
-
new KeyboardEvent("keydown", {
|
|
63
|
-
code: "ArrowDown"
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
expect(errorSpy.callCount).to.equal(0);
|
|
67
|
-
});
|
|
68
|
-
it("does not accept focus when all children [disabled]", async () => {
|
|
69
|
-
const el = await fixture(
|
|
70
|
-
html`
|
|
71
|
-
<sp-accordion>
|
|
72
|
-
<sp-accordion-item disabled label="Heading 1">
|
|
73
|
-
<div>Item 1</div>
|
|
74
|
-
</sp-accordion-item>
|
|
75
|
-
<sp-accordion-item disabled label="Heading 2">
|
|
76
|
-
<div>Item 2</div>
|
|
77
|
-
</sp-accordion-item>
|
|
78
|
-
</sp-accordion>
|
|
79
|
-
`
|
|
80
|
-
);
|
|
81
|
-
await elementUpdated(el);
|
|
82
|
-
expect(document.activeElement === el).to.be.false;
|
|
83
|
-
el.focus();
|
|
84
|
-
await elementUpdated(el);
|
|
85
|
-
expect(document.activeElement === el).to.be.false;
|
|
86
|
-
});
|
|
87
|
-
it("only allows one open item by default", async () => {
|
|
88
|
-
const el = await fixture(Default());
|
|
89
|
-
await elementUpdated(el);
|
|
90
|
-
const firstItem = el.querySelector(
|
|
91
|
-
"sp-accordion-item:nth-of-type(1)"
|
|
92
|
-
);
|
|
93
|
-
const secondItem = el.querySelector(
|
|
94
|
-
"sp-accordion-item:nth-of-type(2)"
|
|
95
|
-
);
|
|
96
|
-
const firstButton = firstItem.focusElement;
|
|
97
|
-
const secondButton = secondItem.focusElement;
|
|
98
|
-
firstButton.click();
|
|
99
|
-
await elementUpdated(el);
|
|
100
|
-
let openItems = el.querySelectorAll("sp-accordion-item[open]");
|
|
101
|
-
expect(openItems.length).to.equal(1);
|
|
102
|
-
secondButton.click();
|
|
103
|
-
await elementUpdated(el);
|
|
104
|
-
openItems = el.querySelectorAll("sp-accordion-item[open]");
|
|
105
|
-
expect(openItems.length).to.equal(1);
|
|
106
|
-
});
|
|
107
|
-
it("can have `toggle` events canceled", async () => {
|
|
108
|
-
const el = await fixture(Default());
|
|
109
|
-
await elementUpdated(el);
|
|
110
|
-
const firstItem = el.querySelector(
|
|
111
|
-
"sp-accordion-item:nth-of-type(1)"
|
|
112
|
-
);
|
|
113
|
-
const secondItem = el.querySelector(
|
|
114
|
-
"sp-accordion-item:nth-of-type(2)"
|
|
115
|
-
);
|
|
116
|
-
const firstButton = firstItem.focusElement;
|
|
117
|
-
const secondButton = secondItem.focusElement;
|
|
118
|
-
firstButton.click();
|
|
119
|
-
await elementUpdated(el);
|
|
120
|
-
expect(firstItem.open).to.be.true;
|
|
121
|
-
expect(secondItem.open).to.be.false;
|
|
122
|
-
el.addEventListener(
|
|
123
|
-
"sp-accordion-item-toggle",
|
|
124
|
-
(event) => event.preventDefault()
|
|
125
|
-
);
|
|
126
|
-
secondButton.click();
|
|
127
|
-
await elementUpdated(el);
|
|
128
|
-
expect(firstItem.open).to.be.true;
|
|
129
|
-
expect(secondItem.open).to.be.false;
|
|
130
|
-
});
|
|
131
|
-
it("allows more than one open item when `[allow-multiple]`", async () => {
|
|
132
|
-
const el = await fixture(Default());
|
|
133
|
-
el.allowMultiple = true;
|
|
134
|
-
await elementUpdated(el);
|
|
135
|
-
const firstItem = el.querySelector(
|
|
136
|
-
"sp-accordion-item:nth-of-type(1)"
|
|
137
|
-
);
|
|
138
|
-
const secondItem = el.querySelector(
|
|
139
|
-
"sp-accordion-item:nth-of-type(2)"
|
|
140
|
-
);
|
|
141
|
-
const firstButton = firstItem.focusElement;
|
|
142
|
-
const secondButton = secondItem.focusElement;
|
|
143
|
-
firstButton.click();
|
|
144
|
-
await elementUpdated(el);
|
|
145
|
-
expect(firstItem.open).to.be.true;
|
|
146
|
-
expect(secondItem.open).to.be.false;
|
|
147
|
-
secondButton.click();
|
|
148
|
-
await elementUpdated(el);
|
|
149
|
-
expect(firstItem.open).to.be.true;
|
|
150
|
-
expect(secondItem.open).to.be.true;
|
|
151
|
-
});
|
|
152
|
-
it("ensures that the correct item is open and that items can be closed", async () => {
|
|
153
|
-
const el = await fixture(Default());
|
|
154
|
-
await elementUpdated(el);
|
|
155
|
-
const firstItem = el.querySelector(
|
|
156
|
-
"sp-accordion-item:nth-of-type(1)"
|
|
157
|
-
);
|
|
158
|
-
const secondItem = el.querySelector(
|
|
159
|
-
"sp-accordion-item:nth-of-type(2)"
|
|
160
|
-
);
|
|
161
|
-
const firstButton = firstItem.focusElement;
|
|
162
|
-
const secondButton = secondItem.focusElement;
|
|
163
|
-
firstButton.click();
|
|
164
|
-
await elementUpdated(el);
|
|
165
|
-
expect(firstItem.open).to.be.true;
|
|
166
|
-
expect(secondItem.open).to.be.false;
|
|
167
|
-
secondButton.click();
|
|
168
|
-
await elementUpdated(el);
|
|
169
|
-
expect(firstItem.open).to.be.false;
|
|
170
|
-
expect(secondItem.open).to.be.true;
|
|
171
|
-
secondButton.click();
|
|
172
|
-
await elementUpdated(el);
|
|
173
|
-
expect(firstItem.open).to.be.false;
|
|
174
|
-
expect(secondItem.open).to.be.false;
|
|
175
|
-
});
|
|
176
|
-
it("ensures that the correct item is open and that items can be closed when [allow-multiple]", async () => {
|
|
177
|
-
const el = await fixture(Default());
|
|
178
|
-
el.allowMultiple = true;
|
|
179
|
-
await elementUpdated(el);
|
|
180
|
-
const firstItem = el.querySelector(
|
|
181
|
-
"sp-accordion-item:nth-of-type(1)"
|
|
182
|
-
);
|
|
183
|
-
const secondItem = el.querySelector(
|
|
184
|
-
"sp-accordion-item:nth-of-type(2)"
|
|
185
|
-
);
|
|
186
|
-
const firstButton = firstItem.focusElement;
|
|
187
|
-
const secondButton = secondItem.focusElement;
|
|
188
|
-
firstButton.click();
|
|
189
|
-
await elementUpdated(el);
|
|
190
|
-
expect(firstItem.open).to.be.true;
|
|
191
|
-
expect(secondItem.open).to.be.false;
|
|
192
|
-
secondButton.click();
|
|
193
|
-
await elementUpdated(el);
|
|
194
|
-
expect(firstItem.open).to.be.true;
|
|
195
|
-
expect(secondItem.open).to.be.true;
|
|
196
|
-
secondButton.click();
|
|
197
|
-
await elementUpdated(el);
|
|
198
|
-
expect(firstItem.open).to.be.true;
|
|
199
|
-
expect(secondItem.open).to.be.false;
|
|
200
|
-
});
|
|
201
|
-
it("handles focus and keyboard input and ignores disabled items", async () => {
|
|
202
|
-
const el = await fixture(
|
|
203
|
-
html`
|
|
204
|
-
<sp-accordion allow-multiple>
|
|
205
|
-
<sp-accordion-item disabled label="Heading 1">
|
|
206
|
-
<div>Item 1</div>
|
|
207
|
-
</sp-accordion-item>
|
|
208
|
-
<sp-accordion-item label="Heading 2">
|
|
209
|
-
<div>Item 2</div>
|
|
210
|
-
</sp-accordion-item>
|
|
211
|
-
<sp-accordion-item label="Heading 3">
|
|
212
|
-
<div>Item 3</div>
|
|
213
|
-
</sp-accordion-item>
|
|
214
|
-
<sp-accordion-item label="Heading 4">
|
|
215
|
-
<div>Item 4</div>
|
|
216
|
-
</sp-accordion-item>
|
|
217
|
-
<sp-accordion-item label="Heading 5">
|
|
218
|
-
<div>Item 5</div>
|
|
219
|
-
</sp-accordion-item>
|
|
220
|
-
<sp-accordion-item disabled label="Heading 6">
|
|
221
|
-
<div>Item 6</div>
|
|
222
|
-
</sp-accordion-item>
|
|
223
|
-
</sp-accordion>
|
|
224
|
-
`
|
|
225
|
-
);
|
|
226
|
-
await elementUpdated(el);
|
|
227
|
-
const secondItem = el.querySelector(
|
|
228
|
-
"sp-accordion-item:nth-of-type(2)"
|
|
229
|
-
);
|
|
230
|
-
const thirdItem = el.querySelector(
|
|
231
|
-
"sp-accordion-item:nth-of-type(3)"
|
|
232
|
-
);
|
|
233
|
-
const fourthItem = el.querySelector(
|
|
234
|
-
"sp-accordion-item:nth-of-type(4)"
|
|
235
|
-
);
|
|
236
|
-
const isSafari = /^((?!chrome|android).)*safari/i.test(
|
|
237
|
-
navigator.userAgent
|
|
238
|
-
);
|
|
239
|
-
const tab = isSafari ? "Alt+Tab" : "Tab";
|
|
240
|
-
const shiftTab = isSafari ? "Alt+Shift+Tab" : "Shift+Tab";
|
|
241
|
-
el.focus();
|
|
242
|
-
await elementUpdated(el);
|
|
243
|
-
expect(document.activeElement === secondItem).to.be.true;
|
|
244
|
-
await sendKeys({
|
|
245
|
-
press: tab
|
|
246
|
-
});
|
|
247
|
-
expect(document.activeElement === thirdItem).to.be.true;
|
|
248
|
-
await sendKeys({
|
|
249
|
-
press: tab
|
|
250
|
-
});
|
|
251
|
-
expect(document.activeElement === fourthItem).to.be.true;
|
|
252
|
-
await sendKeys({
|
|
253
|
-
press: shiftTab
|
|
254
|
-
});
|
|
255
|
-
await sendKeys({
|
|
256
|
-
press: shiftTab
|
|
257
|
-
});
|
|
258
|
-
expect(document.activeElement === secondItem).to.be.true;
|
|
259
|
-
document.body.focus();
|
|
260
|
-
el.focus();
|
|
261
|
-
expect(document.activeElement === secondItem).to.be.true;
|
|
262
|
-
await sendKeys({
|
|
263
|
-
press: shiftTab
|
|
264
|
-
});
|
|
265
|
-
await elementUpdated(el);
|
|
266
|
-
const outsideFocused = document.activeElement;
|
|
267
|
-
expect(typeof outsideFocused).not.to.equal(AccordionItem);
|
|
268
|
-
expect(typeof outsideFocused).not.to.equal(Accordion);
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
//# sourceMappingURL=accordion.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["accordion.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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '@spectrum-web-components/accordion/sp-accordion.js';\nimport { Default } from '../stories/accordion.stories.js';\nimport { Accordion, AccordionItem } from '@spectrum-web-components/accordion';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\nimport { AccordionMarkup } from '../stories/index.js';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Accordion', () => {\n testForLitDevWarnings(async () => await fixture<Accordion>(Default()));\n it('renders with items accessibly', async () => {\n const el = await fixture<Accordion>(Default());\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('does not accept focus when empty', async () => {\n const el = await fixture<Accordion>(\n html`\n <sp-accordion></sp-accordion>\n `\n );\n\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n });\n it('manages item size', async () => {\n const el = await fixture<Accordion>(\n AccordionMarkup({\n size: 'l',\n })\n );\n const item = el.querySelector('sp-accordion-item') as AccordionItem;\n expect(el.size).to.equal('l');\n expect(item.size).to.equal('l');\n\n el.size = 's';\n await elementUpdated(el);\n await elementUpdated(item);\n expect(el.size).to.equal('s');\n expect(item.size).to.equal('s');\n });\n it('does not accept keyboard events when items are not present', async () => {\n const errorSpy = spy();\n const el = await fixture<Accordion>(\n html`\n <sp-accordion>\n <sp-accordion-item disabled label=\"Heading 2\">\n <div>Item 2</div>\n </sp-accordion-item>\n </sp-accordion>\n `\n );\n\n await elementUpdated(el);\n const item = el.querySelector('sp-accordion-item') as AccordionItem;\n window.addEventListener('error', () => errorSpy());\n\n el.focus();\n item.remove();\n await elementUpdated(el);\n el.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'ArrowDown',\n })\n );\n\n expect(errorSpy.callCount).to.equal(0);\n });\n it('does not accept focus when all children [disabled]', async () => {\n const el = await fixture<Accordion>(\n html`\n <sp-accordion>\n <sp-accordion-item disabled label=\"Heading 1\">\n <div>Item 1</div>\n </sp-accordion-item>\n <sp-accordion-item disabled label=\"Heading 2\">\n <div>Item 2</div>\n </sp-accordion-item>\n </sp-accordion>\n `\n );\n\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n\n el.focus();\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n });\n it('only allows one open item by default', async () => {\n const el = await fixture<Accordion>(Default());\n await elementUpdated(el);\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n let openItems = el.querySelectorAll('sp-accordion-item[open]');\n expect(openItems.length).to.equal(1);\n\n secondButton.click();\n await elementUpdated(el);\n openItems = el.querySelectorAll('sp-accordion-item[open]');\n expect(openItems.length).to.equal(1);\n });\n it('can have `toggle` events canceled', async () => {\n const el = await fixture<Accordion>(Default());\n await elementUpdated(el);\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n el.addEventListener('sp-accordion-item-toggle', (event: Event) =>\n event.preventDefault()\n );\n\n secondButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n });\n it('allows more than one open item when `[allow-multiple]`', async () => {\n const el = await fixture<Accordion>(Default());\n el.allowMultiple = true;\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n secondButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.true;\n });\n it('ensures that the correct item is open and that items can be closed', async () => {\n const el = await fixture<Accordion>(Default());\n\n await elementUpdated(el);\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n secondButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.false;\n expect(secondItem.open).to.be.true;\n\n secondButton.click();\n await elementUpdated(el);\n expect(firstItem.open).to.be.false;\n expect(secondItem.open).to.be.false;\n });\n\n it('ensures that the correct item is open and that items can be closed when [allow-multiple]', async () => {\n const el = await fixture<Accordion>(Default());\n el.allowMultiple = true;\n await elementUpdated(el);\n\n const firstItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(1)'\n ) as AccordionItem;\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n\n const firstButton = firstItem.focusElement;\n const secondButton = secondItem.focusElement;\n\n firstButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n\n secondButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.true;\n\n secondButton.click();\n await elementUpdated(el);\n\n expect(firstItem.open).to.be.true;\n expect(secondItem.open).to.be.false;\n });\n it('handles focus and keyboard input and ignores disabled items', async () => {\n const el = await fixture<Accordion>(\n html`\n <sp-accordion allow-multiple>\n <sp-accordion-item disabled label=\"Heading 1\">\n <div>Item 1</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 2\">\n <div>Item 2</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 3\">\n <div>Item 3</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 4\">\n <div>Item 4</div>\n </sp-accordion-item>\n <sp-accordion-item label=\"Heading 5\">\n <div>Item 5</div>\n </sp-accordion-item>\n <sp-accordion-item disabled label=\"Heading 6\">\n <div>Item 6</div>\n </sp-accordion-item>\n </sp-accordion>\n `\n );\n\n await elementUpdated(el);\n\n const secondItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(2)'\n ) as AccordionItem;\n const thirdItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(3)'\n ) as AccordionItem;\n const fourthItem = el.querySelector(\n 'sp-accordion-item:nth-of-type(4)'\n ) as AccordionItem;\n const isSafari = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent\n );\n const tab = isSafari ? 'Alt+Tab' : 'Tab';\n const shiftTab = isSafari ? 'Alt+Shift+Tab' : 'Shift+Tab';\n\n el.focus();\n\n await elementUpdated(el);\n expect(document.activeElement === secondItem).to.be.true;\n\n await sendKeys({\n press: tab,\n });\n\n expect(document.activeElement === thirdItem).to.be.true;\n\n await sendKeys({\n press: tab,\n });\n\n expect(document.activeElement === fourthItem).to.be.true;\n\n await sendKeys({\n press: shiftTab,\n });\n await sendKeys({\n press: shiftTab,\n });\n\n expect(document.activeElement === secondItem).to.be.true;\n\n document.body.focus();\n\n el.focus();\n expect(document.activeElement === secondItem).to.be.true;\n\n await sendKeys({\n press: shiftTab,\n });\n await elementUpdated(el);\n\n const outsideFocused = document.activeElement as HTMLElement;\n\n expect(typeof outsideFocused).not.to.equal(AccordionItem);\n expect(typeof outsideFocused).not.to.equal(Accordion);\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAYA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,OAAO;AACP,SAAS,eAAe;AACxB,SAAS,WAAW,qBAAqB;AACzC,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAEtC,SAAS,aAAa,MAAM;AACxB,wBAAsB,YAAY,MAAM,QAAmB,QAAQ,CAAC,CAAC;AACrE,KAAG,iCAAiC,YAAY;AAC5C,UAAM,KAAK,MAAM,QAAmB,QAAQ,CAAC;AAE7C,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,oCAAoC,YAAY;AAC/C,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,kBAAkB,EAAE,EAAE,GAAG,GAAG;AAE5C,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,SAAS,kBAAkB,EAAE,EAAE,GAAG,GAAG;AAAA,EAChD,CAAC;AACD,KAAG,qBAAqB,YAAY;AAChC,UAAM,KAAK,MAAM;AAAA,MACb,gBAAgB;AAAA,QACZ,MAAM;AAAA,MACV,CAAC;AAAA,IACL;AACA,UAAM,OAAO,GAAG,cAAc,mBAAmB;AACjD,WAAO,GAAG,IAAI,EAAE,GAAG,MAAM,GAAG;AAC5B,WAAO,KAAK,IAAI,EAAE,GAAG,MAAM,GAAG;AAE9B,OAAG,OAAO;AACV,UAAM,eAAe,EAAE;AACvB,UAAM,eAAe,IAAI;AACzB,WAAO,GAAG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