@spectrum-web-components/action-button 0.8.7 → 0.9.1-devmode.7

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.
Files changed (64) hide show
  1. package/package.json +24 -11
  2. package/sp-action-button.dev.js +3 -0
  3. package/sp-action-button.dev.js.map +7 -0
  4. package/sp-action-button.js +3 -14
  5. package/sp-action-button.js.map +7 -1
  6. package/src/ActionButton.dev.js +172 -0
  7. package/src/ActionButton.dev.js.map +7 -0
  8. package/src/ActionButton.js +152 -182
  9. package/src/ActionButton.js.map +7 -1
  10. package/src/action-button.css.dev.js +426 -0
  11. package/src/action-button.css.dev.js.map +7 -0
  12. package/src/action-button.css.js +367 -670
  13. package/src/action-button.css.js.map +7 -1
  14. package/src/index.dev.js +2 -0
  15. package/src/index.dev.js.map +7 -0
  16. package/src/index.js +2 -13
  17. package/src/index.js.map +7 -1
  18. package/src/spectrum-action-button.css.dev.js +394 -0
  19. package/src/spectrum-action-button.css.dev.js.map +7 -0
  20. package/src/spectrum-action-button.css.js +366 -657
  21. package/src/spectrum-action-button.css.js.map +7 -1
  22. package/src/spectrum-config.js +3 -5
  23. package/stories/action-button-black-quiet.stories.js +19 -19
  24. package/stories/action-button-black-quiet.stories.js.map +7 -1
  25. package/stories/action-button-black.stories.js +15 -15
  26. package/stories/action-button-black.stories.js.map +7 -1
  27. package/stories/action-button-emphasized-quiet.stories.js +16 -16
  28. package/stories/action-button-emphasized-quiet.stories.js.map +7 -1
  29. package/stories/action-button-emphasized.stories.js +12 -12
  30. package/stories/action-button-emphasized.stories.js.map +7 -1
  31. package/stories/action-button-quiet.stories.js +12 -12
  32. package/stories/action-button-quiet.stories.js.map +7 -1
  33. package/stories/action-button-standard.stories.js +8 -8
  34. package/stories/action-button-standard.stories.js.map +7 -1
  35. package/stories/action-button-white-quiet.stories.js +19 -19
  36. package/stories/action-button-white-quiet.stories.js.map +7 -1
  37. package/stories/action-button-white.stories.js +15 -15
  38. package/stories/action-button-white.stories.js.map +7 -1
  39. package/stories/action-button.stories.js +19 -31
  40. package/stories/action-button.stories.js.map +7 -1
  41. package/stories/index.js +51 -40
  42. package/stories/index.js.map +7 -1
  43. package/test/action-button-black-quiet.test-vrt.js +4 -15
  44. package/test/action-button-black-quiet.test-vrt.js.map +7 -1
  45. package/test/action-button-black.test-vrt.js +4 -15
  46. package/test/action-button-black.test-vrt.js.map +7 -1
  47. package/test/action-button-emphasized-quiet.test-vrt.js +4 -15
  48. package/test/action-button-emphasized-quiet.test-vrt.js.map +7 -1
  49. package/test/action-button-emphasized.test-vrt.js +4 -15
  50. package/test/action-button-emphasized.test-vrt.js.map +7 -1
  51. package/test/action-button-quiet.test-vrt.js +4 -15
  52. package/test/action-button-quiet.test-vrt.js.map +7 -1
  53. package/test/action-button-standard.test-vrt.js +4 -15
  54. package/test/action-button-standard.test-vrt.js.map +7 -1
  55. package/test/action-button-white-quiet.test-vrt.js +4 -15
  56. package/test/action-button-white-quiet.test-vrt.js.map +7 -1
  57. package/test/action-button-white.test-vrt.js +4 -15
  58. package/test/action-button-white.test-vrt.js.map +7 -1
  59. package/test/action-button.test-vrt.js +4 -15
  60. package/test/action-button.test-vrt.js.map +7 -1
  61. package/test/action-button.test.js +105 -110
  62. package/test/action-button.test.js.map +7 -1
  63. package/test/benchmark/basic-test.js +5 -16
  64. package/test/benchmark/basic-test.js.map +7 -1
