@spectrum-web-components/reactive-controllers 1.3.0-beta.2 → 1.3.0-testing.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/reactive-controllers",
3
- "version": "1.3.0-beta.2",
3
+ "version": "1.3.0-testing.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -84,7 +84,7 @@
84
84
  "reactive controllers"
85
85
  ],
86
86
  "dependencies": {
87
- "@spectrum-web-components/progress-circle": "^1.3.0-beta.2",
87
+ "@spectrum-web-components/progress-circle": "^1.3.0-testing.0",
88
88
  "colorjs.io": "^0.5.2",
89
89
  "lit": "^2.5.0 || ^3.1.3"
90
90
  },
@@ -92,6 +92,5 @@
92
92
  "customElements": "custom-elements.json",
93
93
  "sideEffects": [
94
94
  "./**/*.dev.js"
95
- ],
96
- "gitHead": "98f10907cae715b337db287dc3e661c0c8385e9b"
95
+ ]
97
96
  }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,208 +0,0 @@
1
- "use strict";
2
- import { expect } from "@open-wc/testing";
3
- import Color from "colorjs.io";
4
- import {
5
- ColorController
6
- } from "@spectrum-web-components/reactive-controllers/src/ColorController.js";
7
- describe("ColorController", () => {
8
- let host;
9
- let colorController;
10
- beforeEach(() => {
11
- host = {};
12
- host.requestUpdate = () => {
13
- };
14
- colorController = new ColorController(host);
15
- });
16
- it("should initialize correctly", () => {
17
- expect(colorController).to.exist;
18
- expect(colorController.color).to.be.instanceOf(Color);
19
- });
20
- it("should validate color strings correctly", () => {
21
- const validRgba = "rgba(255, 0, 0, 1)";
22
- const validHsla = "hsla(120, 100%, 50%, 0.5)";
23
- const validHsva = "hsva(240, 100%, 100%, 0.75)";
24
- const invalidColor = "invalidColor";
25
- expect(colorController.validateColorString(validRgba).isValid).to.be.true;
26
- expect(colorController.validateColorString(validHsla).isValid).to.be.true;
27
- expect(colorController.validateColorString(validHsva).isValid).to.be.true;
28
- expect(colorController.validateColorString(invalidColor).isValid).to.be.false;
29
- });
30
- it("should process RGB values in percentage correctly", () => {
31
- const colorString = "rgb(50%, 25%, 75%)";
32
- const result = colorController.validateColorString(colorString);
33
- expect(result.isValid).to.be.true;
34
- expect(result.coords).to.deep.equal([0.5, 0.25, 0.75]);
35
- expect(result.spaceId).to.equal("srgb");
36
- });
37
- it("should default alpha to 1 when alpha is undefined in RGBA", () => {
38
- const colorString = "rgb(255, 0, 0)";
39
- const result = colorController.validateColorString(colorString);
40
- expect(result.alpha).to.equal(1);
41
- expect(result.isValid).to.be.true;
42
- expect(result.coords).to.deep.equal([1, 0, 0]);
43
- expect(result.spaceId).to.equal("srgb");
44
- });
45
- it("should handle invalid color strings by trying to create a new Color object with a prefixed #", () => {
46
- const invalidColorString = "invalidColor";
47
- const validHexColorString = "ff0000";
48
- colorController.color = invalidColorString;
49
- expect(colorController.color.toString()).to.equal(
50
- new Color("hsv", [0, 100, 100], 1).toString()
51
- );
52
- colorController.color = validHexColorString;
53
- expect(colorController.color.toString()).to.equal(
54
- new Color(`#${validHexColorString}`).toString()
55
- );
56
- });
57
- it("should set color correctly with string input", () => {
58
- const colorString = "rgba(255, 0, 0, 1)";
59
- colorController.color = colorString;
60
- expect(colorController.color.toString()).to.equal(
61
- new Color(colorString).toString()
62
- );
63
- });
64
- it("should set color correctly with object input", () => {
65
- const colorObject = { r: 255, g: 0, b: 0, a: 1 };
66
- colorController.color = colorObject;
67
- });
68
- it("should get color value correctly", () => {
69
- let colorString = "rgba(255, 0, 0, 0.7)";
70
- colorController.color = colorString;
71
- expect(colorController.colorValue).to.equal(colorString);
72
- colorString = "hsla(120, 100%, 50%, 0.5)";
73
- colorController.color = colorString;
74
- expect(colorController.colorValue).to.equal(colorString);
75
- });
76
- it("should get and set hue correctly", () => {
77
- colorController.hue = 180;
78
- expect(colorController.hue).to.equal(180);
79
- });
80
- it("should convert color correctly", () => {
81
- const colorString = "rgba(255, 0, 0, 1)";
82
- colorController.color = colorString;
83
- expect(colorController.getColor("hsl")).to.be.an("object");
84
- });
85
- it("should get HSL string correctly", () => {
86
- const colorString = "rgba(255, 0, 0, 1)";
87
- colorController.color = colorString;
88
- expect(colorController.getHslString()).to.equal(
89
- new Color(colorString).to("hsl").toString()
90
- );
91
- });
92
- it("should process hex color values correctly when alpha is defined", () => {
93
- const colorString = "#ff573380";
94
- colorController.color = colorString;
95
- expect(colorController.color.toString()).to.equal(
96
- new Color(colorString).toString()
97
- );
98
- });
99
- it("should process hex color values correctly when alpha is not defined", () => {
100
- const colorString = "#ff5733";
101
- colorController.color = colorString;
102
- expect(colorController.color.toString()).to.equal(
103
- new Color(colorString).toString()
104
- );
105
- });
106
- it("should save and restore previous color correctly", () => {
107
- const colorString = "rgba(255, 0, 0, 1)";
108
- colorController.color = colorString;
109
- colorController.savePreviousColor();
110
- colorController.color = "rgba(0, 255, 0, 1)";
111
- colorController.restorePreviousColor();
112
- expect(colorController.color.toString()).to.equal(
113
- new Color(colorString).toString()
114
- );
115
- });
116
- it("should return correct color value for hsv spaceId", () => {
117
- colorController.color = "hsv(120, 100%, 50%)";
118
- const result = colorController.colorValue;
119
- expect(result).to.equal("hsv(120, 100%, 50%)");
120
- });
121
- it("should return correct color value for hsva spaceId", () => {
122
- colorController.color = "hsva(120, 100%, 50%, 0.5)";
123
- const result = colorController.colorValue;
124
- expect(result).to.equal("hsva(120, 100%, 50%, 0.5)");
125
- });
126
- it("should return correct color value for hsl spaceId", () => {
127
- colorController.color = "hsl(120, 100%, 50%)";
128
- const result = colorController.colorValue;
129
- expect(result).to.equal("hsl(120, 100%, 50%)");
130
- });
131
- it("should return correct color value for hsla spaceId", () => {
132
- colorController.color = "hsla(120, 100%, 50%, 0.5)";
133
- const result = colorController.colorValue;
134
- expect(result).to.equal("hsla(120, 100%, 50%, 0.5)");
135
- });
136
- it("should return correct color value for hex string spaceId", () => {
137
- colorController.color = "#ff5733";
138
- const result = colorController.colorValue;
139
- expect(result).to.equal("#ff5733");
140
- });
141
- it("should return correct color value for hex string spaceId with alpha", () => {
142
- colorController.color = "#ff573380";
143
- const result = colorController.colorValue;
144
- expect(result).to.equal("#ff573380");
145
- });
146
- it("should return correct color value for default spaceId with hex origin", () => {
147
- colorController.color = "#ff5733";
148
- const result = colorController.colorValue;
149
- expect(result).to.equal("#ff5733");
150
- });
151
- it("should return correct color value for default spaceId with hex origin and alpha", () => {
152
- colorController.color = "#ff573380";
153
- const result = colorController.colorValue;
154
- expect(result).to.equal("#ff573380");
155
- });
156
- it("should return correct color value for default spaceId with percentage origin", () => {
157
- colorController.color = "rgb(50%, 25%, 75%)";
158
- const result = colorController.colorValue;
159
- expect(result).to.equal("rgb(50%, 25%, 75%)");
160
- });
161
- it("should return correct color value for default spaceId with rgba origin", () => {
162
- colorController.color = "rgba(255, 87, 51, 0.5)";
163
- const result = colorController.colorValue;
164
- expect(result).to.equal("rgba(255, 87, 51, 0.5)");
165
- });
166
- it("should return correct color values for hsv spaceId", () => {
167
- colorController.color = new Color("hsv", [120, 100, 50]);
168
- const result = colorController.colorValue;
169
- expect(result).to.deep.equal({
170
- h: 120,
171
- s: 1,
172
- v: 0.5,
173
- a: 1
174
- });
175
- });
176
- it("should return correct color values for hsl spaceId", () => {
177
- colorController.color = new Color("hsl", [120, 100, 50]);
178
- const result = colorController.colorValue;
179
- expect(result).to.deep.equal({
180
- h: 120,
181
- s: 1,
182
- l: 0.5,
183
- a: 1
184
- });
185
- });
186
- it("should return correct color values for srgb spaceId", () => {
187
- colorController.color = new Color("srgb", [0.5, 0.25, 0.75]);
188
- const result = colorController.colorValue;
189
- expect(result).to.deep.equal({
190
- r: 128,
191
- g: 64,
192
- b: 191,
193
- a: 1
194
- });
195
- });
196
- it("should return correct color values for srgb spaceId with percentage origin", () => {
197
- colorController.color = new Color("srgb", [0.5, 0.25, 0.75]);
198
- colorController.colorOrigin = { r: "50%", g: "25%", b: "75%" };
199
- const result = colorController.colorValue;
200
- expect(result).to.deep.equal({
201
- r: "128%",
202
- g: "64%",
203
- b: "191%",
204
- a: 1
205
- });
206
- });
207
- });
208
- //# sourceMappingURL=color-controller.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["color-controller.test.ts"],
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*/\n\nimport { expect } from '@open-wc/testing';\nimport { ReactiveElement } from 'lit';\nimport Color from 'colorjs.io';\nimport {\n ColorController,\n ColorTypes,\n} from '@spectrum-web-components/reactive-controllers/src/ColorController.js';\n\ndescribe('ColorController', () => {\n let host: ReactiveElement;\n let colorController: ColorController;\n\n beforeEach(() => {\n host = {} as ReactiveElement;\n host.requestUpdate = () => {};\n colorController = new ColorController(host);\n });\n\n it('should initialize correctly', () => {\n expect(colorController).to.exist;\n expect(colorController.color).to.be.instanceOf(Color);\n });\n\n it('should validate color strings correctly', () => {\n const validRgba = 'rgba(255, 0, 0, 1)';\n const validHsla = 'hsla(120, 100%, 50%, 0.5)';\n const validHsva = 'hsva(240, 100%, 100%, 0.75)';\n const invalidColor = 'invalidColor';\n\n expect(colorController.validateColorString(validRgba).isValid).to.be\n .true;\n expect(colorController.validateColorString(validHsla).isValid).to.be\n .true;\n expect(colorController.validateColorString(validHsva).isValid).to.be\n .true;\n expect(colorController.validateColorString(invalidColor).isValid).to.be\n .false;\n });\n\n it('should process RGB values in percentage correctly', () => {\n const colorString = 'rgb(50%, 25%, 75%)';\n const result = colorController.validateColorString(colorString);\n expect(result.isValid).to.be.true;\n expect(result.coords).to.deep.equal([0.5, 0.25, 0.75]);\n expect(result.spaceId).to.equal('srgb');\n });\n\n it('should default alpha to 1 when alpha is undefined in RGBA', () => {\n const colorString = 'rgb(255, 0, 0)';\n const result = colorController.validateColorString(colorString);\n\n expect(result.alpha).to.equal(1);\n expect(result.isValid).to.be.true;\n expect(result.coords).to.deep.equal([1, 0, 0]);\n expect(result.spaceId).to.equal('srgb');\n });\n\n it('should handle invalid color strings by trying to create a new Color object with a prefixed #', () => {\n const invalidColorString = 'invalidColor';\n const validHexColorString = 'ff0000'; // Equivalent to #ff0000\n\n // Set the invalid color string\n colorController.color = invalidColorString;\n\n // Expect the color to be unchanged (default color)\n expect(colorController.color.toString()).to.equal(\n new Color('hsv', [0, 100, 100], 1).toString()\n );\n\n // Set the valid hex color string without #\n colorController.color = validHexColorString;\n\n // Expect the color to be set correctly\n expect(colorController.color.toString()).to.equal(\n new Color(`#${validHexColorString}`).toString()\n );\n });\n\n it('should set color correctly with string input', () => {\n const colorString = 'rgba(255, 0, 0, 1)';\n colorController.color = colorString;\n expect(colorController.color.toString()).to.equal(\n new Color(colorString).toString()\n );\n });\n\n it('should set color correctly with object input', () => {\n const colorObject: ColorTypes = { r: 255, g: 0, b: 0, a: 1 };\n colorController.color = colorObject;\n //expect(colorController.color.toString()).to.equal(new Color(colorObject).toString());\n });\n\n it('should get color value correctly', () => {\n let colorString = 'rgba(255, 0, 0, 0.7)';\n colorController.color = colorString;\n expect(colorController.colorValue).to.equal(colorString);\n colorString = 'hsla(120, 100%, 50%, 0.5)';\n colorController.color = colorString;\n expect(colorController.colorValue).to.equal(colorString);\n });\n\n it('should get and set hue correctly', () => {\n colorController.hue = 180;\n expect(colorController.hue).to.equal(180);\n });\n\n it('should convert color correctly', () => {\n const colorString = 'rgba(255, 0, 0, 1)';\n colorController.color = colorString;\n expect(colorController.getColor('hsl')).to.be.an('object');\n });\n\n it('should get HSL string correctly', () => {\n const colorString = 'rgba(255, 0, 0, 1)';\n colorController.color = colorString;\n expect(colorController.getHslString()).to.equal(\n new Color(colorString).to('hsl').toString()\n );\n });\n\n it('should process hex color values correctly when alpha is defined', () => {\n const colorString = '#ff573380'; // Equivalent to rgba(255, 87, 51, 0.5)\n colorController.color = colorString;\n expect(colorController.color.toString()).to.equal(\n new Color(colorString).toString()\n );\n });\n\n it('should process hex color values correctly when alpha is not defined', () => {\n const colorString = '#ff5733'; // Equivalent to rgba(255, 87, 51, 1)\n colorController.color = colorString;\n expect(colorController.color.toString()).to.equal(\n new Color(colorString).toString()\n );\n });\n\n it('should save and restore previous color correctly', () => {\n const colorString = 'rgba(255, 0, 0, 1)';\n colorController.color = colorString;\n colorController.savePreviousColor();\n colorController.color = 'rgba(0, 255, 0, 1)';\n colorController.restorePreviousColor();\n expect(colorController.color.toString()).to.equal(\n new Color(colorString).toString()\n );\n });\n it('should return correct color value for hsv spaceId', () => {\n colorController.color = 'hsv(120, 100%, 50%)';\n const result = colorController.colorValue;\n expect(result).to.equal('hsv(120, 100%, 50%)');\n });\n\n it('should return correct color value for hsva spaceId', () => {\n colorController.color = 'hsva(120, 100%, 50%, 0.5)';\n const result = colorController.colorValue;\n expect(result).to.equal('hsva(120, 100%, 50%, 0.5)');\n });\n\n it('should return correct color value for hsl spaceId', () => {\n colorController.color = 'hsl(120, 100%, 50%)';\n const result = colorController.colorValue;\n expect(result).to.equal('hsl(120, 100%, 50%)');\n });\n\n it('should return correct color value for hsla spaceId', () => {\n colorController.color = 'hsla(120, 100%, 50%, 0.5)';\n const result = colorController.colorValue;\n expect(result).to.equal('hsla(120, 100%, 50%, 0.5)');\n });\n\n it('should return correct color value for hex string spaceId', () => {\n colorController.color = '#ff5733';\n const result = colorController.colorValue;\n expect(result).to.equal('#ff5733');\n });\n\n it('should return correct color value for hex string spaceId with alpha', () => {\n colorController.color = '#ff573380'; // Equivalent to rgba(255, 87, 51, 0.5)\n const result = colorController.colorValue;\n expect(result).to.equal('#ff573380');\n });\n\n it('should return correct color value for default spaceId with hex origin', () => {\n colorController.color = '#ff5733';\n const result = colorController.colorValue;\n expect(result).to.equal('#ff5733');\n });\n\n it('should return correct color value for default spaceId with hex origin and alpha', () => {\n colorController.color = '#ff573380'; // Equivalent to rgba(255, 87, 51, 0.5)\n const result = colorController.colorValue;\n expect(result).to.equal('#ff573380');\n });\n\n it('should return correct color value for default spaceId with percentage origin', () => {\n colorController.color = 'rgb(50%, 25%, 75%)';\n const result = colorController.colorValue;\n expect(result).to.equal('rgb(50%, 25%, 75%)');\n });\n\n it('should return correct color value for default spaceId with rgba origin', () => {\n colorController.color = 'rgba(255, 87, 51, 0.5)';\n const result = colorController.colorValue;\n expect(result).to.equal('rgba(255, 87, 51, 0.5)');\n });\n\n it('should return correct color values for hsv spaceId', () => {\n colorController.color = new Color('hsv', [120, 100, 50]);\n const result = colorController.colorValue;\n expect(result).to.deep.equal({\n h: 120,\n s: 1,\n v: 0.5,\n a: 1,\n });\n });\n\n it('should return correct color values for hsl spaceId', () => {\n colorController.color = new Color('hsl', [120, 100, 50]);\n const result = colorController.colorValue;\n expect(result).to.deep.equal({\n h: 120,\n s: 1,\n l: 0.5,\n a: 1,\n });\n });\n\n it('should return correct color values for srgb spaceId', () => {\n colorController.color = new Color('srgb', [0.5, 0.25, 0.75]);\n const result = colorController.colorValue;\n expect(result).to.deep.equal({\n r: 128,\n g: 64,\n b: 191,\n a: 1,\n });\n });\n\n it('should return correct color values for srgb spaceId with percentage origin', () => {\n colorController.color = new Color('srgb', [0.5, 0.25, 0.75]);\n colorController.colorOrigin = { r: '50%', g: '25%', b: '75%' };\n const result = colorController.colorValue;\n expect(result).to.deep.equal({\n r: '128%',\n g: '64%',\n b: '191%',\n a: 1,\n });\n });\n});\n"],
5
- "mappings": ";AAYA,SAAS,cAAc;AAEvB,OAAO,WAAW;AAClB;AAAA,EACI;AAAA,OAEG;AAEP,SAAS,mBAAmB,MAAM;AAC9B,MAAI;AACJ,MAAI;AAEJ,aAAW,MAAM;AACb,WAAO,CAAC;AACR,SAAK,gBAAgB,MAAM;AAAA,IAAC;AAC5B,sBAAkB,IAAI,gBAAgB,IAAI;AAAA,EAC9C,CAAC;AAED,KAAG,+BAA+B,MAAM;AACpC,WAAO,eAAe,EAAE,GAAG;AAC3B,WAAO,gBAAgB,K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AA,MACH,GAAG;AAAA,IACP,CAAC;AAAA,EACL,CAAC;AAED,KAAG,uDAAuD,MAAM;AAC5D,oBAAgB,QAAQ,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,IAAI,CAAC;AAC3D,UAAM,SAAS,gBAAgB;AAC/B,WAAO,MAAM,EAAE,GAAG,KAAK,MAAM;AAAA,MACzB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACP,CAAC;AAAA,EACL,CAAC;AAED,KAAG,8EAA8E,MAAM;AACnF,oBAAgB,QAAQ,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,IAAI,CAAC;AAC3D,oBAAgB,cAAc,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM;AAC7D,UAAM,SAAS,gBAAgB;AAC/B,WAAO,MAAM,EAAE,GAAG,KAAK,MAAM;AAAA,MACzB,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACP,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- import { expect, nextFrame } from "@open-wc/testing";
3
- import { DependencyManagerController } from "@spectrum-web-components/reactive-controllers/src/DependencyManger.js";
4
- import { spy } from "sinon";
5
- describe("Dependency Manager", () => {
6
- it("manages dependencies", async function() {
7
- this.retries(0);
8
- const tagName = "some-heavy-element";
9
- const requestUpdateSpy = spy();
10
- const manager = new DependencyManagerController({
11
- requestUpdate: () => requestUpdateSpy()
12
- });
13
- expect(manager.loaded).to.be.false;
14
- manager.add(tagName);
15
- expect(manager.loaded).to.be.false;
16
- expect(requestUpdateSpy.notCalled).to.be.true;
17
- customElements.define(tagName, class extends HTMLElement {
18
- });
19
- await nextFrame();
20
- expect(manager.loaded).to.be.true;
21
- expect(requestUpdateSpy.notCalled).to.be.false;
22
- });
23
- });
24
- //# sourceMappingURL=dependency-manager.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["dependency-manager.test.ts"],
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*/\n\nimport { ReactiveElement } from 'lit';\nimport { expect, nextFrame } from '@open-wc/testing';\nimport { DependencyManagerController } from '@spectrum-web-components/reactive-controllers/src/DependencyManger.js';\nimport { spy } from 'sinon';\n\ndescribe('Dependency Manager', () => {\n it('manages dependencies', async function () {\n this.retries(0);\n const tagName = 'some-heavy-element';\n const requestUpdateSpy = spy();\n const manager = new DependencyManagerController({\n requestUpdate: () => requestUpdateSpy(),\n } as unknown as ReactiveElement);\n expect(manager.loaded).to.be.false;\n manager.add(tagName);\n expect(manager.loaded).to.be.false;\n expect(requestUpdateSpy.notCalled).to.be.true;\n customElements.define(tagName, class extends HTMLElement {});\n // Allow time for the registration to propagate.\n await nextFrame();\n expect(manager.loaded).to.be.true;\n expect(requestUpdateSpy.notCalled).to.be.false;\n });\n});\n"],
5
- "mappings": ";AAaA,SAAS,QAAQ,iBAAiB;AAClC,SAAS,mCAAmC;AAC5C,SAAS,WAAW;AAEpB,SAAS,sBAAsB,MAAM;AACjC,KAAG,wBAAwB,iBAAkB;AACzC,SAAK,QAAQ,CAAC;AACd,UAAM,UAAU;AAChB,UAAM,mBAAmB,IAAI;AAC7B,UAAM,UAAU,IAAI,4BAA4B;AAAA,MAC5C,eAAe,MAAM,iBAAiB;AAAA,IAC1C,CAA+B;AAC/B,WAAO,QAAQ,MAAM,EAAE,GAAG,GAAG;AAC7B,YAAQ,IAAI,OAAO;AACnB,WAAO,QAAQ,MAAM,EAAE,GAAG,GAAG;AAC7B,WAAO,iBAAiB,SAAS,EAAE,GAAG,GAAG;AACzC,mBAAe,OAAO,SAAS,cAAc,YAAY;AAAA,IAAC,CAAC;AAE3D,UAAM,UAAU;AAChB,WAAO,QAAQ,MAAM,EAAE,GAAG,GAAG;AAC7B,WAAO,iBAAiB,SAAS,EAAE,GAAG,GAAG;AAAA,EAC7C,CAAC;AACL,CAAC;",
6
- "names": []
7
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- import { html, LitElement } from "lit";
3
- import { elementUpdated, expect, fixture } from "@open-wc/testing";
4
- import { ElementResolutionController } from "@spectrum-web-components/reactive-controllers/src/ElementResolution.js";
5
- describe("Element Resolution", () => {
6
- it("responds to DOM changes", async () => {
7
- class TestEl extends LitElement {
8
- }
9
- if (!customElements.get("test-element-resolution-el")) {
10
- customElements.define("test-element-resolution-el", TestEl);
11
- }
12
- const test = await fixture(
13
- html`
14
- <div>
15
- <test-element-resolution-el></test-element-resolution-el>
16
- <div class="target" id="one"></div>
17
- <div class="target" id="two"></div>
18
- </div>
19
- `
20
- );
21
- const el = test.querySelector("test-element-resolution-el");
22
- const target1 = test.querySelector("#one");
23
- const target2 = test.querySelector("#two");
24
- const controller = new ElementResolutionController(el);
25
- expect(controller.element).to.be.null;
26
- controller.selector = ".target";
27
- await elementUpdated(el);
28
- expect(controller.element === target1).to.be.true;
29
- test.insertAdjacentElement("afterbegin", target2);
30
- await elementUpdated(el);
31
- expect(controller.element === target2).to.be.true;
32
- target2.setAttribute("class", "not-target");
33
- await elementUpdated(el);
34
- expect(controller.element === target1).to.be.true;
35
- target2.setAttribute("class", "target");
36
- await elementUpdated(el);
37
- expect(controller.element === target2).to.be.true;
38
- });
39
- });
40
- //# sourceMappingURL=element-resolution.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["element-resolution.test.ts"],
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*/\n\nimport { html, LitElement } from 'lit';\nimport { elementUpdated, expect, fixture } from '@open-wc/testing';\nimport { ElementResolutionController } from '@spectrum-web-components/reactive-controllers/src/ElementResolution.js';\n\ndescribe('Element Resolution', () => {\n it('responds to DOM changes', async () => {\n class TestEl extends LitElement {}\n if (!customElements.get('test-element-resolution-el')) {\n customElements.define('test-element-resolution-el', TestEl);\n }\n const test = await fixture(\n html`\n <div>\n <test-element-resolution-el></test-element-resolution-el>\n <div class=\"target\" id=\"one\"></div>\n <div class=\"target\" id=\"two\"></div>\n </div>\n `\n );\n const el = test.querySelector('test-element-resolution-el') as TestEl;\n const target1 = test.querySelector('#one') as HTMLDivElement;\n const target2 = test.querySelector('#two') as HTMLDivElement;\n const controller = new ElementResolutionController(el as LitElement);\n expect(controller.element).to.be.null;\n controller.selector = '.target';\n await elementUpdated(el);\n expect(controller.element === target1).to.be.true;\n test.insertAdjacentElement('afterbegin', target2);\n await elementUpdated(el);\n expect(controller.element === target2).to.be.true;\n target2.setAttribute('class', 'not-target');\n await elementUpdated(el);\n expect(controller.element === target1).to.be.true;\n target2.setAttribute('class', 'target');\n await elementUpdated(el);\n expect(controller.element === target2).to.be.true;\n });\n});\n"],
5
- "mappings": ";AAYA,SAAS,MAAM,kBAAkB;AACjC,SAAS,gBAAgB,QAAQ,eAAe;AAChD,SAAS,mCAAmC;AAE5C,SAAS,sBAAsB,MAAM;AACjC,KAAG,2BAA2B,YAAY;AAAA,IACtC,MAAM,eAAe,WAAW;AAAA,IAAC;AACjC,QAAI,CAAC,eAAe,IAAI,4BAA4B,GAAG;AACnD,qBAAe,OAAO,8BAA8B,MAAM;AAAA,IAC9D;AACA,UAAM,OAAO,MAAM;AAAA,MACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOJ;AACA,UAAM,KAAK,KAAK,cAAc,4BAA4B;AAC1D,UAAM,UAAU,KAAK,cAAc,MAAM;AACzC,UAAM,UAAU,KAAK,cAAc,MAAM;AACzC,UAAM,aAAa,IAAI,4BAA4B,EAAgB;AACnE,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AACjC,eAAW,WAAW;AACtB,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAC7C,SAAK,sBAAsB,cAAc,OAAO;AAChD,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAC7C,YAAQ,aAAa,SAAS,YAAY;AAC1C,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAC7C,YAAQ,aAAa,SAAS,QAAQ;AACtC,UAAM,eAAe,EAAE;AACvB,WAAO,WAAW,YAAY,OAAO,EAAE,GAAG,GAAG;AAAA,EACjD,CAAC;AACL,CAAC;",
6
- "names": []
7
- }
package/test/helpers.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- export const createLanguageContext = (lang) => {
3
- let language = lang;
4
- const updateLanguage = (lang2) => {
5
- language = lang2;
6
- resolveLanguage();
7
- };
8
- const langResolvers = [];
9
- const createLangResolver = (event) => {
10
- langResolvers.push([
11
- event.detail.callback,
12
- () => langResolvers.splice(langResolvers.length, 1)
13
- ]);
14
- resolveLanguage();
15
- };
16
- const resolveLanguage = () => {
17
- langResolvers.forEach(
18
- ([resolver, unsubscribe]) => resolver(language, unsubscribe)
19
- );
20
- };
21
- return [createLangResolver, updateLanguage];
22
- };
23
- //# sourceMappingURL=helpers.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["helpers.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 { ProvideLang } from '@spectrum-web-components/theme';\n\nexport const createLanguageContext = (\n lang: string\n): [(event: CustomEvent<ProvideLang>) => void, (lang: string) => void] => {\n let language = lang;\n const updateLanguage = (lang: string): void => {\n language = lang;\n resolveLanguage();\n };\n const langResolvers: [ProvideLang['callback'], () => void][] = [];\n const createLangResolver = (event: CustomEvent<ProvideLang>): void => {\n langResolvers.push([\n event.detail.callback,\n () => langResolvers.splice(langResolvers.length, 1),\n ]);\n resolveLanguage();\n };\n const resolveLanguage = (): void => {\n langResolvers.forEach(([resolver, unsubscribe]) =>\n resolver(language, unsubscribe)\n );\n };\n return [createLangResolver, updateLanguage];\n};\n"],
5
- "mappings": ";AAcO,aAAM,wBAAwB,CACjC,SACsE;AACtE,MAAI,WAAW;AACf,QAAM,iBAAiB,CAACA,UAAuB;AAC3C,eAAWA;AACX,oBAAgB;AAAA,EACpB;AACA,QAAM,gBAAyD,CAAC;AAChE,QAAM,qBAAqB,CAAC,UAA0C;AAClE,kBAAc,KAAK;AAAA,MACf,MAAM,OAAO;AAAA,MACb,MAAM,cAAc,OAAO,cAAc,QAAQ,CAAC;AAAA,IACtD,CAAC;AACD,oBAAgB;AAAA,EACpB;AACA,QAAM,kBAAkB,MAAY;AAChC,kBAAc;AAAA,MAAQ,CAAC,CAAC,UAAU,WAAW,MACzC,SAAS,UAAU,WAAW;AAAA,IAClC;AAAA,EACJ;AACA,SAAO,CAAC,oBAAoB,cAAc;AAC9C;",
6
- "names": ["lang"]
7
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- import { html, LitElement } from "lit";
3
- import { expect, fixture, nextFrame } from "@open-wc/testing";
4
- import { setViewport } from "@web/test-runner-commands";
5
- import { MatchMediaController } from "@spectrum-web-components/reactive-controllers/src/MatchMedia.js";
6
- class TestEl extends LitElement {
7
- }
8
- customElements.define("test-match-media-el", TestEl);
9
- describe("Match Media", () => {
10
- it("responds to media changes", async () => {
11
- const el = await fixture(
12
- html`
13
- <test-match-media-el></test-match-media-el>
14
- `
15
- );
16
- const controller = new MatchMediaController(
17
- el,
18
- "(min-width: 500px)"
19
- );
20
- await nextFrame();
21
- await nextFrame();
22
- expect(controller.matches).to.be.true;
23
- await setViewport({ width: 360, height: 640 });
24
- await nextFrame();
25
- await nextFrame();
26
- expect(controller.matches).to.be.false;
27
- });
28
- });
29
- //# sourceMappingURL=match-media.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["match-media.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, LitElement } from 'lit';\nimport { expect, fixture, nextFrame } from '@open-wc/testing';\nimport { setViewport } from '@web/test-runner-commands';\nimport { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\n\nclass TestEl extends LitElement {}\ncustomElements.define('test-match-media-el', TestEl);\n\ndescribe('Match Media', () => {\n it('responds to media changes', async () => {\n const el = await fixture(\n html`\n <test-match-media-el></test-match-media-el>\n `\n );\n const controller = new MatchMediaController(\n el as LitElement & { shadowRoot: ShadowRoot },\n '(min-width: 500px)'\n );\n // Allow Controller to initialize\n await nextFrame();\n await nextFrame();\n expect(controller.matches).to.be.true;\n\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n await nextFrame();\n expect(controller.matches).to.be.false;\n });\n});\n"],
5
- "mappings": ";AAYA,SAAS,MAAM,kBAAkB;AACjC,SAAS,QAAQ,SAAS,iBAAiB;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AAErC,MAAM,eAAe,WAAW;AAAC;AACjC,eAAe,OAAO,uBAAuB,MAAM;AAEnD,SAAS,eAAe,MAAM;AAC1B,KAAG,6BAA6B,YAAY;AACxC,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AACA,UAAM,aAAa,IAAI;AAAA,MACnB;AAAA,MACA;AAAA,IACJ;AAEA,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AAEjC,UAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,UAAM,UAAU;AAChB,UAAM,UAAU;AAChB,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AAAA,EACrC,CAAC;AACL,CAAC;",
6
- "names": []
7
- }
@@ -1,128 +0,0 @@
1
- "use strict";
2
- import { expect, fixture, html } from "@open-wc/testing";
3
- import "@spectrum-web-components/progress-circle/sp-progress-circle.js";
4
- import "@spectrum-web-components/picker/sp-picker.js";
5
- describe("PendingStateController", () => {
6
- let host;
7
- let controller;
8
- beforeEach(async () => {
9
- host = await fixture(html`
10
- <sp-picker aria-label="clickable" pending></sp-picker>
11
- `);
12
- controller = host.pendingStateController;
13
- });
14
- describe("renderPendingState", () => {
15
- it("should change aria-label of host when pending and when not pending", async () => {
16
- host = await fixture(html`
17
- <sp-picker></sp-picker>
18
- `);
19
- controller = host.pendingStateController;
20
- host.setAttribute("pending", "true");
21
- await host.updateComplete;
22
- let ariaLabel = host.getAttribute("aria-label");
23
- expect(ariaLabel).to.equal("Pending");
24
- host.removeAttribute("pending");
25
- await host.updateComplete;
26
- ariaLabel = host.getAttribute("aria-label");
27
- expect(ariaLabel).to.equal(null);
28
- host.setAttribute("aria-label", "clickable");
29
- await host.updateComplete;
30
- ariaLabel = host.getAttribute("aria-label");
31
- expect(ariaLabel).to.equal("clickable");
32
- host.setAttribute("pending", "true");
33
- await host.updateComplete;
34
- ariaLabel = host.getAttribute("aria-label");
35
- expect(ariaLabel).to.equal("Pending");
36
- host.removeAttribute("pending");
37
- await host.updateComplete;
38
- ariaLabel = host.getAttribute("aria-label");
39
- expect(ariaLabel).to.equal("clickable");
40
- host.setAttribute("pending", "true");
41
- await host.updateComplete;
42
- ariaLabel = host.getAttribute("aria-label");
43
- expect(ariaLabel).to.equal("Pending");
44
- });
45
- it("should render the pending state UI", async () => {
46
- const pendingLabel = "Custom Pending Label";
47
- host.pendingLabel = pendingLabel;
48
- const templateResult = controller.renderPendingState();
49
- const renderedElement = await fixture(html`
50
- ${templateResult}
51
- `);
52
- const expectedElement = await fixture(html`
53
- <sp-progress-circle
54
- id="loader"
55
- size="s"
56
- indeterminate
57
- aria-valuetext=${pendingLabel}
58
- class="progress-circle"
59
- ></sp-progress-circle>
60
- `);
61
- expect(renderedElement.outerHTML === expectedElement.outerHTML).to.be.true;
62
- });
63
- it("should render the default pending state UI if no label is provided", async () => {
64
- host.pendingLabel = void 0;
65
- const templateResult = controller.renderPendingState();
66
- const renderedElement = await fixture(html`
67
- ${templateResult}
68
- `);
69
- const expectedElement = await fixture(html`
70
- <sp-progress-circle
71
- id="loader"
72
- size="s"
73
- indeterminate
74
- aria-valuetext="Pending"
75
- class="progress-circle"
76
- ></sp-progress-circle>
77
- `);
78
- const renderedAttributes = renderedElement.attributes;
79
- const expectedAttributes = expectedElement.attributes;
80
- expect(renderedAttributes.length === expectedAttributes.length).to.be.true;
81
- for (let i = 0; i < renderedAttributes.length; i++) {
82
- const renderedAttr = renderedAttributes[i];
83
- const expectedAttr = expectedAttributes.getNamedItem(
84
- renderedAttr.name
85
- );
86
- expect(renderedAttr.value === (expectedAttr == null ? void 0 : expectedAttr.value)).to.be.true;
87
- }
88
- expect(host.pending).to.be.true;
89
- });
90
- it("should toggle the pending state on and off and preserve the component state correctly", async () => {
91
- var _a, _b, _c;
92
- host.setAttribute("pending", "true");
93
- await host.updateComplete;
94
- let progressCircle = (_a = host.shadowRoot) == null ? void 0 : _a.querySelector("sp-progress-circle");
95
- expect(progressCircle).to.not.be.null;
96
- host.removeAttribute("pending");
97
- await host.updateComplete;
98
- progressCircle = (_b = host.shadowRoot) == null ? void 0 : _b.querySelector("sp-progress-circle");
99
- expect(progressCircle).to.be.null;
100
- host.setAttribute("pending", "true");
101
- await host.updateComplete;
102
- progressCircle = (_c = host.shadowRoot) == null ? void 0 : _c.querySelector("sp-progress-circle");
103
- expect(progressCircle).to.not.be.null;
104
- const expectedElement = await fixture(html`
105
- <sp-progress-circle
106
- id="loader"
107
- size="s"
108
- indeterminate
109
- aria-valuetext="Pending"
110
- class="progress-circle"
111
- ></sp-progress-circle>
112
- `);
113
- const renderedAttributes = progressCircle == null ? void 0 : progressCircle.attributes;
114
- const expectedAttributes = expectedElement.attributes;
115
- expect((renderedAttributes == null ? void 0 : renderedAttributes.length) === expectedAttributes.length).to.be.true;
116
- if (renderedAttributes) {
117
- for (let i = 0; i < renderedAttributes.length; i++) {
118
- const renderedAttr = renderedAttributes[i];
119
- const expectedAttr = expectedAttributes.getNamedItem(
120
- renderedAttr.name
121
- );
122
- expect(renderedAttr.value === (expectedAttr == null ? void 0 : expectedAttr.value)).to.be.true;
123
- }
124
- }
125
- });
126
- });
127
- });
128
- //# sourceMappingURL=pending-state.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["pending-state.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\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 { expect, fixture, html } from '@open-wc/testing';\nimport {\n HostWithPendingState,\n PendingStateController,\n} from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nimport '@spectrum-web-components/progress-circle/sp-progress-circle.js';\nimport '@spectrum-web-components/picker/sp-picker.js';\n\ndescribe('PendingStateController', () => {\n let host: HostWithPendingState;\n let controller: PendingStateController<HostWithPendingState>;\n\n beforeEach(async () => {\n host = await fixture<HostWithPendingState>(html`\n <sp-picker aria-label=\"clickable\" pending></sp-picker>\n `);\n controller = host.pendingStateController;\n });\n\n describe('renderPendingState', () => {\n it('should change aria-label of host when pending and when not pending', async () => {\n host = await fixture<HostWithPendingState>(html`\n <sp-picker></sp-picker>\n `);\n controller = host.pendingStateController;\n\n host.setAttribute('pending', 'true');\n await host.updateComplete;\n\n let ariaLabel = host.getAttribute('aria-label');\n expect(ariaLabel).to.equal('Pending');\n\n host.removeAttribute('pending');\n await host.updateComplete;\n\n ariaLabel = host.getAttribute('aria-label');\n expect(ariaLabel).to.equal(null);\n\n host.setAttribute('aria-label', 'clickable');\n await host.updateComplete;\n ariaLabel = host.getAttribute('aria-label');\n expect(ariaLabel).to.equal('clickable');\n host.setAttribute('pending', 'true');\n\n await host.updateComplete;\n ariaLabel = host.getAttribute('aria-label');\n expect(ariaLabel).to.equal('Pending');\n\n host.removeAttribute('pending');\n await host.updateComplete;\n ariaLabel = host.getAttribute('aria-label');\n expect(ariaLabel).to.equal('clickable');\n\n host.setAttribute('pending', 'true');\n await host.updateComplete;\n ariaLabel = host.getAttribute('aria-label');\n expect(ariaLabel).to.equal('Pending');\n });\n\n it('should render the pending state UI', async () => {\n const pendingLabel = 'Custom Pending Label';\n host.pendingLabel = pendingLabel;\n const templateResult = controller.renderPendingState();\n\n const renderedElement = await fixture(html`\n ${templateResult}\n `);\n const expectedElement = await fixture(html`\n <sp-progress-circle\n id=\"loader\"\n size=\"s\"\n indeterminate\n aria-valuetext=${pendingLabel}\n class=\"progress-circle\"\n ></sp-progress-circle>\n `);\n\n expect(renderedElement.outerHTML === expectedElement.outerHTML).to\n .be.true;\n });\n\n it('should render the default pending state UI if no label is provided', async () => {\n host.pendingLabel = undefined;\n const templateResult = controller.renderPendingState();\n const renderedElement = await fixture(html`\n ${templateResult}\n `);\n const expectedElement = await fixture(html`\n <sp-progress-circle\n id=\"loader\"\n size=\"s\"\n indeterminate\n aria-valuetext=\"Pending\"\n class=\"progress-circle\"\n ></sp-progress-circle>\n `);\n\n const renderedAttributes = renderedElement.attributes;\n const expectedAttributes = expectedElement.attributes;\n\n expect(renderedAttributes.length === expectedAttributes.length).to\n .be.true;\n\n for (let i = 0; i < renderedAttributes.length; i++) {\n const renderedAttr = renderedAttributes[i];\n const expectedAttr = expectedAttributes.getNamedItem(\n renderedAttr.name\n );\n\n expect(renderedAttr.value === expectedAttr?.value).to.be.true;\n }\n expect(host.pending).to.be.true;\n });\n\n it('should toggle the pending state on and off and preserve the component state correctly', async () => {\n // Set initial pending state to true\n host.setAttribute('pending', 'true');\n await host.updateComplete;\n let progressCircle =\n host.shadowRoot?.querySelector('sp-progress-circle');\n expect(progressCircle).to.not.be.null;\n host.removeAttribute('pending');\n await host.updateComplete;\n progressCircle =\n host.shadowRoot?.querySelector('sp-progress-circle');\n expect(progressCircle).to.be.null;\n host.setAttribute('pending', 'true');\n await host.updateComplete;\n progressCircle =\n host.shadowRoot?.querySelector('sp-progress-circle');\n expect(progressCircle).to.not.be.null;\n const expectedElement = await fixture(html`\n <sp-progress-circle\n id=\"loader\"\n size=\"s\"\n indeterminate\n aria-valuetext=\"Pending\"\n class=\"progress-circle\"\n ></sp-progress-circle>\n `);\n\n const renderedAttributes = progressCircle?.attributes;\n const expectedAttributes = expectedElement.attributes;\n expect(renderedAttributes?.length === expectedAttributes.length).to\n .be.true;\n if (renderedAttributes) {\n for (let i = 0; i < renderedAttributes.length; i++) {\n const renderedAttr = renderedAttributes[i];\n const expectedAttr = expectedAttributes.getNamedItem(\n renderedAttr.name\n );\n\n expect(renderedAttr.value === expectedAttr?.value).to.be\n .true;\n }\n }\n });\n });\n});\n"],
5
- "mappings": ";AAaA,SAAS,QAAQ,SAAS,YAAY;AAMtC,OAAO;AACP,OAAO;AAEP,SAAS,0BAA0B,MAAM;AACrC,MAAI;AACJ,MAAI;AAEJ,aAAW,YAAY;AACnB,WAAO,MAAM,QAA8B;AAAA;AAAA,SAE1C;AACD,iBAAa,KAAK;AAAA,EACtB,CAAC;AAED,WAAS,sBAAsB,MAAM;AACjC,OAAG,sEAAsE,YAAY;AACjF,aAAO,MAAM,QAA8B;AAAA;AAAA,aAE1C;AACD,mBAAa,KAAK;AAElB,WAAK,aAAa,WAAW,MAAM;AACnC,YAAM,KAAK;AAEX,UAAI,YAAY,KAAK,aAAa,YAAY;AAC9C,aAAO,SAAS,EAAE,GAAG,MAAM,SAAS;AAEpC,WAAK,gBAAgB,SAAS;AAC9B,YAAM,KAAK;AAEX,kBAAY,KAAK,aAAa,YAAY;AAC1C,aAAO,SAAS,EAAE,GAAG,MAAM,IAAI;AAE/B,WAAK,aAAa,cAAc,WAAW;AAC3C,YAAM,KAAK;AACX,kBAAY,KAAK,aAAa,YAAY;AAC1C,aAAO,SAAS,EAAE,GAAG,MAAM,WAAW;AACtC,WAAK,aAAa,WAAW,MAAM;AAEnC,YAAM,KAAK;AACX,kBAAY,KAAK,aAAa,YAAY;AAC1C,aAAO,SAAS,EAAE,GAAG,MAAM,SAAS;AAEpC,WAAK,gBAAgB,SAAS;AAC9B,YAAM,KAAK;AACX,kBAAY,KAAK,aAAa,YAAY;AAC1C,aAAO,SAAS,EAAE,GAAG,MAAM,WAAW;AAEtC,WAAK,aAAa,WAAW,MAAM;AACnC,YAAM,KAAK;AACX,kBAAY,KAAK,aAA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AM,KAAK;AACX,wBACI,UAAK,eAAL,mBAAiB,cAAc;AACnC,aAAO,cAAc,EAAE,GAAG,GAAG;AAC7B,WAAK,aAAa,WAAW,MAAM;AACnC,YAAM,KAAK;AACX,wBACI,UAAK,eAAL,mBAAiB,cAAc;AACnC,aAAO,cAAc,EAAE,GAAG,IAAI,GAAG;AACjC,YAAM,kBAAkB,MAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQrC;AAED,YAAM,qBAAqB,iDAAgB;AAC3C,YAAM,qBAAqB,gBAAgB;AAC3C,cAAO,yDAAoB,YAAW,mBAAmB,MAAM,EAAE,GAC5D,GAAG;AACR,UAAI,oBAAoB;AACpB,iBAAS,IAAI,GAAG,IAAI,mBAAmB,QAAQ,KAAK;AAChD,gBAAM,eAAe,mBAAmB,CAAC;AACzC,gBAAM,eAAe,mBAAmB;AAAA,YACpC,aAAa;AAAA,UACjB;AAEA,iBAAO,aAAa,WAAU,6CAAc,MAAK,EAAE,GAAG,GACjD;AAAA,QACT;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AACL,CAAC;",
6
- "names": []
7
- }
@@ -1,242 +0,0 @@
1
- "use strict";
2
- import "@spectrum-web-components/action-button/sp-action-button.js";
3
- import "@spectrum-web-components/action-group/sp-action-group.js";
4
- import "@spectrum-web-components/tabs/sp-tab-panel.js";
5
- import "@spectrum-web-components/tabs/sp-tab.js";
6
- import "@spectrum-web-components/tabs/sp-tabs.js";
7
- import "@spectrum-web-components/action-menu/sp-action-menu.js";
8
- import "@spectrum-web-components/menu/sp-menu.js";
9
- import "@spectrum-web-components/menu/sp-menu-item.js";
10
- import { elementUpdated, expect, fixture, nextFrame } from "@open-wc/testing";
11
- import { html } from "@spectrum-web-components/base";
12
- import { sendKeys } from "@web/test-runner-commands";
13
- import { sendMouse } from "../../../test/plugins/browser.js";
14
- const createTabs = async () => {
15
- const tabs = await fixture(html`
16
- <sp-tabs selected="second">
17
- <sp-tab label="Tab 1" value="first"></sp-tab>
18
- <sp-tab label="Tab 2" value="second"></sp-tab>
19
- <sp-tab label="Tab 3" value="third"></sp-tab>
20
- <sp-tab-panel value="first">
21
- <sp-action-group selects="single">
22
- <sp-action-button selected value="1">
23
- Single Button 1
24
- </sp-action-button>
25
- <sp-action-button value="2">
26
- Single Button 2
27
- </sp-action-button>
28
- <sp-action-button value="3">
29
- Single Button 3
30
- </sp-action-button>
31
- </sp-action-group>
32
- </sp-tab-panel>
33
- <sp-tab-panel value="second">
34
- <sp-action-group selects="multiple">
35
- <sp-action-button value="1">
36
- Multiple Button 1
37
- </sp-action-button>
38
- <sp-action-button selected value="2">
39
- Multiple Button 2
40
- </sp-action-button>
41
- <sp-action-button selected value="3">
42
- Multiple Button 3
43
- </sp-action-button>
44
- </sp-action-group>
45
- </sp-tab-panel>
46
- <sp-tab-panel value="third">
47
- <sp-action-group>
48
- <sp-action-button value="1">None Button 1</sp-action-button>
49
- <sp-action-button value="2">None Button 2</sp-action-button>
50
- <sp-action-button selected value="3">
51
- None Button 3
52
- </sp-action-button>
53
- </sp-action-group>
54
- </sp-tab-panel>
55
- </sp-tabs>
56
- `);
57
- await elementUpdated(tabs);
58
- return tabs;
59
- };
60
- const createGroup = async () => {
61
- const group = await fixture(html`
62
- <sp-action-group>
63
- <sp-action-button>Button 1</sp-action-button>
64
- <sp-action-button>Longer Button 2</sp-action-button>
65
- <sp-action-button>Short 3</sp-action-button>
66
- <sp-action-menu label="More Actions">
67
- <sp-menu-item>One</sp-menu-item>
68
- <sp-menu-item>Two</sp-menu-item>
69
- <sp-menu-item>Three</sp-menu-item>
70
- <sp-menu-item>
71
- Select some items
72
- <sp-menu slot="submenu" selects="multiple">
73
- <sp-menu-item>A</sp-menu-item>
74
- <sp-menu-item selected>B</sp-menu-item>
75
- <sp-menu-item>C</sp-menu-item>
76
- </sp-menu>
77
- </sp-menu-item>
78
- </sp-action-menu>
79
- </sp-action-group>
80
- `);
81
- await elementUpdated(group);
82
- return group;
83
- };
84
- describe("Action Group inside of Tabs", () => {
85
- it("accurately navigates the desired element", async () => {
86
- const el = await createTabs();
87
- const tab1 = el.querySelector('sp-tab[value="first"]');
88
- const tab2 = el.querySelector('sp-tab[value="second"]');
89
- const tab3 = el.querySelector('sp-tab[value="third"]');
90
- const tabPanel1 = el.querySelector(
91
- 'sp-tab-panel[value="first"]'
92
- );
93
- const tabPanel2 = el.querySelector(
94
- 'sp-tab-panel[value="second"]'
95
- );
96
- const tabPanel3 = el.querySelector(
97
- 'sp-tab-panel[value="third"]'
98
- );
99
- const actionGroup1 = tabPanel1.querySelector(
100
- "sp-action-group"
101
- );
102
- const actionGroup2 = tabPanel2.querySelector(
103
- "sp-action-group"
104
- );
105
- const actionGroup3 = tabPanel3.querySelector(
106
- "sp-action-group"
107
- );
108
- const actionButton1 = actionGroup1.querySelector(
109
- "[selected]"
110
- );
111
- const actionButton2 = actionGroup2.querySelector(
112
- "[selected]"
113
- );
114
- const actionButton3 = actionGroup3.querySelector(
115
- "[selected]"
116
- );
117
- el.focus();
118
- expect(el.contains(document.activeElement)).to.be.true;
119
- expect(document.activeElement === tab2).to.be.true;
120
- actionGroup2.focus();
121
- expect(document.activeElement === actionButton2).to.be.true;
122
- await nextFrame();
123
- await sendKeys({
124
- press: "ArrowLeft"
125
- });
126
- expect(document.activeElement === tab1).to.be.false;
127
- expect(actionGroup2.contains(document.activeElement)).to.be.true;
128
- el.focus();
129
- expect(document.activeElement === tab2).to.be.true;
130
- await sendKeys({
131
- press: "ArrowRight"
132
- });
133
- expect(document.activeElement === tab3).to.be.true;
134
- await sendKeys({
135
- press: "Enter"
136
- });
137
- expect(document.activeElement === tab3).to.be.true;
138
- actionGroup3.focus();
139
- expect(document.activeElement === actionButton3).to.be.true;
140
- await sendKeys({
141
- press: "ArrowLeft"
142
- });
143
- expect(document.activeElement === tab2).to.be.false;
144
- expect(actionGroup3.contains(document.activeElement)).to.be.true;
145
- const boundingRect = tab1.getBoundingClientRect();
146
- await sendMouse({
147
- steps: [
148
- {
149
- type: "click",
150
- position: [
151
- boundingRect.left + boundingRect.width / 2,
152
- boundingRect.top + boundingRect.height / 2
153
- ]
154
- }
155
- ]
156
- });
157
- expect(document.activeElement === tab1).to.be.true;
158
- actionGroup1.focus();
159
- expect(document.activeElement === actionButton1).to.be.true;
160
- await sendKeys({
161
- press: "ArrowRight"
162
- });
163
- expect(document.activeElement === tab2).to.be.false;
164
- expect(actionGroup1.contains(document.activeElement)).to.be.true;
165
- });
166
- });
167
- describe("Action Menu inside of Action Group", () => {
168
- it("accurately manages the tabindex of all the elements", async () => {
169
- var _a, _b;
170
- const el = await createGroup();
171
- const actionButton1 = el.querySelector(
172
- "sp-action-button:nth-child(1)"
173
- );
174
- const actionButton2 = el.querySelector(
175
- "sp-action-button:nth-child(2)"
176
- );
177
- const actionButton3 = el.querySelector(
178
- "sp-action-button:nth-child(3)"
179
- );
180
- const actionMenu = el.querySelector("sp-action-menu");
181
- el.focus();
182
- expect(document.activeElement === actionButton1).to.be.true;
183
- await sendKeys({
184
- press: "ArrowRight"
185
- });
186
- expect(document.activeElement === actionButton2).to.be.true;
187
- expect(actionButton2.tabIndex).to.equal(0);
188
- expect(actionButton1.tabIndex).to.equal(-1);
189
- expect(actionButton3.tabIndex).to.equal(-1);
190
- expect(actionMenu.tabIndex).to.equal(-1);
191
- await sendKeys({
192
- press: "ArrowRight"
193
- });
194
- expect(document.activeElement === actionButton3).to.be.true;
195
- expect(actionButton3.tabIndex).to.equal(0);
196
- expect(actionButton2.tabIndex).to.equal(-1);
197
- expect(actionButton1.tabIndex).to.equal(-1);
198
- expect(actionMenu.tabIndex).to.equal(-1);
199
- await sendKeys({
200
- press: "ArrowRight"
201
- });
202
- expect(document.activeElement === actionMenu).to.be.true;
203
- expect(actionButton3.tabIndex).to.equal(-1);
204
- expect(actionButton2.tabIndex).to.equal(-1);
205
- expect(actionButton1.tabIndex).to.equal(-1);
206
- expect((_a = actionMenu.shadowRoot) == null ? void 0 : _a.querySelector("sp-action-button")).to.exist;
207
- expect(
208
- ((_b = actionMenu.shadowRoot) == null ? void 0 : _b.querySelector(
209
- "sp-action-button"
210
- )).tabIndex
211
- ).to.equal(0);
212
- });
213
- });
214
- describe("tabIndex is cached properly", () => {
215
- it("cache is managed properly", async () => {
216
- var _a, _b, _c;
217
- const menuEl = await fixture(html`
218
- <sp-action-menu label="More Actions">
219
- <sp-menu-item>One</sp-menu-item>
220
- <sp-menu-item>Two</sp-menu-item>
221
- <sp-menu-item>Three</sp-menu-item>
222
- </sp-action-menu>
223
- `);
224
- expect(
225
- (_a = menuEl.focusElement) == null ? void 0 : _a.tabIndex,
226
- "button tabindex before disabling"
227
- ).to.equal(0);
228
- menuEl.disabled = true;
229
- await elementUpdated(menuEl);
230
- expect(
231
- (_b = menuEl.focusElement) == null ? void 0 : _b.tabIndex,
232
- "button tabindex after disabling"
233
- ).to.equal(-1);
234
- menuEl.disabled = false;
235
- await elementUpdated(menuEl);
236
- expect(
237
- (_c = menuEl.focusElement) == null ? void 0 : _c.tabIndex,
238
- "button tabindex after setting to 0"
239
- ).to.equal(0);
240
- });
241
- });
242
- //# sourceMappingURL=roving-tabindex-integration.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["roving-tabindex-integration.test.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport { ActionGroup } from '@spectrum-web-components/action-group';\nimport { ActionMenu } from '@spectrum-web-components/action-menu';\nimport '@spectrum-web-components/tabs/sp-tab-panel.js';\nimport '@spectrum-web-components/tabs/sp-tab.js';\nimport '@spectrum-web-components/tabs/sp-tabs.js';\nimport '@spectrum-web-components/action-menu/sp-action-menu.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport { Tab, TabPanel, Tabs } from '@spectrum-web-components/tabs';\nimport { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { html } from '@spectrum-web-components/base';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { sendMouse } from '../../../test/plugins/browser.js';\n\nconst createTabs = async (): Promise<Tabs> => {\n const tabs = await fixture<Tabs>(html`\n <sp-tabs selected=\"second\">\n <sp-tab label=\"Tab 1\" value=\"first\"></sp-tab>\n <sp-tab label=\"Tab 2\" value=\"second\"></sp-tab>\n <sp-tab label=\"Tab 3\" value=\"third\"></sp-tab>\n <sp-tab-panel value=\"first\">\n <sp-action-group selects=\"single\">\n <sp-action-button selected value=\"1\">\n Single Button 1\n </sp-action-button>\n <sp-action-button value=\"2\">\n Single Button 2\n </sp-action-button>\n <sp-action-button value=\"3\">\n Single Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n <sp-tab-panel value=\"second\">\n <sp-action-group selects=\"multiple\">\n <sp-action-button value=\"1\">\n Multiple Button 1\n </sp-action-button>\n <sp-action-button selected value=\"2\">\n Multiple Button 2\n </sp-action-button>\n <sp-action-button selected value=\"3\">\n Multiple Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n <sp-tab-panel value=\"third\">\n <sp-action-group>\n <sp-action-button value=\"1\">None Button 1</sp-action-button>\n <sp-action-button value=\"2\">None Button 2</sp-action-button>\n <sp-action-button selected value=\"3\">\n None Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n </sp-tabs>\n `);\n await elementUpdated(tabs);\n return tabs;\n};\n\nconst createGroup = async (): Promise<ActionGroup> => {\n const group = await fixture<ActionGroup>(html`\n <sp-action-group>\n <sp-action-button>Button 1</sp-action-button>\n <sp-action-button>Longer Button 2</sp-action-button>\n <sp-action-button>Short 3</sp-action-button>\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>Three</sp-menu-item>\n <sp-menu-item>\n Select some items\n <sp-menu slot=\"submenu\" selects=\"multiple\">\n <sp-menu-item>A</sp-menu-item>\n <sp-menu-item selected>B</sp-menu-item>\n <sp-menu-item>C</sp-menu-item>\n </sp-menu>\n </sp-menu-item>\n </sp-action-menu>\n </sp-action-group>\n `);\n await elementUpdated(group);\n return group;\n};\n\ndescribe('Action Group inside of Tabs', () => {\n it('accurately navigates the desired element', async () => {\n const el = await createTabs();\n const tab1 = el.querySelector('sp-tab[value=\"first\"]') as Tab;\n const tab2 = el.querySelector('sp-tab[value=\"second\"]');\n const tab3 = el.querySelector('sp-tab[value=\"third\"]') as Tab;\n const tabPanel1 = el.querySelector(\n 'sp-tab-panel[value=\"first\"]'\n ) as TabPanel;\n const tabPanel2 = el.querySelector(\n 'sp-tab-panel[value=\"second\"]'\n ) as TabPanel;\n const tabPanel3 = el.querySelector(\n 'sp-tab-panel[value=\"third\"]'\n ) as TabPanel;\n const actionGroup1 = tabPanel1.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionGroup2 = tabPanel2.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionGroup3 = tabPanel3.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionButton1 = actionGroup1.querySelector(\n '[selected]'\n ) as ActionButton;\n const actionButton2 = actionGroup2.querySelector(\n '[selected]'\n ) as ActionButton;\n const actionButton3 = actionGroup3.querySelector(\n '[selected]'\n ) as ActionButton;\n\n el.focus();\n expect(el.contains(document.activeElement)).to.be.true;\n expect(document.activeElement === tab2).to.be.true;\n\n actionGroup2.focus();\n expect(document.activeElement === actionButton2).to.be.true;\n\n await nextFrame();\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n expect(document.activeElement === tab1).to.be.false;\n expect(actionGroup2.contains(document.activeElement)).to.be.true;\n\n el.focus();\n expect(document.activeElement === tab2).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === tab3).to.be.true;\n\n await sendKeys({\n press: 'Enter',\n });\n\n expect(document.activeElement === tab3).to.be.true;\n\n actionGroup3.focus();\n expect(document.activeElement === actionButton3).to.be.true;\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n expect(document.activeElement === tab2).to.be.false;\n expect(actionGroup3.contains(document.activeElement)).to.be.true;\n\n const boundingRect = tab1.getBoundingClientRect();\n // tab1.click() doesn't current reach into the focus management here.\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.left + boundingRect.width / 2,\n boundingRect.top + boundingRect.height / 2,\n ],\n },\n ],\n });\n expect(document.activeElement === tab1).to.be.true;\n\n actionGroup1.focus();\n expect(document.activeElement === actionButton1).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === tab2).to.be.false;\n expect(actionGroup1.contains(document.activeElement)).to.be.true;\n });\n});\n\ndescribe('Action Menu inside of Action Group', () => {\n it('accurately manages the tabindex of all the elements', async () => {\n const el = await createGroup();\n const actionButton1 = el.querySelector(\n 'sp-action-button:nth-child(1)'\n ) as ActionButton;\n const actionButton2 = el.querySelector(\n 'sp-action-button:nth-child(2)'\n ) as ActionButton;\n const actionButton3 = el.querySelector(\n 'sp-action-button:nth-child(3)'\n ) as ActionButton;\n const actionMenu = el.querySelector('sp-action-menu') as ActionMenu;\n\n el.focus();\n expect(document.activeElement === actionButton1).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === actionButton2).to.be.true;\n\n // expect the focused element to have a tabindex of 0 and everyone else to be -1\n expect(actionButton2.tabIndex).to.equal(0);\n expect(actionButton1.tabIndex).to.equal(-1);\n expect(actionButton3.tabIndex).to.equal(-1);\n expect(actionMenu.tabIndex).to.equal(-1);\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === actionButton3).to.be.true;\n\n // expect the focused element to have a tabindex of 0 and everyone else to be -1\n expect(actionButton3.tabIndex).to.equal(0);\n expect(actionButton2.tabIndex).to.equal(-1);\n expect(actionButton1.tabIndex).to.equal(-1);\n expect(actionMenu.tabIndex).to.equal(-1);\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === actionMenu).to.be.true;\n\n // expect the action-button inside of the shadow root of the action-menu to have a tabindex of 0 and everyone else to be -1\n expect(actionButton3.tabIndex).to.equal(-1);\n expect(actionButton2.tabIndex).to.equal(-1);\n expect(actionButton1.tabIndex).to.equal(-1);\n expect(actionMenu.shadowRoot?.querySelector('sp-action-button')).to\n .exist;\n expect(\n (\n actionMenu.shadowRoot?.querySelector(\n 'sp-action-button'\n ) as ActionButton\n ).tabIndex\n ).to.equal(0);\n });\n});\n\ndescribe('tabIndex is cached properly', () => {\n it('cache is managed properly', async () => {\n const menuEl = await fixture<ActionMenu>(html`\n <sp-action-menu label=\"More Actions\">\n <sp-menu-item>One</sp-menu-item>\n <sp-menu-item>Two</sp-menu-item>\n <sp-menu-item>Three</sp-menu-item>\n </sp-action-menu>\n `);\n\n expect(\n menuEl.focusElement?.tabIndex,\n 'button tabindex before disabling'\n ).to.equal(0);\n\n menuEl.disabled = true;\n\n await elementUpdated(menuEl);\n\n expect(\n menuEl.focusElement?.tabIndex,\n 'button tabindex after disabling'\n ).to.equal(-1);\n\n menuEl.disabled = false;\n\n await elementUpdated(menuEl);\n\n expect(\n menuEl.focusElement?.tabIndex,\n 'button tabindex after setting to 0'\n ).to.equal(0);\n });\n});\n"],
5
- "mappings": ";AAWA,OAAO;AAEP,OAAO;AAGP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,gB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E;AAEvC,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,WAAO,SAAS,kBAAkB,UAAU,EAAE,GAAG,GAAG;AAGpD,WAAO,cAAc,QAAQ,EAAE,GAAG,MAAM,EAAE;AAC1C,WAAO,cAAc,QAAQ,EAAE,GAAG,MAAM,EAAE;AAC1C,WAAO,cAAc,QAAQ,EAAE,GAAG,MAAM,EAAE;AAC1C,YAAO,gBAAW,eAAX,mBAAuB,cAAc,mBAAmB,EAAE,GAC5D;AACL;AAAA,QAEQ,gBAAW,eAAX,mBAAuB;AAAA,QACnB;AAAA,SAEN;AAAA,IACN,EAAE,GAAG,MAAM,CAAC;AAAA,EAChB,CAAC;AACL,CAAC;AAED,SAAS,+BAA+B,MAAM;AAC1C,KAAG,6BAA6B,YAAY;AAzQhD;AA0QQ,UAAM,SAAS,MAAM,QAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAMxC;AAED;AAAA,OACI,YAAO,iBAAP,mBAAqB;AAAA,MACrB;AAAA,IACJ,EAAE,GAAG,MAAM,CAAC;AAEZ,WAAO,WAAW;AAElB,UAAM,eAAe,MAAM;AAE3B;AAAA,OACI,YAAO,iBAAP,mBAAqB;AAAA,MACrB;AAAA,IACJ,EAAE,GAAG,MAAM,EAAE;AAEb,WAAO,WAAW;AAElB,UAAM,eAAe,MAAM;AAE3B;AAAA,OACI,YAAO,iBAAP,mBAAqB;AAAA,MACrB;AAAA,IACJ,EAAE,GAAG,MAAM,CAAC;AAAA,EAChB,CAAC;AACL,CAAC;",
6
- "names": []
7
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- import { LitElement } from "lit";
3
- import { expect } from "@open-wc/testing";
4
- import { RovingTabindexController } from "@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";
5
- describe("RovingTabindex", () => {
6
- it("constructs with defaults", async () => {
7
- class TestEl extends LitElement {
8
- }
9
- customElements.define("test-roving-tabindex-el", TestEl);
10
- const el = new TestEl();
11
- const controller = new RovingTabindexController(
12
- el
13
- );
14
- expect(controller.direction).to.equal("both");
15
- expect(controller.focusInIndex).to.equal(0);
16
- expect(controller.isFocusableElement(el)).to.be.true;
17
- });
18
- });
19
- //# sourceMappingURL=roving-tabindex.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["roving-tabindex.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 { LitElement } from 'lit';\nimport { expect } from '@open-wc/testing';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\ndescribe('RovingTabindex', () => {\n it('constructs with defaults', async () => {\n class TestEl extends LitElement {}\n customElements.define('test-roving-tabindex-el', TestEl);\n const el = new TestEl();\n const controller = new RovingTabindexController(\n el as LitElement & { shadowRoot: ShadowRoot }\n );\n expect(controller.direction).to.equal('both');\n expect(controller.focusInIndex).to.equal(0);\n expect(controller.isFocusableElement(el)).to.be.true;\n });\n});\n"],
5
- "mappings": ";AAYA,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,gCAAgC;AAEzC,SAAS,kBAAkB,MAAM;AAC7B,KAAG,4BAA4B,YAAY;AAAA,IACvC,MAAM,eAAe,WAAW;AAAA,IAAC;AACjC,mBAAe,OAAO,2BAA2B,MAAM;AACvD,UAAM,KAAK,IAAI,OAAO;AACtB,UAAM,aAAa,IAAI;AAAA,MACnB;AAAA,IACJ;AACA,WAAO,WAAW,SAAS,EAAE,GAAG,MAAM,MAAM;AAC5C,WAAO,WAAW,YAAY,EAAE,GAAG,MAAM,CAAC;AAC1C,WAAO,WAAW,mBAAmB,EAAE,CAAC,EAAE,GAAG,GAAG;AAAA,EACpD,CAAC;AACL,CAAC;",
6
- "names": []
7
- }