@spectrum-web-components/card 0.10.6 → 0.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/card",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,11 +46,11 @@
46
46
  "dependencies": {
47
47
  "@spectrum-web-components/asset": "^0.6.5",
48
48
  "@spectrum-web-components/base": "^0.5.4",
49
- "@spectrum-web-components/checkbox": "^0.12.6",
49
+ "@spectrum-web-components/checkbox": "^0.12.7",
50
50
  "@spectrum-web-components/icons-workflow": "^0.8.5",
51
51
  "@spectrum-web-components/quick-actions": "^0.6.5",
52
- "@spectrum-web-components/shared": "^0.13.6",
53
- "@spectrum-web-components/styles": "^0.12.1",
52
+ "@spectrum-web-components/shared": "^0.13.7",
53
+ "@spectrum-web-components/styles": "^0.12.2",
54
54
  "tslib": "^2.0.0"
55
55
  },
56
56
  "devDependencies": {
@@ -61,5 +61,5 @@
61
61
  "sideEffects": [
62
62
  "./sp-*.js"
63
63
  ],
64
- "gitHead": "caf12727e7f91dcf961e1fadacc727eea9ece27b"
64
+ "gitHead": "dd76f9532fdea946880147cc7645f113b998c326"
65
65
  }
@@ -0,0 +1,26 @@
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/card/sp-card.js';
13
+ import { html } from 'lit';
14
+ import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
15
+ measureFixtureCreation(html `
16
+ <sp-card variant="gallery" heading="Card Heading" subheading="JPG">
17
+ <img
18
+ slot="preview"
19
+ src="https://picsum.photos/532/192"
20
+ alt="Demo Graphic"
21
+ />
22
+ <div slot="description">10/15/18</div>
23
+ <div slot="footer">Footer</div>
24
+ </sp-card>
25
+ `);
26
+ //# sourceMappingURL=test-basic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-basic.js","sourceRoot":"","sources":["test-basic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,sBAAsB,CAAC,IAAI,CAAA;;;;;;;;;;CAU1B,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/card/sp-card.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-card variant=\"gallery\" heading=\"Card Heading\" subheading=\"JPG\">\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Demo Graphic\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n`);\n"]}
@@ -0,0 +1,15 @@
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/card.stories.js';
13
+ import { regressVisuals } from '../../../test/visual/test.js';
14
+ regressVisuals('CardStories', stories);
15
+ //# sourceMappingURL=card.test-vrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.test-vrt.js","sourceRoot":"","sources":["card.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,aAAa,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/card.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('CardStories', stories);\n"]}
@@ -0,0 +1,326 @@
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-card.js';
13
+ import '@spectrum-web-components/action-menu/sp-action-menu.js';
14
+ import '@spectrum-web-components/menu/sp-menu.js';
15
+ import '@spectrum-web-components/menu/sp-menu-item.js';
16
+ import '@spectrum-web-components/menu/sp-menu-divider.js';
17
+ import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
18
+ import { Default, href, smallHorizontal, } from '../stories/card.stories.js';
19
+ import { spy } from 'sinon';
20
+ import { spaceEvent } from '../../../test/testing-helpers.js';
21
+ import { sendMouse } from '../../../test/plugins/browser.js';
22
+ describe('card', () => {
23
+ it('loads', async () => {
24
+ const el = await fixture(html `
25
+ <sp-card heading="Card Heading" subheading="JPG">
26
+ <img
27
+ slot="preview"
28
+ src="https://picsum.photos/532/192"
29
+ alt="Slotted Preview"
30
+ />
31
+ <div slot="footer">Footer</div>
32
+ </sp-card>
33
+ `);
34
+ await elementUpdated(el);
35
+ await expect(el).to.be.accessible();
36
+ });
37
+ it('loads - [quiet]', async () => {
38
+ const el = await fixture(html `
39
+ <sp-card
40
+ variant="quiet"
41
+ heading="Card Heading"
42
+ subheading="JPG"
43
+ >
44
+ <img
45
+ slot="preview"
46
+ src="https://picsum.photos/532/192"
47
+ alt="Slotted Preview"
48
+ />
49
+ <div slot="description">10/15/18</div>
50
+ <div slot="footer">Footer</div>
51
+ </sp-card>
52
+ `);
53
+ await elementUpdated(el);
54
+ await expect(el).to.be.accessible();
55
+ });
56
+ it('loads - [quiet][small]', async () => {
57
+ const el = await fixture(html `
58
+ <sp-card
59
+ size="s"
60
+ heading="Card Heading"
61
+ subheading="JPG"
62
+ variant="quiet"
63
+ style="width: 115px;"
64
+ >
65
+ <img
66
+ src="https://picsum.photos/300/400"
67
+ alt="Demo Graphic"
68
+ slot="preview"
69
+ />
70
+ <div slot="footer">Footer</div>
71
+ <sp-action-menu
72
+ slot="actions"
73
+ placement="bottom-end"
74
+ label="More Actions"
75
+ >
76
+ <sp-menu>
77
+ <sp-menu-item>Deselect</sp-menu-item>
78
+ <sp-menu-item>Select Inverse</sp-menu-item>
79
+ <sp-menu-item>Feather...</sp-menu-item>
80
+ <sp-menu-item>Select and Mask...</sp-menu-item>
81
+ <sp-menu-divider></sp-menu-divider>
82
+ <sp-menu-item>Save Selection</sp-menu-item>
83
+ <sp-menu-item disabled>Make Work Path</sp-menu-item>
84
+ </sp-menu>
85
+ </sp-action-menu>
86
+ </sp-card>
87
+ `);
88
+ await elementUpdated(el);
89
+ await expect(el).to.be.accessible();
90
+ });
91
+ it('loads - [gallery]', async () => {
92
+ const el = await fixture(html `
93
+ <sp-card
94
+ variant="gallery"
95
+ heading="Card Heading"
96
+ subheading="JPG"
97
+ >
98
+ <img
99
+ slot="preview"
100
+ src="https://picsum.photos/532/192"
101
+ alt="Slotted Preview"
102
+ />
103
+ <div slot="description">10/15/18</div>
104
+ <div slot="footer">Footer</div>
105
+ </sp-card>
106
+ `);
107
+ await elementUpdated(el);
108
+ await expect(el).to.be.accessible();
109
+ });
110
+ it('loads - [horizontal]', async () => {
111
+ const el = await fixture(smallHorizontal(smallHorizontal.args));
112
+ await elementUpdated(el);
113
+ await expect(el).to.be.accessible();
114
+ });
115
+ it('[href] is clickable', async () => {
116
+ const clickSpy = spy();
117
+ const el = await fixture(href({}));
118
+ await elementUpdated(el);
119
+ el.addEventListener('click', (event) => {
120
+ const composedTarget = event.composedPath()[0];
121
+ if (composedTarget.id !== 'like-anchor')
122
+ return;
123
+ clickSpy();
124
+ });
125
+ el.click();
126
+ expect(clickSpy.callCount).to.equal(1);
127
+ el.shadowRoot.querySelector('#like-anchor').click();
128
+ expect(clickSpy.callCount).to.equal(2);
129
+ const img = el.querySelector('img');
130
+ const boundingRect = img.getBoundingClientRect();
131
+ await sendMouse({
132
+ steps: [
133
+ {
134
+ type: 'move',
135
+ position: [
136
+ boundingRect.x + boundingRect.width / 2,
137
+ boundingRect.y + boundingRect.height / 2,
138
+ ],
139
+ },
140
+ {
141
+ type: 'down',
142
+ },
143
+ {
144
+ type: 'up',
145
+ },
146
+ ],
147
+ });
148
+ expect(clickSpy.callCount).to.equal(3);
149
+ });
150
+ it('links in [href] do not pass their click', async () => {
151
+ const clickSpy = spy();
152
+ const el = await fixture(href({}));
153
+ el.setAttribute('style', [
154
+ 'width: 200px;',
155
+ 'display: inline-flex;',
156
+ '--spectrum-card-coverphoto-height: 136px;',
157
+ '--spectrum-actionbutton-height: 32px;',
158
+ '--spectrum-icon-tshirt-size-height: 18px;',
159
+ '--spectrum-icon-tshirt-size-width: 18px;',
160
+ ].join(''));
161
+ await elementUpdated(el);
162
+ el.addEventListener('click', (event) => {
163
+ event.preventDefault();
164
+ const path = event.composedPath();
165
+ const hasLikeAnchor = path.some((el) => el.id === 'like-anchor');
166
+ if (!hasLikeAnchor)
167
+ return;
168
+ clickSpy();
169
+ });
170
+ el.click();
171
+ expect(clickSpy.callCount).to.equal(1);
172
+ const footer = el.querySelector('[slot="footer"]');
173
+ let boundingRect = footer.getBoundingClientRect();
174
+ await sendMouse({
175
+ steps: [
176
+ {
177
+ type: 'move',
178
+ position: [boundingRect.x, boundingRect.y],
179
+ },
180
+ {
181
+ type: 'down',
182
+ },
183
+ {
184
+ type: 'up',
185
+ },
186
+ ],
187
+ });
188
+ expect(clickSpy.callCount).to.equal(2);
189
+ const link = el.querySelector('sp-link[href="https://google.com"]');
190
+ link.setAttribute('style', 'display: block');
191
+ boundingRect = link.getBoundingClientRect();
192
+ await sendMouse({
193
+ steps: [
194
+ {
195
+ type: 'move',
196
+ position: [boundingRect.x + 1, boundingRect.y + 1],
197
+ },
198
+ {
199
+ type: 'down',
200
+ },
201
+ {
202
+ type: 'up',
203
+ },
204
+ ],
205
+ });
206
+ expect(clickSpy.callCount).to.equal(2);
207
+ });
208
+ it('converts `Space` to `click` event', async () => {
209
+ const clickSpy = spy();
210
+ const handleClick = () => clickSpy();
211
+ const el = await fixture(Default(Default.args));
212
+ el.addEventListener('click', handleClick);
213
+ await elementUpdated(el);
214
+ expect(el.focused, 'default focused').to.be.false;
215
+ el.dispatchEvent(new Event('focusin'));
216
+ await elementUpdated(el);
217
+ expect(el.focused, 'first time focused').to.be.true;
218
+ el.dispatchEvent(spaceEvent());
219
+ await elementUpdated(el);
220
+ expect(el.focused, 'still focused').to.be.true;
221
+ expect(clickSpy.called).to.be.true;
222
+ expect(clickSpy.calledOnce).to.be.true;
223
+ });
224
+ it('can be `[toggles]`', async () => {
225
+ const el = await fixture(Default(Default.args));
226
+ el.toggles = true;
227
+ await elementUpdated(el);
228
+ const checkbox = el.shadowRoot.querySelector('sp-checkbox');
229
+ expect(el.focused, 'default focused').to.be.false;
230
+ expect(el.selected, 'default selected').to.be.false;
231
+ el.dispatchEvent(new Event('focusin'));
232
+ await elementUpdated(el);
233
+ expect(el.focused, 'first time focused').to.be.true;
234
+ expect(el.selected, 'still not selected').to.be.false;
235
+ el.dispatchEvent(spaceEvent());
236
+ await elementUpdated(el);
237
+ expect(el.focused, 'still focused').to.be.true;
238
+ expect(el.selected, 'first selected').to.be.true;
239
+ el.addEventListener('change', (event) => event.preventDefault());
240
+ el.dispatchEvent(spaceEvent());
241
+ await elementUpdated(el);
242
+ expect(el.focused, 'still focused after default prevented').to.be.true;
243
+ expect(el.selected, 'first selected after default prevented').to.be
244
+ .true;
245
+ checkbox.dispatchEvent(new Event('focusin', {
246
+ composed: true,
247
+ bubbles: true,
248
+ }));
249
+ checkbox.focus();
250
+ await elementUpdated(el);
251
+ expect(el.focused, 'still focused, again').to.be.true;
252
+ expect(el.selected, 'still selected').to.be.true;
253
+ el.dispatchEvent(new Event('focusin'));
254
+ await elementUpdated(el);
255
+ expect(el.focused, 'focused, again').to.be.true;
256
+ expect(el.selected, 'still selected, again').to.be.true;
257
+ el.dispatchEvent(new Event('focusout'));
258
+ await elementUpdated(el);
259
+ expect(el.focused, 'still not focused, again').to.be.false;
260
+ expect(el.selected, 'still selected, again 2').to.be.true;
261
+ el.dispatchEvent(new Event('focusout'));
262
+ checkbox.click();
263
+ await elementUpdated(el);
264
+ expect(el.focused, 'still not focused, again 2').to.be.false;
265
+ // change event is prevented
266
+ expect(el.selected, 'still selected, again 3').to.be.true;
267
+ });
268
+ it('announces when `[toggles]`', async () => {
269
+ const changeSpy = spy();
270
+ const el = await fixture(Default(Default.args));
271
+ el.toggles = true;
272
+ el.addEventListener('change', changeSpy);
273
+ await elementUpdated(el);
274
+ const checkbox = el.shadowRoot.querySelector('sp-checkbox');
275
+ expect(el.selected, 'default to not selected').to.be.false;
276
+ checkbox.click();
277
+ await elementUpdated(el);
278
+ expect(el.selected, 'selected').to.be.true;
279
+ expect(changeSpy.callCount).to.equal(1);
280
+ checkbox.click();
281
+ await elementUpdated(el);
282
+ expect(el.selected, 'no longer selected').to.be.false;
283
+ expect(changeSpy.callCount).to.equal(2);
284
+ });
285
+ it('displays the `heading` attribute as `.title`', async () => {
286
+ const testHeading = 'This is a test heading';
287
+ const el = await fixture(html `
288
+ <sp-card heading=${testHeading} subheading="JPG">
289
+ <img
290
+ slot="preview"
291
+ src="https://picsum.photos/532/192"
292
+ alt="Slotted Preview"
293
+ />
294
+ <div slot="footer">Footer</div>
295
+ </sp-card>
296
+ `);
297
+ await elementUpdated(el);
298
+ const root = el.shadowRoot ? el.shadowRoot : el;
299
+ const headingEl = root.querySelector('.title');
300
+ expect(headingEl, 'did not find title element').to.not.be.null;
301
+ expect(headingEl.textContent).to.contain(testHeading, 'the heading renders in the element');
302
+ });
303
+ it('displays the slotted content as `.title`', async () => {
304
+ const testHeading = 'This is a test heading';
305
+ const el = await fixture(html `
306
+ <sp-card subheading="JPG">
307
+ <h1 slot="heading">${testHeading}</h1>
308
+ <img
309
+ slot="preview"
310
+ src="https://picsum.photos/532/192"
311
+ alt="Slotted Preview"
312
+ />
313
+ <div slot="footer">Footer</div>
314
+ </sp-card>
315
+ `);
316
+ await elementUpdated(el);
317
+ const root = el.shadowRoot ? el.shadowRoot : el;
318
+ const headingSlot = root.querySelector('.title [name="heading"]');
319
+ expect(headingSlot, 'did not find slot element').to.not.be.null;
320
+ const nodes = headingSlot.assignedNodes();
321
+ const h1Element = nodes.find((node) => node.tagName === 'H1');
322
+ expect(h1Element, 'did not find H1 element').to.not.be.null;
323
+ expect(h1Element.textContent).to.contain(testHeading, 'the slotted content renders in the element');
324
+ });
325
+ });
326
+ //# sourceMappingURL=card.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.test.js","sourceRoot":"","sources":["card.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,eAAe,CAAC;AAEvB,OAAO,wDAAwD,CAAC;AAChE,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC;AACvD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EACH,OAAO,EACP,IAAI,EACJ,eAAe,GAElB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;QACnB,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;;;;;;;;aASH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,I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M,CAAC,SAAS,EAAE,4BAA4B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QAC/D,MAAM,CAAE,SAA4B,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,OAAO,CACxD,WAAW,EACX,oCAAoC,CACvC,CAAC;IACN,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,WAAW,GAAG,wBAAwB,CAAC;QAC7C,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;yCAEyB,WAAW;;;;;;;;aAQvC,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,IAAI,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAClC,yBAAyB,CACT,CAAC;QAErB,MAAM,CAAC,WAAW,EAAE,2BAA2B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QAChE,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC;QAC1C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CACxB,CAAC,IAAI,EAAE,EAAE,CAAE,IAAoB,CAAC,OAAO,KAAK,IAAI,CACnD,CAAC;QACF,MAAM,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QAC5D,MAAM,CAAE,SAAgC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,OAAO,CAC5D,WAAW,EACX,4CAA4C,CAC/C,CAAC;IACN,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-card.js';\nimport { Card } from '../';\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 '@spectrum-web-components/menu/sp-menu-divider.js';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport {\n Default,\n href,\n smallHorizontal,\n StoryArgs,\n} from '../stories/card.stories.js';\nimport { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';\nimport { spy } from 'sinon';\nimport { spaceEvent } from '../../../test/testing-helpers.js';\nimport { sendMouse } from '../../../test/plugins/browser.js';\n\ndescribe('card', () => {\n it('loads', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card heading=\"Card Heading\" subheading=\"JPG\">\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [quiet]', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card\n variant=\"quiet\"\n heading=\"Card Heading\"\n subheading=\"JPG\"\n >\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('loads - [quiet][small]', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card\n size=\"s\"\n heading=\"Card Heading\"\n subheading=\"JPG\"\n variant=\"quiet\"\n style=\"width: 115px;\"\n >\n <img\n src=\"https://picsum.photos/300/400\"\n alt=\"Demo Graphic\"\n slot=\"preview\"\n />\n <div slot=\"footer\">Footer</div>\n <sp-action-menu\n slot=\"actions\"\n placement=\"bottom-end\"\n label=\"More Actions\"\n >\n <sp-menu>\n <sp-menu-item>Deselect</sp-menu-item>\n <sp-menu-item>Select Inverse</sp-menu-item>\n <sp-menu-item>Feather...</sp-menu-item>\n <sp-menu-item>Select and Mask...</sp-menu-item>\n <sp-menu-divider></sp-menu-divider>\n <sp-menu-item>Save Selection</sp-menu-item>\n <sp-menu-item disabled>Make Work Path</sp-menu-item>\n </sp-menu>\n </sp-action-menu>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [gallery]', async () => {\n const el = await fixture<Card>(\n html`\n <sp-card\n variant=\"gallery\"\n heading=\"Card Heading\"\n subheading=\"JPG\"\n >\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads - [horizontal]', async () => {\n const el = await fixture<Card>(\n smallHorizontal(smallHorizontal.args as StoryArgs)\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('[href] is clickable', async () => {\n const clickSpy = spy();\n const el = await fixture<Card>(href({}));\n\n await elementUpdated(el);\n\n el.addEventListener('click', (event: Event) => {\n const composedTarget = event.composedPath()[0] as HTMLElement;\n if (composedTarget.id !== 'like-anchor') return;\n clickSpy();\n });\n\n el.click();\n\n expect(clickSpy.callCount).to.equal(1);\n\n (el.shadowRoot.querySelector('#like-anchor') as HTMLElement).click();\n\n expect(clickSpy.callCount).to.equal(2);\n\n const img = el.querySelector('img') as HTMLImageElement;\n const boundingRect = img.getBoundingClientRect();\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [\n boundingRect.x + boundingRect.width / 2,\n boundingRect.y + boundingRect.height / 2,\n ],\n },\n {\n type: 'down',\n },\n {\n type: 'up',\n },\n ],\n });\n\n expect(clickSpy.callCount).to.equal(3);\n });\n it('links in [href] do not pass their click', async () => {\n const clickSpy = spy();\n const el = await fixture<Card>(href({}));\n el.setAttribute(\n 'style',\n [\n 'width: 200px;',\n 'display: inline-flex;',\n '--spectrum-card-coverphoto-height: 136px;',\n '--spectrum-actionbutton-height: 32px;',\n '--spectrum-icon-tshirt-size-height: 18px;',\n '--spectrum-icon-tshirt-size-width: 18px;',\n ].join('')\n );\n\n await elementUpdated(el);\n el.addEventListener('click', (event: Event) => {\n event.preventDefault();\n const path = event.composedPath();\n const hasLikeAnchor = path.some(\n (el) => (el as HTMLElement).id === 'like-anchor'\n );\n if (!hasLikeAnchor) return;\n clickSpy();\n });\n\n el.click();\n\n expect(clickSpy.callCount).to.equal(1);\n\n const footer = el.querySelector('[slot=\"footer\"]') as HTMLElement;\n let boundingRect = footer.getBoundingClientRect();\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [boundingRect.x, boundingRect.y],\n },\n {\n type: 'down',\n },\n {\n type: 'up',\n },\n ],\n });\n\n expect(clickSpy.callCount).to.equal(2);\n\n const link = el.querySelector(\n 'sp-link[href=\"https://google.com\"]'\n ) as HTMLElement;\n link.setAttribute('style', 'display: block');\n boundingRect = link.getBoundingClientRect();\n await sendMouse({\n steps: [\n {\n type: 'move',\n position: [boundingRect.x + 1, boundingRect.y + 1],\n },\n {\n type: 'down',\n },\n {\n type: 'up',\n },\n ],\n });\n\n expect(clickSpy.callCount).to.equal(2);\n });\n it('converts `Space` to `click` event', async () => {\n const clickSpy = spy();\n const handleClick = (): void => clickSpy();\n const el = await fixture<Card>(Default(Default.args));\n el.addEventListener('click', handleClick);\n\n await elementUpdated(el);\n expect(el.focused, 'default focused').to.be.false;\n\n el.dispatchEvent(new Event('focusin'));\n await elementUpdated(el);\n expect(el.focused, 'first time focused').to.be.true;\n\n el.dispatchEvent(spaceEvent());\n await elementUpdated(el);\n expect(el.focused, 'still focused').to.be.true;\n expect(clickSpy.called).to.be.true;\n expect(clickSpy.calledOnce).to.be.true;\n });\n it('can be `[toggles]`', async () => {\n const el = await fixture<Card>(Default(Default.args));\n el.toggles = true;\n\n await elementUpdated(el);\n\n const checkbox = el.shadowRoot.querySelector('sp-checkbox') as Checkbox;\n expect(el.focused, 'default focused').to.be.false;\n expect(el.selected, 'default selected').to.be.false;\n\n el.dispatchEvent(new Event('focusin'));\n\n await elementUpdated(el);\n expect(el.focused, 'first time focused').to.be.true;\n expect(el.selected, 'still not selected').to.be.false;\n\n el.dispatchEvent(spaceEvent());\n\n await elementUpdated(el);\n expect(el.focused, 'still focused').to.be.true;\n expect(el.selected, 'first selected').to.be.true;\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n el.dispatchEvent(spaceEvent());\n\n await elementUpdated(el);\n expect(el.focused, 'still focused after default prevented').to.be.true;\n expect(el.selected, 'first selected after default prevented').to.be\n .true;\n\n checkbox.dispatchEvent(\n new Event('focusin', {\n composed: true,\n bubbles: true,\n })\n );\n checkbox.focus();\n\n await elementUpdated(el);\n expect(el.focused, 'still focused, again').to.be.true;\n expect(el.selected, 'still selected').to.be.true;\n\n el.dispatchEvent(new Event('focusin'));\n\n await elementUpdated(el);\n expect(el.focused, 'focused, again').to.be.true;\n expect(el.selected, 'still selected, again').to.be.true;\n\n el.dispatchEvent(new Event('focusout'));\n\n await elementUpdated(el);\n expect(el.focused, 'still not focused, again').to.be.false;\n expect(el.selected, 'still selected, again 2').to.be.true;\n\n el.dispatchEvent(new Event('focusout'));\n\n checkbox.click();\n\n await elementUpdated(el);\n expect(el.focused, 'still not focused, again 2').to.be.false;\n // change event is prevented\n expect(el.selected, 'still selected, again 3').to.be.true;\n });\n\n it('announces when `[toggles]`', async () => {\n const changeSpy = spy();\n const el = await fixture<Card>(Default(Default.args));\n el.toggles = true;\n el.addEventListener('change', changeSpy);\n\n await elementUpdated(el);\n\n const checkbox = el.shadowRoot.querySelector('sp-checkbox') as Checkbox;\n expect(el.selected, 'default to not selected').to.be.false;\n checkbox.click();\n await elementUpdated(el);\n\n expect(el.selected, 'selected').to.be.true;\n expect(changeSpy.callCount).to.equal(1);\n checkbox.click();\n await elementUpdated(el);\n\n expect(el.selected, 'no longer selected').to.be.false;\n expect(changeSpy.callCount).to.equal(2);\n });\n it('displays the `heading` attribute as `.title`', async () => {\n const testHeading = 'This is a test heading';\n const el = await fixture<Card>(\n html`\n <sp-card heading=${testHeading} subheading=\"JPG\">\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const headingEl = root.querySelector('.title');\n\n expect(headingEl, 'did not find title element').to.not.be.null;\n expect((headingEl as HTMLDivElement).textContent).to.contain(\n testHeading,\n 'the heading renders in the element'\n );\n });\n it('displays the slotted content as `.title`', async () => {\n const testHeading = 'This is a test heading';\n const el = await fixture<Card>(\n html`\n <sp-card subheading=\"JPG\">\n <h1 slot=\"heading\">${testHeading}</h1>\n <img\n slot=\"preview\"\n src=\"https://picsum.photos/532/192\"\n alt=\"Slotted Preview\"\n />\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `\n );\n\n await elementUpdated(el);\n\n const root = el.shadowRoot ? el.shadowRoot : el;\n const headingSlot = root.querySelector(\n '.title [name=\"heading\"]'\n ) as HTMLSlotElement;\n\n expect(headingSlot, 'did not find slot element').to.not.be.null;\n const nodes = headingSlot.assignedNodes();\n const h1Element = nodes.find(\n (node) => (node as HTMLElement).tagName === 'H1'\n );\n expect(h1Element, 'did not find H1 element').to.not.be.null;\n expect((h1Element as HTMLHeadingElement).textContent).to.contain(\n testHeading,\n 'the slotted content renders in the element'\n );\n });\n});\n"]}