@@ -1,15 +1,4 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import * as stories from '../stories/action-button-standard.stories.js';
13
- import { regressVisuals } from '../../../test/visual/test.js';
14
- regressVisuals('ActionButtonStandardStories', stories);
15
- //# sourceMappingURL=action-button-standard.test-vrt.js.map
1
+ import * as stories from "../stories/action-button-standard.stories.js";
2
+ import { regressVisuals } from "../../../test/visual/test.js";
3
+ regressVisuals("ActionButtonStandardStories", stories);
4
+ //# sourceMappingURL=action-button-standard.test-vrt.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"action-button-standard.test-vrt.js","sourceRoot":"","sources":["action-button-standard.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,8CAA8C,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC","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/action-button-standard.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStandardStories', stories);\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["action-button-standard.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-standard.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStandardStories', stories);\n"],
5
+ "mappings": "AAYA;AACA;AAEA,eAAe,+BAA+B,OAAO;",
6
+ "names": []
7
+ }
@@ -1,15 +1,4 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import * as stories from '../stories/action-button-white-quiet.stories.js';
13
- import { regressVisuals } from '../../../test/visual/test.js';
14
- regressVisuals('ActionButtonWhiteQuietStories', stories);
15
- //# sourceMappingURL=action-button-white-quiet.test-vrt.js.map
1
+ import * as stories from "../stories/action-button-white-quiet.stories.js";
2
+ import { regressVisuals } from "../../../test/visual/test.js";
3
+ regressVisuals("ActionButtonWhiteQuietStories", stories);
4
+ //# sourceMappingURL=action-button-white-quiet.test-vrt.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"action-button-white-quiet.test-vrt.js","sourceRoot":"","sources":["action-button-white-quiet.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC","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/action-button-white-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteQuietStories', stories);\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["action-button-white-quiet.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-white-quiet.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteQuietStories', stories);\n"],
5
+ "mappings": "AAYA;AACA;AAEA,eAAe,iCAAiC,OAAO;",
6
+ "names": []
7
+ }
@@ -1,15 +1,4 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import * as stories from '../stories/action-button-white.stories.js';
13
- import { regressVisuals } from '../../../test/visual/test.js';
14
- regressVisuals('ActionButtonWhiteStories', stories);
15
- //# sourceMappingURL=action-button-white.test-vrt.js.map
1
+ import * as stories from "../stories/action-button-white.stories.js";
2
+ import { regressVisuals } from "../../../test/visual/test.js";
3
+ regressVisuals("ActionButtonWhiteStories", stories);
4
+ //# sourceMappingURL=action-button-white.test-vrt.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"action-button-white.test-vrt.js","sourceRoot":"","sources":["action-button-white.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC","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/action-button-white.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteStories', stories);\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["action-button-white.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button-white.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonWhiteStories', stories);\n"],
5
+ "mappings": "AAYA;AACA;AAEA,eAAe,4BAA4B,OAAO;",
6
+ "names": []
7
+ }
@@ -1,15 +1,4 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import * as stories from '../stories/action-button.stories.js';
13
- import { regressVisuals } from '../../../test/visual/test.js';
14
- regressVisuals('ActionButtonStories', stories);
15
- //# sourceMappingURL=action-button.test-vrt.js.map
1
+ import * as stories from "../stories/action-button.stories.js";
2
+ import { regressVisuals } from "../../../test/visual/test.js";
3
+ regressVisuals("ActionButtonStories", stories);
4
+ //# sourceMappingURL=action-button.test-vrt.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"action-button.test-vrt.js","sourceRoot":"","sources":["action-button.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC","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/action-button.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStories', stories);\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["action-button.test-vrt.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/action-button.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('ActionButtonStories', stories);\n"],
5
+ "mappings": "AAYA;AACA;AAEA,eAAe,uBAAuB,OAAO;",
6
+ "names": []
7
+ }
@@ -1,52 +1,47 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import '../sp-action-button.js';
13
- import { elementUpdated, expect, fixture, html, waitUntil, } from '@open-wc/testing';
14
- import { sendKeys } from '@web/test-runner-commands';
15
- import { spy } from 'sinon';
16
- describe('ActionButton', () => {
17
- it('loads default', async () => {
18
- const el = await fixture(html `
1
+ import "@spectrum-web-components/action-button/sp-action-button.js";
2
+ import {
3
+ elementUpdated,
4
+ expect,
5
+ fixture,
6
+ html,
7
+ waitUntil
8
+ } from "@open-wc/testing";
9
+ import { sendKeys } from "@web/test-runner-commands";
10
+ import { spy } from "sinon";
11
+ describe("ActionButton", () => {
12
+ it("loads default", async () => {
13
+ const el = await fixture(html`
19
14
  <sp-action-button>Button</sp-action-button>
20
15
  `);
21
- await elementUpdated(el);
22
- expect(el).to.not.be.undefined;
23
- expect(el.textContent).to.include('Button');
24
- await expect(el).to.be.accessible();
25
- });
26
- it('loads [hold-affordance]', async () => {
27
- const el = await fixture(html `
16
+ await elementUpdated(el);
17
+ expect(el).to.not.be.undefined;
18
+ expect(el.textContent).to.include("Button");
19
+ await expect(el).to.be.accessible();
20
+ });
21
+ it("loads [hold-affordance]", async () => {
22
+ const el = await fixture(html`
28
23
  <sp-action-button hold-affordance>Button</sp-action-button>
29
24
  `);
30
- await elementUpdated(el);
31
- expect(el).to.not.be.undefined;
32
- expect(el.textContent).to.include('Button');
33
- await expect(el).to.be.accessible();
34
- });
35
- it('maintains a `size` attribute', async () => {
36
- const el = await fixture(html `
25
+ await elementUpdated(el);
26
+ expect(el).to.not.be.undefined;
27
+ expect(el.textContent).to.include("Button");
28
+ await expect(el).to.be.accessible();
29
+ });
30
+ it("maintains a `size` attribute", async () => {
31
+ const el = await fixture(html`
37
32
  <sp-action-button>Button</sp-action-button>
38
33
  `);
39
- await elementUpdated(el);
40
- expect(el.size).to.equal('m');
41
- expect(el.getAttribute('size')).to.equal('m');
42
- el.removeAttribute('size');
43
- await elementUpdated(el);
44
- expect(el.size).to.equal('m');
45
- expect(el.getAttribute('size')).to.equal('m');
46
- });
47
- it('dispatches `longpress` events when [hold-affordance]', async () => {
48
- const longpressSpy = spy();
49
- const el = await fixture(html `
34
+ await elementUpdated(el);
35
+ expect(el.size).to.equal("m");
36
+ expect(el.getAttribute("size")).to.equal("m");
37
+ el.removeAttribute("size");
38
+ await elementUpdated(el);
39
+ expect(el.size).to.equal("m");
40
+ expect(el.getAttribute("size")).to.equal("m");
41
+ });
42
+ it("dispatches `longpress` events when [hold-affordance]", async () => {
43
+ const longpressSpy = spy();
44
+ const el = await fixture(html`
50
45
  <sp-action-button
51
46
  hold-affordance
52
47
  @longpress=${() => longpressSpy()}
@@ -54,79 +49,79 @@ describe('ActionButton', () => {
54
49
  Button
55
50
  </sp-action-button>
56
51
  `);
57
- await elementUpdated(el);
58
- el.focus();
59
- await sendKeys({
60
- press: 'Space',
61
- });
62
- expect(longpressSpy.callCount).to.equal(1);
63
- await sendKeys({
64
- press: 'Alt+ArrowDown',
65
- });
66
- expect(longpressSpy.callCount).to.equal(2);
67
- el.dispatchEvent(new Event('pointerdown'));
68
- el.dispatchEvent(new Event('pointerup'));
69
- el.dispatchEvent(new Event('pointerdown'));
70
- await waitUntil(() => longpressSpy.callCount === 3);
52
+ await elementUpdated(el);
53
+ el.focus();
54
+ await sendKeys({
55
+ press: "Space"
71
56
  });
72
- it(':not([toggles])', async () => {
73
- const el = await fixture(html `
57
+ expect(longpressSpy.callCount).to.equal(1);
58
+ await sendKeys({
59
+ press: "Alt+ArrowDown"
60
+ });
61
+ expect(longpressSpy.callCount).to.equal(2);
62
+ el.dispatchEvent(new Event("pointerdown"));
63
+ el.dispatchEvent(new Event("pointerup"));
64
+ el.dispatchEvent(new Event("pointerdown"));
65
+ await waitUntil(() => longpressSpy.callCount === 3);
66
+ });
67
+ it(":not([toggles])", async () => {
68
+ const el = await fixture(html`
74
69
  <sp-action-button>Button</sp-action-button>
75
70
  `);
76
- await elementUpdated(el);
77
- const button = el.focusElement;
78
- expect(el.toggles).to.be.false;
79
- expect(el.selected).to.be.false;
80
- expect(button.hasAttribute('aria-pressed')).to.be.false;
81
- el.click();
82
- await elementUpdated(el);
83
- expect(el.toggles).to.be.false;
84
- expect(el.selected).to.be.false;
85
- expect(button.hasAttribute('aria-pressed')).to.be.false;
86
- });
87
- it('responds to [selected]', async () => {
88
- const el = await fixture(html `
71
+ await elementUpdated(el);
72
+ const button = el.focusElement;
73
+ expect(el.toggles).to.be.false;
74
+ expect(el.selected).to.be.false;
75
+ expect(button.hasAttribute("aria-pressed")).to.be.false;
76
+ el.click();
77
+ await elementUpdated(el);
78
+ expect(el.toggles).to.be.false;
79
+ expect(el.selected).to.be.false;
80
+ expect(button.hasAttribute("aria-pressed")).to.be.false;
81
+ });
82
+ it("responds to [selected]", async () => {
83
+ const el = await fixture(html`
89
84
  <sp-action-button>Button</sp-action-button>
90
85
  `);
91
- await elementUpdated(el);
92
- const button = el.focusElement;
93
- expect(el.toggles).to.be.false;
94
- expect(el.selected).to.be.false;
95
- expect(button.hasAttribute('aria-pressed')).to.be.false;
96
- el.selected = true;
97
- await elementUpdated(el);
98
- expect(el.toggles).to.be.false;
99
- expect(el.selected).to.be.true;
100
- expect(button.getAttribute('aria-pressed')).to.equal('true');
101
- el.selected = false;
102
- await elementUpdated(el);
103
- expect(el.toggles).to.be.false;
104
- expect(el.selected).to.be.false;
105
- expect(button.hasAttribute('aria-pressed')).to.be.false;
106
- });
107
- it('toggles', async () => {
108
- const el = await fixture(html `
86
+ await elementUpdated(el);
87
+ const button = el.focusElement;
88
+ expect(el.toggles).to.be.false;
89
+ expect(el.selected).to.be.false;
90
+ expect(button.hasAttribute("aria-pressed")).to.be.false;
91
+ el.selected = true;
92
+ await elementUpdated(el);
93
+ expect(el.toggles).to.be.false;
94
+ expect(el.selected).to.be.true;
95
+ expect(button.getAttribute("aria-pressed")).to.equal("true");
96
+ el.selected = false;
97
+ await elementUpdated(el);
98
+ expect(el.toggles).to.be.false;
99
+ expect(el.selected).to.be.false;
100
+ expect(button.hasAttribute("aria-pressed")).to.be.false;
101
+ });
102
+ it("toggles", async () => {
103
+ const el = await fixture(html`
109
104
  <sp-action-button toggles>Button</sp-action-button>
110
105
  `);
111
- await elementUpdated(el);
112
- const button = el.focusElement;
113
- expect(el.toggles).to.be.true;
114
- expect(el.selected).to.be.false;
115
- expect(button.getAttribute('aria-pressed')).to.equal('false');
116
- el.focus();
117
- await sendKeys({
118
- press: 'Space',
119
- });
120
- await elementUpdated(el);
121
- expect(el.toggles).to.be.true;
122
- expect(el.selected).to.be.true;
123
- expect(button.getAttribute('aria-pressed')).to.equal('true');
124
- el.addEventListener('change', (event) => event.preventDefault());
125
- el.click();
126
- await elementUpdated(el);
127
- expect(el.toggles).to.be.true;
128
- expect(el.selected).to.be.true;
129
- expect(button.getAttribute('aria-pressed')).to.equal('true');
106
+ await elementUpdated(el);
107
+ const button = el.focusElement;
108
+ expect(el.toggles).to.be.true;
109
+ expect(el.selected).to.be.false;
110
+ expect(button.getAttribute("aria-pressed")).to.equal("false");
111
+ el.focus();
112
+ await sendKeys({
113
+ press: "Space"
130
114
  });
115
+ await elementUpdated(el);
116
+ expect(el.toggles).to.be.true;
117
+ expect(el.selected).to.be.true;
118
+ expect(button.getAttribute("aria-pressed")).to.equal("true");
119
+ el.addEventListener("change", (event) => event.preventDefault());
120
+ el.click();
121
+ await elementUpdated(el);
122
+ expect(el.toggles).to.be.true;
123
+ expect(el.selected).to.be.true;
124
+ expect(button.getAttribute("aria-pressed")).to.equal("true");
125
+ });
131
126
  });
132
- //# sourceMappingURL=action-button.test.js.map
127
+ //# sourceMappingURL=action-button.test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"action-button.test.js","sourceRoot":"","sources":["action-button.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EACH,cAAc,EACd,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC3B,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;aAEH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QACzB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC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X,KAAK,EAAE,OAAO;SACjB,CAAC,CAAC;QACH,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC9B,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE7D,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC;QACxE,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC9B,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","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 '../sp-action-button.js';\nimport { ActionButton } from '../';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\n\ndescribe('ActionButton', () => {\n it('loads default', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('loads [hold-affordance]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button hold-affordance>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('maintains a `size` attribute', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n el.removeAttribute('size');\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n });\n it('dispatches `longpress` events when [hold-affordance]', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `\n );\n\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(longpressSpy.callCount).to.equal(1);\n await sendKeys({\n press: 'Alt+ArrowDown',\n });\n\n expect(longpressSpy.callCount).to.equal(2);\n el.dispatchEvent(new Event('pointerdown'));\n el.dispatchEvent(new Event('pointerup'));\n el.dispatchEvent(new Event('pointerdown'));\n await waitUntil(() => longpressSpy.callCount === 3);\n });\n it(':not([toggles])', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('responds to [selected]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.selected = true;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.selected = false;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('toggles', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button toggles>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button.getAttribute('aria-pressed')).to.equal('false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n });\n});\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["action-button.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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { spy } from 'sinon';\n\ndescribe('ActionButton', () => {\n it('loads default', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('loads [hold-affordance]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button hold-affordance>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n expect(el.textContent).to.include('Button');\n await expect(el).to.be.accessible();\n });\n it('maintains a `size` attribute', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n el.removeAttribute('size');\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n expect(el.getAttribute('size')).to.equal('m');\n });\n it('dispatches `longpress` events when [hold-affordance]', async () => {\n const longpressSpy = spy();\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button\n hold-affordance\n @longpress=${() => longpressSpy()}\n >\n Button\n </sp-action-button>\n `\n );\n\n await elementUpdated(el);\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(longpressSpy.callCount).to.equal(1);\n await sendKeys({\n press: 'Alt+ArrowDown',\n });\n\n expect(longpressSpy.callCount).to.equal(2);\n el.dispatchEvent(new Event('pointerdown'));\n el.dispatchEvent(new Event('pointerup'));\n el.dispatchEvent(new Event('pointerdown'));\n await waitUntil(() => longpressSpy.callCount === 3);\n });\n it(':not([toggles])', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('responds to [selected]', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n\n el.selected = true;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.selected = false;\n await elementUpdated(el);\n\n expect(el.toggles).to.be.false;\n expect(el.selected).to.be.false;\n expect(button.hasAttribute('aria-pressed')).to.be.false;\n });\n it('toggles', async () => {\n const el = await fixture<ActionButton>(\n html`\n <sp-action-button toggles>Button</sp-action-button>\n `\n );\n\n await elementUpdated(el);\n const button = el.focusElement;\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.false;\n expect(button.getAttribute('aria-pressed')).to.equal('false');\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.click();\n await elementUpdated(el);\n\n expect(el.toggles).to.be.true;\n expect(el.selected).to.be.true;\n expect(button.getAttribute('aria-pressed')).to.equal('true');\n });\n});\n"],
5
+ "mappings": "AAYA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AACA;AAEA,SAAS,gBAAgB,MAAM;AAC3B,KAAG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AAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,GAAG;AAAA,EACtD,CAAC;AACD,KAAG,WAAW,YAAY;AACtB,UAAM,KAAK,MAAM,QACb;AAAA;AAAA,aAGJ;AAEA,UAAM,eAAe,EAAE;AACvB,UAAM,SAAS,GAAG;AAElB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,OAAO;AAE5D,OAAG,MAAM;AACT,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AACD,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,MAAM;AAE3D,OAAG,iBAAiB,UAAU,CAAC,UAAiB,MAAM,eAAe,CAAC;AACtE,OAAG,MAAM;AACT,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AACzB,WAAO,GAAG,QAAQ,EAAE,GAAG,GAAG;AAC1B,WAAO,OAAO,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,MAAM;AAAA,EAC/D,CAAC;AACL,CAAC;",
6
+ "names": []
7
+ }
@@ -1,18 +1,7 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import '@spectrum-web-components/action-button/sp-action-button.js';
13
- import { html } from 'lit';
14
- import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
15
- measureFixtureCreation(html `
1
+ import "@spectrum-web-components/action-button/sp-action-button.js";
2
+ import { html } from "lit";
3
+ import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
4
+ measureFixtureCreation(html`
16
5
  <sp-action-button open></sp-action-button>
17
6
  `);
18
- //# sourceMappingURL=basic-test.js.map
7
+ //# sourceMappingURL=basic-test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"basic-test.js","sourceRoot":"","sources":["basic-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,4DAA4D,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,sBAAsB,CAAC,IAAI,CAAA;;CAE1B,CAAC,CAAC","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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-button open></sp-action-button>\n`);\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["basic-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 '@spectrum-web-components/action-button/sp-action-button.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-action-button open></sp-action-button>\n`);\n"],
5
+ "mappings": "AAYA;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA,CAEtB;",
6
+ "names": []
7
+ }