@spectrum-web-components/swatch 0.2.0-devmode.0 → 0.2.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 +7 -7
- package/sp-swatch-group.js +1 -2
- package/sp-swatch-group.js.map +1 -1
- package/sp-swatch.js +1 -2
- package/sp-swatch.js.map +1 -1
- package/src/Swatch.js +9 -183
- package/src/Swatch.js.map +1 -1
- package/src/SwatchGroup.js +2 -215
- package/src/SwatchGroup.js.map +1 -1
- package/src/index.js +1 -2
- package/src/index.js.map +1 -1
- package/src/spectrum-swatch-group.css.js +2 -4
- package/src/spectrum-swatch-group.css.js.map +1 -1
- package/src/spectrum-swatch.css.js +2 -4
- package/src/spectrum-swatch.css.js.map +1 -1
- package/src/swatch-group.css.js +2 -4
- package/src/swatch-group.css.js.map +1 -1
- package/src/swatch.css.js +2 -4
- package/src/swatch.css.js.map +1 -1
- package/stories/swatch-group.stories.js +16 -166
- package/stories/swatch-group.stories.js.map +1 -1
- package/stories/swatch-sizes.stories.js +12 -27
- package/stories/swatch-sizes.stories.js.map +1 -1
- package/stories/swatch.stories.js +8 -97
- package/stories/swatch.stories.js.map +1 -1
- package/test/benchmark/basic-test.js +1 -4
- package/test/benchmark/basic-test.js.map +1 -1
- package/test/swatch-group.test-vrt.js +1 -3
- package/test/swatch-group.test-vrt.js.map +1 -1
- package/test/swatch-group.test.js +4 -234
- package/test/swatch-group.test.js.map +1 -1
- package/test/swatch-sizes.test-vrt.js +1 -3
- package/test/swatch-sizes.test-vrt.js.map +1 -1
- package/test/swatch.test-vrt.js +1 -3
- package/test/swatch.test-vrt.js.map +1 -1
- package/test/swatch.test.js +3 -138
- package/test/swatch.test.js.map +1 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch.stories.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../sp-swatch.js';\nimport type {\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from '../src/Swatch.js';\n\ntype Properties = {\n color: string;\n border: SwatchBorder | 'normal';\n rounding: SwatchRounding | 'normal';\n shape: SwatchShape | 'normal';\n mixedValue?: boolean;\n nothing?: boolean;\n};\n\nexport default {\n title: 'Swatch',\n component: 'sp-swatch',\n args: {\n color: '#ff0000',\n },\n argTypes: {\n color: { control: 'color' },\n border: {\n name: 'border',\n type: { name: 'string', required: false },\n description: 'The border to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'light', 'none'],\n },\n },\n rounding: {\n name: 'rounding',\n type: { name: 'string', required: false },\n description: 'The rounding to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'none', 'full'],\n },\n },\n shape: {\n name: 'shape',\n type: { name: 'string', required: false },\n description: 'The shape to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'rectangle'],\n },\n },\n },\n};\n\nconst template = ({\n color,\n border,\n rounding,\n shape,\n mixedValue,\n nothing,\n}: Properties): TemplateResult => {\n return html`\n <sp-swatch\n border=${ifDefined(border === 'normal' ? undefined : border)}\n rounding=${ifDefined(rounding === 'normal' ? undefined : rounding)}\n shape=${ifDefined(shape === 'normal' ? undefined : shape)}\n color=${color}\n ?mixed-value=${mixedValue}\n ?nothing=${nothing}\n ></sp-swatch>\n `;\n};\n\nexport const Default = (args: Properties): TemplateResult => template(args);\nexport const mixedValue = (args: Properties): TemplateResult => template(args);\nmixedValue.args = {\n mixedValue: true,\n color: '',\n};\nexport const nothing = (args: Properties): TemplateResult => template(args);\nnothing.args = {\n nothing: true,\n color: '',\n};\nexport const borderLight = (args: Properties): TemplateResult => template(args);\nborderLight.args = {\n border: 'light',\n};\nexport const borderNone = (args: Properties): TemplateResult => template(args);\nborderNone.args = {\n border: 'none',\n};\nexport const roundingNone = (args: Properties): TemplateResult =>\n template(args);\nroundingNone.args = {\n rounding: 'none',\n};\nexport const roundingFull = (args: Properties): TemplateResult =>\n template(args);\nroundingFull.args = {\n rounding: 'full',\n};\nexport const shapeRectangle = (args: Properties): TemplateResult =>\n template(args);\nshapeRectangle.args = {\n shape: 'rectangle',\n};\n"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,qDACA,4EAEA,wBAgBA,cAAe,CACX,MAAO,SACP,UAAW,YACX,KAAM,CACF,MAAO,SACX,EACA,SAAU,CACN,MAAO,CAAE,QAAS,OAAQ,EAC1B,OAAQ,CACJ,KAAM,SACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,8CACb,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,SAAU,QAAS,MAAM,CACvC,CACJ,EACA,SAAU,CACN,KAAM,WACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,gDACb,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,SAAU,OAAQ,MAAM,CACtC,CACJ,EACA,MAAO,CACH,KAAM,QACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,6CACb,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,SAAU,WAAW,CACnC,CACJ,CACJ,CACJ,EAEA,KAAM,GAAW,CAAC,CACd,QACA,SACA,WACA,QACA,aACA,aAEO;AAAA;AAAA,qBAEU,EAAU,IAAW,SAAW,OAAY,CAAM;AAAA,uBAChD,EAAU,IAAa,SAAW,OAAY,CAAQ;AAAA,oBACzD,EAAU,IAAU,SAAW,OAAY,CAAK;AAAA,oBAChD;AAAA,2BACO;AAAA,uBACJ;AAAA;AAAA,MAKhB,YAAM,SAAU,AAAC,GAAqC,EAAS,CAAI,EAC7D,WAAa,AAAC,GAAqC,EAAS,CAAI,EAC7E,WAAW,KAAO,CACd,WAAY,GACZ,MAAO,EACX,EACO,YAAM,SAAU,AAAC,GAAqC,EAAS,CAAI,EAC1E,QAAQ,KAAO,CACX,QAAS,GACT,MAAO,EACX,EACO,YAAM,aAAc,AAAC,GAAqC,EAAS,CAAI,EAC9E,YAAY,KAAO,CACf,OAAQ,OACZ,EACO,YAAM,YAAa,AAAC,GAAqC,EAAS,CAAI,EAC7E,WAAW,KAAO,CACd,OAAQ,MACZ,EACO,YAAM,cAAe,AAAC,GACzB,EAAS,CAAI,EACjB,aAAa,KAAO,CAChB,SAAU,MACd,EACO,YAAM,cAAe,AAAC,GACzB,EAAS,CAAI,EACjB,aAAa,KAAO,CAChB,SAAU,MACd,EACO,YAAM,gBAAiB,AAAC,GAC3B,EAAS,CAAI,EACjB,eAAe,KAAO,CAClB,MAAO,WACX",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { html } from "@spectrum-web-components/base";
|
|
3
|
-
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
4
|
-
measureFixtureCreation(html`
|
|
1
|
+
import"@spectrum-web-components/swatch/sp-swatch.js";import{html as r}from"@spectrum-web-components/base";import{measureFixtureCreation as t}from"../../../../test/benchmark/helpers.js";t(r`
|
|
5
2
|
<sp-swatch></sp-swatch>
|
|
6
3
|
`);
|
|
7
4
|
//# sourceMappingURL=basic-test.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["basic-test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/swatch/sp-swatch.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-swatch></sp-swatch>\n`);\n"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,qDACA,qDACA,+EAEA,EAAuB;AAAA;AAAA,CAEtB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
-
regressVisuals("SwatchGroupStories", stories);
|
|
1
|
+
import*as r from"../stories/swatch-group.stories.js";import{regressVisuals as s}from"../../../test/visual/test.js";s("SwatchGroupStories",r);
|
|
4
2
|
//# sourceMappingURL=swatch-group.test-vrt.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch-group.test-vrt.ts"],
|
|
4
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/swatch-group.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('SwatchGroupStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,qDACA,8DAEA,EAAe,qBAAsB,CAAO",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,253 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { sendKeys } from "@web/test-runner-commands";
|
|
3
|
-
import "../sp-swatch.js";
|
|
4
|
-
import { Default } from "../stories/swatch-group.stories.js";
|
|
5
|
-
import { spy } from "sinon";
|
|
6
|
-
import { html } from "@spectrum-web-components/base";
|
|
7
|
-
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
8
|
-
describe("Swatch Group", () => {
|
|
9
|
-
let el;
|
|
10
|
-
beforeEach(async () => {
|
|
11
|
-
el = await fixture(Default(Default.args));
|
|
12
|
-
await elementUpdated(el);
|
|
13
|
-
});
|
|
14
|
-
testForLitDevWarnings(async () => await fixture(Default(Default.args)));
|
|
15
|
-
it("loads default swatch accessibly", async () => {
|
|
16
|
-
await expect(el).to.be.accessible();
|
|
17
|
-
});
|
|
18
|
-
it("forwards `border` to children", async () => {
|
|
19
|
-
el.border = "light";
|
|
20
|
-
await elementUpdated(el);
|
|
21
|
-
[...el.children].forEach((child) => {
|
|
22
|
-
expect(child.border).to.equal("light");
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
it("forwards `rounding` to children", async () => {
|
|
26
|
-
el.rounding = "full";
|
|
27
|
-
await elementUpdated(el);
|
|
28
|
-
[...el.children].forEach((child) => {
|
|
29
|
-
expect(child.rounding).to.equal("full");
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
it("forwards `size` to children", async () => {
|
|
33
|
-
el.size = "xs";
|
|
34
|
-
await elementUpdated(el);
|
|
35
|
-
[...el.children].forEach((child) => {
|
|
36
|
-
expect(child.size).to.equal("xs");
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
it("forwards `shape` to children", async () => {
|
|
40
|
-
el.shape = "rectangle";
|
|
41
|
-
await elementUpdated(el);
|
|
42
|
-
[...el.children].forEach((child) => {
|
|
43
|
-
expect(child.shape).to.equal("rectangle");
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
it("unsets forwarding", async () => {
|
|
47
|
-
el.border = "light";
|
|
48
|
-
el.rounding = "full";
|
|
49
|
-
el.size = "xs";
|
|
50
|
-
el.shape = "rectangle";
|
|
51
|
-
await elementUpdated(el);
|
|
52
|
-
[...el.children].forEach((child) => {
|
|
53
|
-
expect(child.border).to.not.be.undefined;
|
|
54
|
-
expect(child.rounding).to.not.be.undefined;
|
|
55
|
-
expect(child.size).to.not.equal("m");
|
|
56
|
-
expect(child.shape).to.not.be.undefined;
|
|
57
|
-
});
|
|
58
|
-
el.border = void 0;
|
|
59
|
-
el.rounding = void 0;
|
|
60
|
-
el.removeAttribute("size");
|
|
61
|
-
el.shape = void 0;
|
|
62
|
-
await elementUpdated(el);
|
|
63
|
-
[...el.children].forEach((child) => {
|
|
64
|
-
expect(child.border).to.equal(void 0);
|
|
65
|
-
expect(child.rounding).to.equal(void 0);
|
|
66
|
-
expect(child.size).to.equal("m");
|
|
67
|
-
expect(child.shape).to.equal(void 0);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
it("does not dispatch `change` events without `selects` attribute", async () => {
|
|
71
|
-
const selectedChild = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
72
|
-
const changeSpy = spy();
|
|
73
|
-
el.addEventListener("change", () => changeSpy());
|
|
74
|
-
expect(el.selected).to.deep.equal([]);
|
|
75
|
-
selectedChild.click();
|
|
76
|
-
expect(changeSpy.called).to.be.false;
|
|
77
|
-
expect(el.selected).to.deep.equal([]);
|
|
78
|
-
});
|
|
79
|
-
it('dispatches `change` events as [selects="single"]', async () => {
|
|
80
|
-
el.selects = "single";
|
|
81
|
-
const selectedChild = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
82
|
-
const changeSpy = spy();
|
|
83
|
-
el.addEventListener("change", () => changeSpy());
|
|
84
|
-
expect(el.selected).to.deep.equal([]);
|
|
85
|
-
expect(selectedChild.selected).to.be.false;
|
|
86
|
-
selectedChild.click();
|
|
87
|
-
expect(changeSpy.calledOnce).to.be.true;
|
|
88
|
-
expect(el.selected).to.deep.equal([selectedChild.value]);
|
|
89
|
-
expect(selectedChild.selected).to.be.true;
|
|
90
|
-
});
|
|
91
|
-
it("can have `change` events prevented", async () => {
|
|
92
|
-
el.selects = "single";
|
|
93
|
-
const selectedChild = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
94
|
-
el.addEventListener("change", (event) => event.preventDefault());
|
|
95
|
-
expect(el.selected).to.deep.equal([]);
|
|
96
|
-
expect(selectedChild.selected).to.be.false;
|
|
97
|
-
selectedChild.click();
|
|
98
|
-
expect(el.selected).to.deep.equal([]);
|
|
99
|
-
expect(selectedChild.selected).to.be.false;
|
|
100
|
-
});
|
|
101
|
-
it('dispatches `change` events as [selects="multiple"]', async () => {
|
|
102
|
-
el.selects = "multiple";
|
|
103
|
-
const selectedChild0 = el.querySelector(":scope > sp-swatch:nth-child(1)");
|
|
104
|
-
const selectedChild1 = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
105
|
-
const selectedChild2 = el.querySelector(":scope > sp-swatch:nth-child(6)");
|
|
106
|
-
await elementUpdated(selectedChild0);
|
|
107
|
-
const changeSpy = spy();
|
|
108
|
-
el.addEventListener("change", () => changeSpy());
|
|
109
|
-
expect(el.selected).to.deep.equal([]);
|
|
110
|
-
selectedChild0.click();
|
|
111
|
-
selectedChild1.click();
|
|
112
|
-
selectedChild2.click();
|
|
113
|
-
expect(changeSpy.callCount).to.equal(3);
|
|
114
|
-
expect(el.selected).to.deep.equal([
|
|
115
|
-
selectedChild0.value,
|
|
116
|
-
selectedChild1.value,
|
|
117
|
-
selectedChild2.value
|
|
118
|
-
]);
|
|
119
|
-
});
|
|
120
|
-
it("filters `selected` when a selected Swatch is removed from the DOM", async () => {
|
|
121
|
-
el.selects = "multiple";
|
|
122
|
-
const selectedChild0 = el.querySelector(":scope > sp-swatch:nth-child(1)");
|
|
123
|
-
const selectedChild1 = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
124
|
-
const selectedChild2 = el.querySelector(":scope > sp-swatch:nth-child(6)");
|
|
125
|
-
await elementUpdated(selectedChild0);
|
|
126
|
-
expect(el.selected).to.deep.equal([]);
|
|
127
|
-
selectedChild0.click();
|
|
128
|
-
selectedChild1.click();
|
|
129
|
-
selectedChild2.click();
|
|
130
|
-
expect(el.selected).to.deep.equal([
|
|
131
|
-
selectedChild0.value,
|
|
132
|
-
selectedChild1.value,
|
|
133
|
-
selectedChild2.value
|
|
134
|
-
]);
|
|
135
|
-
selectedChild0.remove();
|
|
136
|
-
await elementUpdated(el);
|
|
137
|
-
expect(el.selected).to.deep.equal([
|
|
138
|
-
selectedChild1.value,
|
|
139
|
-
selectedChild2.value
|
|
140
|
-
]);
|
|
141
|
-
selectedChild2.remove();
|
|
142
|
-
await elementUpdated(el);
|
|
143
|
-
expect(el.selected).to.deep.equal([selectedChild1.value]);
|
|
144
|
-
selectedChild1.remove();
|
|
145
|
-
await elementUpdated(el);
|
|
146
|
-
expect(el.selected).to.deep.equal([]);
|
|
147
|
-
});
|
|
148
|
-
it("maintains a single tab stop", async () => {
|
|
149
|
-
const inputBefore = document.createElement("input");
|
|
150
|
-
const inputAfter = document.createElement("input");
|
|
151
|
-
el.insertAdjacentElement("beforebegin", inputBefore);
|
|
152
|
-
el.insertAdjacentElement("afterend", inputAfter);
|
|
153
|
-
inputBefore.focus();
|
|
154
|
-
expect(document.activeElement === el.children[0]).to.be.false;
|
|
155
|
-
await sendKeys({
|
|
156
|
-
press: "Tab"
|
|
157
|
-
});
|
|
158
|
-
expect(document.activeElement === el.children[0]).to.be.true;
|
|
159
|
-
await sendKeys({
|
|
160
|
-
press: "Tab"
|
|
161
|
-
});
|
|
162
|
-
expect(document.activeElement === el.children[0]).to.be.false;
|
|
163
|
-
await sendKeys({
|
|
164
|
-
press: "Shift+Tab"
|
|
165
|
-
});
|
|
166
|
-
expect(document.activeElement === el.children[0]).to.be.true;
|
|
167
|
-
});
|
|
168
|
-
it("makes the first selected child the single tab stop", async () => {
|
|
169
|
-
const selectedChild = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
170
|
-
expect(selectedChild.selected).to.be.false;
|
|
171
|
-
const inputBefore = document.createElement("input");
|
|
172
|
-
const inputAfter = document.createElement("input");
|
|
173
|
-
el.insertAdjacentElement("beforebegin", inputBefore);
|
|
174
|
-
el.insertAdjacentElement("afterend", inputAfter);
|
|
175
|
-
inputBefore.focus();
|
|
176
|
-
el.selects = "single";
|
|
177
|
-
el.selected = [selectedChild.value];
|
|
178
|
-
await elementUpdated(el);
|
|
179
|
-
await nextFrame();
|
|
180
|
-
expect(selectedChild.selected).to.be.true;
|
|
181
|
-
expect(document.activeElement === selectedChild).to.be.false;
|
|
182
|
-
await sendKeys({
|
|
183
|
-
press: "Tab"
|
|
184
|
-
});
|
|
185
|
-
expect(document.activeElement === selectedChild).to.be.true;
|
|
186
|
-
await sendKeys({
|
|
187
|
-
press: "Tab"
|
|
188
|
-
});
|
|
189
|
-
expect(document.activeElement === selectedChild).to.be.false;
|
|
190
|
-
await sendKeys({
|
|
191
|
-
press: "Shift+Tab"
|
|
192
|
-
});
|
|
193
|
-
expect(document.activeElement === selectedChild).to.be.true;
|
|
194
|
-
});
|
|
195
|
-
it("focus()es to the first Swatch", async () => {
|
|
196
|
-
el.focus();
|
|
197
|
-
expect(document.activeElement === el.children[0]).to.be.true;
|
|
198
|
-
});
|
|
199
|
-
it("focus()es to the first selected Swatch", async () => {
|
|
200
|
-
const selectedChild = el.querySelector(":scope > sp-swatch:nth-child(4)");
|
|
201
|
-
expect(selectedChild.selected).to.be.false;
|
|
202
|
-
el.selects = "single";
|
|
203
|
-
el.selected = [selectedChild.value];
|
|
204
|
-
await elementUpdated(el);
|
|
205
|
-
await nextFrame();
|
|
206
|
-
expect(selectedChild.selected).to.be.true;
|
|
207
|
-
el.focus();
|
|
208
|
-
expect(document.activeElement === selectedChild).to.be.true;
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
describe("Swatch Group - DOM selected", () => {
|
|
212
|
-
it("accepts selection from DOM", async () => {
|
|
213
|
-
const el = await fixture(html`
|
|
1
|
+
import{elementUpdated as a,expect as c,fixture as n,nextFrame as u}from"@open-wc/testing";import{sendKeys as o}from"@web/test-runner-commands";import"../sp-swatch.js";import{Default as r}from"../stories/swatch-group.stories.js";import{spy as i}from"sinon";import{html as d}from"@spectrum-web-components/base";import{testForLitDevWarnings as p}from"../../../test/testing-helpers.js";describe("Swatch Group",()=>{let e;beforeEach(async()=>{e=await n(r(r.args)),await a(e)}),p(async()=>await n(r(r.args))),it("loads default swatch accessibly",async()=>{await c(e).to.be.accessible()}),it("forwards `border` to children",async()=>{e.border="light",await a(e),[...e.children].forEach(t=>{c(t.border).to.equal("light")})}),it("forwards `rounding` to children",async()=>{e.rounding="full",await a(e),[...e.children].forEach(t=>{c(t.rounding).to.equal("full")})}),it("forwards `size` to children",async()=>{e.size="xs",await a(e),[...e.children].forEach(t=>{c(t.size).to.equal("xs")})}),it("forwards `shape` to children",async()=>{e.shape="rectangle",await a(e),[...e.children].forEach(t=>{c(t.shape).to.equal("rectangle")})}),it("unsets forwarding",async()=>{e.border="light",e.rounding="full",e.size="xs",e.shape="rectangle",await a(e),[...e.children].forEach(t=>{c(t.border).to.not.be.undefined,c(t.rounding).to.not.be.undefined,c(t.size).to.not.equal("m"),c(t.shape).to.not.be.undefined}),e.border=void 0,e.rounding=void 0,e.removeAttribute("size"),e.shape=void 0,await a(e),[...e.children].forEach(t=>{c(t.border).to.equal(void 0),c(t.rounding).to.equal(void 0),c(t.size).to.equal("m"),c(t.shape).to.equal(void 0)})}),it("does not dispatch `change` events without `selects` attribute",async()=>{const t=e.querySelector(":scope > sp-swatch:nth-child(4)"),s=i();e.addEventListener("change",()=>s()),c(e.selected).to.deep.equal([]),t.click(),c(s.called).to.be.false,c(e.selected).to.deep.equal([])}),it('dispatches `change` events as [selects="single"]',async()=>{e.selects="single";const t=e.querySelector(":scope > sp-swatch:nth-child(4)"),s=i();e.addEventListener("change",()=>s()),c(e.selected).to.deep.equal([]),c(t.selected).to.be.false,t.click(),c(s.calledOnce).to.be.true,c(e.selected).to.deep.equal([t.value]),c(t.selected).to.be.true}),it("can have `change` events prevented",async()=>{e.selects="single";const t=e.querySelector(":scope > sp-swatch:nth-child(4)");e.addEventListener("change",s=>s.preventDefault()),c(e.selected).to.deep.equal([]),c(t.selected).to.be.false,t.click(),c(e.selected).to.deep.equal([]),c(t.selected).to.be.false}),it('dispatches `change` events as [selects="multiple"]',async()=>{e.selects="multiple";const t=e.querySelector(":scope > sp-swatch:nth-child(1)"),s=e.querySelector(":scope > sp-swatch:nth-child(4)"),l=e.querySelector(":scope > sp-swatch:nth-child(6)");await a(t);const h=i();e.addEventListener("change",()=>h()),c(e.selected).to.deep.equal([]),t.click(),s.click(),l.click(),c(h.callCount).to.equal(3),c(e.selected).to.deep.equal([t.value,s.value,l.value])}),it("filters `selected` when a selected Swatch is removed from the DOM",async()=>{e.selects="multiple";const t=e.querySelector(":scope > sp-swatch:nth-child(1)"),s=e.querySelector(":scope > sp-swatch:nth-child(4)"),l=e.querySelector(":scope > sp-swatch:nth-child(6)");await a(t),c(e.selected).to.deep.equal([]),t.click(),s.click(),l.click(),c(e.selected).to.deep.equal([t.value,s.value,l.value]),t.remove(),await a(e),c(e.selected).to.deep.equal([s.value,l.value]),l.remove(),await a(e),c(e.selected).to.deep.equal([s.value]),s.remove(),await a(e),c(e.selected).to.deep.equal([])}),it("maintains a single tab stop",async()=>{const t=document.createElement("input"),s=document.createElement("input");e.insertAdjacentElement("beforebegin",t),e.insertAdjacentElement("afterend",s),t.focus(),c(document.activeElement===e.children[0]).to.be.false,await o({press:"Tab"}),c(document.activeElement===e.children[0]).to.be.true,await o({press:"Tab"}),c(document.activeElement===e.children[0]).to.be.false,await o({press:"Shift+Tab"}),c(document.activeElement===e.children[0]).to.be.true}),it("makes the first selected child the single tab stop",async()=>{const t=e.querySelector(":scope > sp-swatch:nth-child(4)");c(t.selected).to.be.false;const s=document.createElement("input"),l=document.createElement("input");e.insertAdjacentElement("beforebegin",s),e.insertAdjacentElement("afterend",l),s.focus(),e.selects="single",e.selected=[t.value],await a(e),await u(),c(t.selected).to.be.true,c(document.activeElement===t).to.be.false,await o({press:"Tab"}),c(document.activeElement===t).to.be.true,await o({press:"Tab"}),c(document.activeElement===t).to.be.false,await o({press:"Shift+Tab"}),c(document.activeElement===t).to.be.true}),it("focus()es to the first Swatch",async()=>{e.focus(),c(document.activeElement===e.children[0]).to.be.true}),it("focus()es to the first selected Swatch",async()=>{const t=e.querySelector(":scope > sp-swatch:nth-child(4)");c(t.selected).to.be.false,e.selects="single",e.selected=[t.value],await a(e),await u(),c(t.selected).to.be.true,e.focus(),c(document.activeElement===t).to.be.true})}),describe("Swatch Group - DOM selected",()=>{it("accepts selection from DOM",async()=>{const e=await n(d`
|
|
214
2
|
<sp-swatch-group selects="multiple">
|
|
215
3
|
<sp-swatch value="color-0" color="red"></sp-swatch>
|
|
216
4
|
<sp-swatch value="color-1" color="green" selected></sp-swatch>
|
|
217
5
|
<sp-swatch value="color-2" color="blue"></sp-swatch>
|
|
218
6
|
<sp-swatch value="color-3" color="yellow" selected></sp-swatch>
|
|
219
7
|
</sp-swatch-group>
|
|
220
|
-
`);
|
|
221
|
-
await elementUpdated(el);
|
|
222
|
-
expect(el.selected).to.deep.equal(["color-1", "color-3"]);
|
|
223
|
-
});
|
|
224
|
-
it("merges `selected` and selection from DOM", async () => {
|
|
225
|
-
const el = await fixture(html`
|
|
8
|
+
`);await a(e),c(e.selected).to.deep.equal(["color-1","color-3"])}),it("merges `selected` and selection from DOM",async()=>{const e=await n(d`
|
|
226
9
|
<sp-swatch-group selects="multiple" .selected=${["color-1"]}>
|
|
227
10
|
<sp-swatch value="color-0" color="red"></sp-swatch>
|
|
228
11
|
<sp-swatch value="color-1" color="green"></sp-swatch>
|
|
229
12
|
<sp-swatch value="color-2" color="blue"></sp-swatch>
|
|
230
13
|
<sp-swatch value="color-3" color="yellow" selected></sp-swatch>
|
|
231
14
|
</sp-swatch-group>
|
|
232
|
-
`);
|
|
233
|
-
await elementUpdated(el);
|
|
234
|
-
expect(el.selected).to.deep.equal(["color-1", "color-3"]);
|
|
235
|
-
});
|
|
236
|
-
it("lazily accepts selection from DOM", async () => {
|
|
237
|
-
const el = await fixture(html`
|
|
15
|
+
`);await a(e),c(e.selected).to.deep.equal(["color-1","color-3"])}),it("lazily accepts selection from DOM",async()=>{const e=await n(d`
|
|
238
16
|
<sp-swatch-group selects="multiple">
|
|
239
17
|
<sp-swatch value="color-0" color="red"></sp-swatch>
|
|
240
18
|
<sp-swatch value="color-1" color="green"></sp-swatch>
|
|
241
19
|
<sp-swatch value="color-2" color="blue"></sp-swatch>
|
|
242
20
|
<sp-swatch value="color-3" color="yellow" selected></sp-swatch>
|
|
243
21
|
</sp-swatch-group>
|
|
244
|
-
`);
|
|
245
|
-
await elementUpdated(el);
|
|
246
|
-
const color1 = el.querySelector('[value="color-1"]');
|
|
247
|
-
expect(el.selected).to.deep.equal(["color-3"]);
|
|
248
|
-
color1.selected = true;
|
|
249
|
-
await elementUpdated(el);
|
|
250
|
-
expect(el.selected).to.deep.equal(["color-3", "color-1"]);
|
|
251
|
-
});
|
|
252
|
-
});
|
|
22
|
+
`);await a(e);const t=e.querySelector('[value="color-1"]');c(e.selected).to.deep.equal(["color-3"]),t.selected=!0,await a(e),c(e.selected).to.deep.equal(["color-3","color-1"])})});
|
|
253
23
|
//# sourceMappingURL=swatch-group.test.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch-group.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 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, nextFrame } from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport '../sp-swatch.js';\nimport { Swatch, SwatchGroup } from '../';\nimport { Default } from '../stories/swatch-group.stories.js';\nimport { spy } from 'sinon';\nimport { html } from '@spectrum-web-components/base';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Swatch Group', () => {\n let el: SwatchGroup;\n beforeEach(async () => {\n el = await fixture<SwatchGroup>(Default(Default.args));\n\n await elementUpdated(el);\n });\n testForLitDevWarnings(\n async () => await fixture<SwatchGroup>(Default(Default.args))\n );\n it('loads default swatch accessibly', async () => {\n await expect(el).to.be.accessible();\n });\n it('forwards `border` to children', async () => {\n el.border = 'light';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.equal('light');\n });\n });\n it('forwards `rounding` to children', async () => {\n el.rounding = 'full';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.rounding).to.equal('full');\n });\n });\n it('forwards `size` to children', async () => {\n el.size = 'xs';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.size).to.equal('xs');\n });\n });\n it('forwards `shape` to children', async () => {\n el.shape = 'rectangle';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.shape).to.equal('rectangle');\n });\n });\n it('unsets forwarding', async () => {\n el.border = 'light';\n el.rounding = 'full';\n el.size = 'xs';\n el.shape = 'rectangle';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.not.be.undefined;\n expect(child.rounding).to.not.be.undefined;\n expect(child.size).to.not.equal('m');\n expect(child.shape).to.not.be.undefined;\n });\n\n el.border = undefined;\n el.rounding = undefined;\n el.removeAttribute('size');\n el.shape = undefined;\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.equal(undefined);\n expect(child.rounding).to.equal(undefined);\n expect(child.size).to.equal('m');\n expect(child.shape).to.equal(undefined);\n });\n });\n it('does not dispatch `change` events without `selects` attribute', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild.click();\n\n expect(changeSpy.called).to.be.false;\n expect(el.selected).to.deep.equal([]);\n });\n it('dispatches `change` events as [selects=\"single\"]', async () => {\n el.selects = 'single';\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n\n selectedChild.click();\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(el.selected).to.deep.equal([selectedChild.value]);\n expect(selectedChild.selected).to.be.true;\n });\n it('can have `change` events prevented', async () => {\n el.selects = 'single';\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n\n selectedChild.click();\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n });\n it('dispatches `change` events as [selects=\"multiple\"]', async () => {\n el.selects = 'multiple';\n const selectedChild0 = el.querySelector(\n ':scope > sp-swatch:nth-child(1)'\n ) as Swatch;\n const selectedChild1 = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n const selectedChild2 = el.querySelector(\n ':scope > sp-swatch:nth-child(6)'\n ) as Swatch;\n\n await elementUpdated(selectedChild0);\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild0.click();\n selectedChild1.click();\n selectedChild2.click();\n\n expect(changeSpy.callCount).to.equal(3);\n expect(el.selected).to.deep.equal([\n selectedChild0.value,\n selectedChild1.value,\n selectedChild2.value,\n ]);\n });\n it('filters `selected` when a selected Swatch is removed from the DOM', async () => {\n el.selects = 'multiple';\n const selectedChild0 = el.querySelector(\n ':scope > sp-swatch:nth-child(1)'\n ) as Swatch;\n const selectedChild1 = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n const selectedChild2 = el.querySelector(\n ':scope > sp-swatch:nth-child(6)'\n ) as Swatch;\n\n await elementUpdated(selectedChild0);\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild0.click();\n selectedChild1.click();\n selectedChild2.click();\n\n expect(el.selected).to.deep.equal([\n selectedChild0.value,\n selectedChild1.value,\n selectedChild2.value,\n ]);\n\n selectedChild0.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([\n selectedChild1.value,\n selectedChild2.value,\n ]);\n\n selectedChild2.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([selectedChild1.value]);\n\n selectedChild1.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([]);\n });\n it('maintains a single tab stop', async () => {\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n expect(document.activeElement === el.children[0]).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.true;\n });\n it('makes the first selected child the single tab stop', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n expect(selectedChild.selected).to.be.false;\n\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n el.selects = 'single';\n el.selected = [selectedChild.value];\n await elementUpdated(el);\n await nextFrame();\n\n expect(selectedChild.selected).to.be.true;\n\n expect(document.activeElement === selectedChild).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === selectedChild).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === selectedChild).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === selectedChild).to.be.true;\n });\n it('focus()es to the first Swatch', async () => {\n el.focus();\n expect(document.activeElement === el.children[0]).to.be.true;\n });\n it('focus()es to the first selected Swatch', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n expect(selectedChild.selected).to.be.false;\n el.selects = 'single';\n el.selected = [selectedChild.value];\n await elementUpdated(el);\n await nextFrame();\n\n expect(selectedChild.selected).to.be.true;\n el.focus();\n expect(document.activeElement === selectedChild).to.be.true;\n });\n});\n\ndescribe('Swatch Group - DOM selected', () => {\n it('accepts selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\">\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\" selected></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-1', 'color-3']);\n });\n it('merges `selected` and selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\" .selected=${['color-1']}>\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-1', 'color-3']);\n });\n it('lazily accepts selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\">\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n const color1 = el.querySelector('[value=\"color-1\"]') as Swatch;\n\n expect(el.selected).to.deep.equal(['color-3']);\n\n color1.selected = true;\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-3', 'color-1']);\n });\n});\n"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,0FACA,qDAEA,wBAEA,6DACA,4BACA,qDACA,yEAEA,SAAS,eAAgB,IAAM,CAC3B,GAAI,GACJ,WAAW,SAAY,CACnB,EAAK,KAAM,GAAqB,EAAQ,EAAQ,IAAI,CAAC,EAErD,KAAM,GAAe,CAAE,CAC3B,CAAC,EACD,EACI,SAAY,KAAM,GAAqB,EAAQ,EAAQ,IAAI,CAAC,CAChE,EACA,GAAG,kCAAmC,SAAY,CAC9C,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B,EAAO,EAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,UAAW,SAAS,CAAC,CAC5D,CAAC,EACD,GAAG,oCAAqC,SAAY,CAChD,KAAM,GAAK,KAAM,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAOrC,EAED,KAAM,GAAe,CAAE,EACvB,KAAM,GAAS,EAAG,cAAc,mBAAmB,EAEnD,EAAO,EAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC,EAE7C,EAAO,SAAW,GAClB,KAAM,GAAe,CAAE,EAEvB,EAAO,EAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,UAAW,SAAS,CAAC,CAC5D,CAAC,CACL,CAAC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
-
regressVisuals("SwatchSizesStories", stories);
|
|
1
|
+
import*as s from"../stories/swatch-sizes.stories.js";import{regressVisuals as r}from"../../../test/visual/test.js";r("SwatchSizesStories",s);
|
|
4
2
|
//# sourceMappingURL=swatch-sizes.test-vrt.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch-sizes.test-vrt.ts"],
|
|
4
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/swatch-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('SwatchSizesStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,qDACA,8DAEA,EAAe,qBAAsB,CAAO",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/swatch.test-vrt.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
-
regressVisuals("SwatchStories", stories);
|
|
1
|
+
import*as r from"../stories/swatch.stories.js";import{regressVisuals as s}from"../../../test/visual/test.js";s("SwatchStories",r);
|
|
4
2
|
//# sourceMappingURL=swatch.test-vrt.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch.test-vrt.ts"],
|
|
4
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/swatch.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('SwatchStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,+CACA,8DAEA,EAAe,gBAAiB,CAAO",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/swatch.test.js
CHANGED
|
@@ -1,141 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { spy } from "sinon";
|
|
3
|
-
import { sendKeys } from "@web/test-runner-commands";
|
|
4
|
-
import "../sp-swatch.js";
|
|
5
|
-
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
6
|
-
describe("Swatch", () => {
|
|
7
|
-
let el;
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
el = await fixture(html`
|
|
1
|
+
import{elementUpdated as s,expect as t,fixture as l,html as o}from"@open-wc/testing";import{spy as i}from"sinon";import{sendKeys as c}from"@web/test-runner-commands";import"../sp-swatch.js";import{testForLitDevWarnings as r}from"../../../test/testing-helpers.js";describe("Swatch",()=>{let e;beforeEach(async()=>{e=await l(o`
|
|
10
2
|
<sp-swatch color="red" label="Red"></sp-swatch>
|
|
11
|
-
`)
|
|
12
|
-
await elementUpdated(el);
|
|
13
|
-
});
|
|
14
|
-
testForLitDevWarnings(async () => await fixture(html`
|
|
3
|
+
`),await s(e)}),r(async()=>await l(o`
|
|
15
4
|
<sp-swatch color="red" label="Red"></sp-swatch>
|
|
16
|
-
`));
|
|
17
|
-
it(`loads default swatch accessibly`, async () => {
|
|
18
|
-
await expect(el).to.be.accessible();
|
|
19
|
-
});
|
|
20
|
-
it("loads [nothing] swatch accessibly", async () => {
|
|
21
|
-
el.nothing = true;
|
|
22
|
-
el.removeAttribute("color");
|
|
23
|
-
el.label = "Transparent";
|
|
24
|
-
await expect(el).to.be.accessible();
|
|
25
|
-
expect(el.getAttribute("aria-label")).to.equal("Transparent");
|
|
26
|
-
});
|
|
27
|
-
["xs", "s", "m", "l"].map((size) => {
|
|
28
|
-
it(`loads [mixed-value] swatch accessibly as [size=${size}]`, async () => {
|
|
29
|
-
el.mixedValue = true;
|
|
30
|
-
el.removeAttribute("color");
|
|
31
|
-
el.label = "Mixed Value";
|
|
32
|
-
el.size = size;
|
|
33
|
-
await expect(el).to.be.accessible();
|
|
34
|
-
expect(el.getAttribute("aria-label")).to.equal("Mixed Value");
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
it("toggles on `click`", async () => {
|
|
38
|
-
expect(el.selected).to.be.false;
|
|
39
|
-
el.click();
|
|
40
|
-
expect(el.selected).to.be.true;
|
|
41
|
-
await expect(el).to.be.accessible();
|
|
42
|
-
});
|
|
43
|
-
it('toggles on `click` as [role="checkbox"]', async () => {
|
|
44
|
-
el.role = "checkbox";
|
|
45
|
-
await elementUpdated(el);
|
|
46
|
-
expect(el.selected).to.be.false;
|
|
47
|
-
await expect(el).to.be.accessible();
|
|
48
|
-
el.click();
|
|
49
|
-
expect(el.selected).to.be.true;
|
|
50
|
-
await expect(el).to.be.accessible();
|
|
51
|
-
});
|
|
52
|
-
it("toggles on `Space`", async () => {
|
|
53
|
-
expect(el.selected).to.be.false;
|
|
54
|
-
el.focus();
|
|
55
|
-
await sendKeys({
|
|
56
|
-
press: "Space"
|
|
57
|
-
});
|
|
58
|
-
expect(el.selected).to.be.true;
|
|
59
|
-
});
|
|
60
|
-
it("toggles on `Enter`", async () => {
|
|
61
|
-
expect(el.selected).to.be.false;
|
|
62
|
-
el.focus();
|
|
63
|
-
await sendKeys({
|
|
64
|
-
press: "Enter"
|
|
65
|
-
});
|
|
66
|
-
expect(el.selected).to.be.true;
|
|
67
|
-
await sendKeys({
|
|
68
|
-
press: "NumpadEnter"
|
|
69
|
-
});
|
|
70
|
-
expect(el.selected).to.be.false;
|
|
71
|
-
});
|
|
72
|
-
it("dispatches `change`", async () => {
|
|
73
|
-
const changeSpy = spy();
|
|
74
|
-
el.addEventListener("change", () => changeSpy());
|
|
75
|
-
el.click();
|
|
76
|
-
expect(changeSpy.calledOnce).to.be.true;
|
|
77
|
-
});
|
|
78
|
-
it("does not dispatch `change` when [disabled]", async () => {
|
|
79
|
-
const changeSpy = spy();
|
|
80
|
-
el.addEventListener("change", () => changeSpy());
|
|
81
|
-
el.disabled = true;
|
|
82
|
-
await elementUpdated(el);
|
|
83
|
-
el.click();
|
|
84
|
-
expect(changeSpy.calledOnce).to.be.false;
|
|
85
|
-
});
|
|
86
|
-
it("does not dispatch `change` when [mixed-value]", async () => {
|
|
87
|
-
const changeSpy = spy();
|
|
88
|
-
el.addEventListener("change", () => changeSpy());
|
|
89
|
-
el.mixedValue = true;
|
|
90
|
-
await elementUpdated(el);
|
|
91
|
-
el.click();
|
|
92
|
-
expect(changeSpy.calledOnce).to.be.false;
|
|
93
|
-
});
|
|
94
|
-
it("can have `change` prevented", async () => {
|
|
95
|
-
el.addEventListener("change", (event) => {
|
|
96
|
-
event.preventDefault();
|
|
97
|
-
});
|
|
98
|
-
expect(el.selected).to.false;
|
|
99
|
-
el.click();
|
|
100
|
-
expect(el.selected).to.false;
|
|
101
|
-
});
|
|
102
|
-
it("is in the tab order", async () => {
|
|
103
|
-
const inputBefore = document.createElement("input");
|
|
104
|
-
const inputAfter = document.createElement("input");
|
|
105
|
-
el.insertAdjacentElement("beforebegin", inputBefore);
|
|
106
|
-
el.insertAdjacentElement("afterend", inputAfter);
|
|
107
|
-
inputBefore.focus();
|
|
108
|
-
expect(document.activeElement === el).to.be.false;
|
|
109
|
-
await sendKeys({
|
|
110
|
-
press: "Tab"
|
|
111
|
-
});
|
|
112
|
-
expect(document.activeElement === el).to.be.true;
|
|
113
|
-
await sendKeys({
|
|
114
|
-
press: "Tab"
|
|
115
|
-
});
|
|
116
|
-
expect(document.activeElement === el).to.be.false;
|
|
117
|
-
await sendKeys({
|
|
118
|
-
press: "Shift+Tab"
|
|
119
|
-
});
|
|
120
|
-
expect(document.activeElement === el).to.be.true;
|
|
121
|
-
});
|
|
122
|
-
it("is not in the tab order when [disabled]", async () => {
|
|
123
|
-
const inputBefore = document.createElement("input");
|
|
124
|
-
const inputAfter = document.createElement("input");
|
|
125
|
-
el.insertAdjacentElement("beforebegin", inputBefore);
|
|
126
|
-
el.insertAdjacentElement("afterend", inputAfter);
|
|
127
|
-
inputBefore.focus();
|
|
128
|
-
el.disabled = true;
|
|
129
|
-
await elementUpdated(el);
|
|
130
|
-
expect(document.activeElement === el).to.be.false;
|
|
131
|
-
await sendKeys({
|
|
132
|
-
press: "Tab"
|
|
133
|
-
});
|
|
134
|
-
expect(document.activeElement === el).to.be.false;
|
|
135
|
-
await sendKeys({
|
|
136
|
-
press: "Shift+Tab"
|
|
137
|
-
});
|
|
138
|
-
expect(document.activeElement === el).to.be.false;
|
|
139
|
-
});
|
|
140
|
-
});
|
|
5
|
+
`)),it("loads default swatch accessibly",async()=>{await t(e).to.be.accessible()}),it("loads [nothing] swatch accessibly",async()=>{e.nothing=!0,e.removeAttribute("color"),e.label="Transparent",await t(e).to.be.accessible(),t(e.getAttribute("aria-label")).to.equal("Transparent")}),["xs","s","m","l"].map(a=>{it(`loads [mixed-value] swatch accessibly as [size=${a}]`,async()=>{e.mixedValue=!0,e.removeAttribute("color"),e.label="Mixed Value",e.size=a,await t(e).to.be.accessible(),t(e.getAttribute("aria-label")).to.equal("Mixed Value")})}),it("toggles on `click`",async()=>{t(e.selected).to.be.false,e.click(),t(e.selected).to.be.true,await t(e).to.be.accessible()}),it('toggles on `click` as [role="checkbox"]',async()=>{e.role="checkbox",await s(e),t(e.selected).to.be.false,await t(e).to.be.accessible(),e.click(),t(e.selected).to.be.true,await t(e).to.be.accessible()}),it("toggles on `Space`",async()=>{t(e.selected).to.be.false,e.focus(),await c({press:"Space"}),t(e.selected).to.be.true}),it("toggles on `Enter`",async()=>{t(e.selected).to.be.false,e.focus(),await c({press:"Enter"}),t(e.selected).to.be.true,await c({press:"NumpadEnter"}),t(e.selected).to.be.false}),it("dispatches `change`",async()=>{const a=i();e.addEventListener("change",()=>a()),e.click(),t(a.calledOnce).to.be.true}),it("does not dispatch `change` when [disabled]",async()=>{const a=i();e.addEventListener("change",()=>a()),e.disabled=!0,await s(e),e.click(),t(a.calledOnce).to.be.false}),it("does not dispatch `change` when [mixed-value]",async()=>{const a=i();e.addEventListener("change",()=>a()),e.mixedValue=!0,await s(e),e.click(),t(a.calledOnce).to.be.false}),it("can have `change` prevented",async()=>{e.addEventListener("change",a=>{a.preventDefault()}),t(e.selected).to.false,e.click(),t(e.selected).to.false}),it("is in the tab order",async()=>{const a=document.createElement("input"),n=document.createElement("input");e.insertAdjacentElement("beforebegin",a),e.insertAdjacentElement("afterend",n),a.focus(),t(document.activeElement===e).to.be.false,await c({press:"Tab"}),t(document.activeElement===e).to.be.true,await c({press:"Tab"}),t(document.activeElement===e).to.be.false,await c({press:"Shift+Tab"}),t(document.activeElement===e).to.be.true}),it("is not in the tab order when [disabled]",async()=>{const a=document.createElement("input"),n=document.createElement("input");e.insertAdjacentElement("beforebegin",a),e.insertAdjacentElement("afterend",n),a.focus(),e.disabled=!0,await s(e),t(document.activeElement===e).to.be.false,await c({press:"Tab"}),t(document.activeElement===e).to.be.false,await c({press:"Shift+Tab"}),t(document.activeElement===e).to.be.false})});
|
|
141
6
|
//# sourceMappingURL=swatch.test.js.map
|