@spectrum-web-components/grid 0.0.8 → 0.0.9-devmode.24

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.
@@ -1 +1,7 @@
1
- {"version":3,"file":"grid.stories.js","sourceRoot":"","sources":["grid.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AAErE,OAAO,eAAe,CAAC;AACvB,OAAO,sDAAsD,CAAC;AAC9D,OAAO,0CAA0C,CAAC;AAClD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,4DAA4D,CAAC;AACpE,OAAO,0DAA0D,CAAC;AAClE,OAAO,+DAA+D,CAAC;AACvE,OAAO,+DAA+D,CAAC;AAIvE,eAAe;IACX,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,SAAS;CACvB,CAAC;AAMF,SAAS,aAAa,CAAC,KAAa;IAChC,MAAM,KAAK,GAAW,EAAE,CAAC;IACzB,OAAO,KAAK,EAAE;QACV,KAAK,IAAI,CAAC,CAAC;QACX,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;KAChC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,GAAmB,EAAE;IACxC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAElC,MAAM,UAAU,GAAG,CACf,IAAU,EACV,KAAa,EACb,QAAiB,EACH,EAAE;QAChB,OAAO,IAAI,CAAA;;;;wCAIqB,IAAI,CAAC,EAAE;;;8BAGjB,IAAI,CAAC,EAAE;4BACT,QAAQ;sBACd,KAAK;;;;;oDAKyB,IAAI,CAAC,EAAE;;;;;;SAMlD,CAAC;IACN,CAAC,CAAC;IACF,MAAM,YAAY,GAAG,CAAC,KAAsC,EAAQ,EAAE;QAClE,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa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AAC,aAAa,CAAC,SAAS,CAAS,CAAC;QACvD,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAc,CAAC;QACvE,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,CAAC,CAAC;IACF,OAAO,IAAI,CAAA;;;;sBAIO,YAAY;qBACb,KAAK;iCACO,SAAS;0BAChB,UAAU;wBACZ;QACR,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;KACd;mBACM,MAAM;;;kCAGS,qBAAqB;;;;;;;;;;;;;;;;KAgBlD,CAAC;AACN,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 { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '../sp-grid.js';\nimport '@spectrum-web-components/action-bar/sp-action-bar.js';\nimport '@spectrum-web-components/card/sp-card.js';\nimport '@spectrum-web-components/checkbox/sp-checkbox.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport type { ActionBar } from '@spectrum-web-components/action-bar';\nimport type { Grid } from '..';\n\nexport default {\n title: 'Grid',\n component: 'sp-grid',\n};\n\ninterface Item extends Record<string, unknown> {\n id: number;\n}\n\nfunction generateItems(count: number): Item[] {\n const items: Item[] = [];\n while (count) {\n count -= 1;\n items.unshift({ id: count });\n }\n return items;\n}\n\nexport const Default = (): TemplateResult => {\n const items = generateItems(1000);\n\n const renderItem = (\n item: Item,\n index: number,\n selected: boolean\n ): TemplateResult => {\n return html`\n <sp-card\n toggles\n variant=\"quiet\"\n heading=\"Card Heading ${item.id}\"\n subheading=\"JPG Photo\"\n style=\"contain: strict; padding: 1px;\"\n value=\"card-${item.id}\"\n .selected=${selected}\n key=${index}\n >\n <img\n alt=\"\"\n slot=\"preview\"\n src=\"https://picsum.photos/id/${item.id}/200/300\"\n decoding=\"async\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `;\n };\n const handleChange = (event: Event & { currentTarget: Grid }): void => {\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n const selected = document.querySelector('.selected') as HTMLElement;\n const ids = document.querySelector('.ids') as HTMLElement;\n actionbar.open = !!event.currentTarget.selected.length;\n actionbar.style.setProperty(\n 'display',\n !!event.currentTarget.selected.length ? 'flex' : 'none'\n );\n selected.textContent = '' + event.currentTarget.selected.length;\n ids.textContent =\n '' +\n event.currentTarget.selected\n .map((selection) => selection.id)\n .join(', ');\n };\n const handleActionBarChange = (event: Event): void => {\n event.preventDefault();\n const grid = document.querySelector('sp-grid') as Grid;\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n actionbar.open = false;\n grid.selected = [];\n };\n return html`\n <h1>Random before content that is focusable</h1>\n <input id=\"first-input\" />\n <sp-grid\n @change=${handleChange}\n .items=${items}\n .focusableSelector=${'sp-card'}\n .renderItem=${renderItem}\n ></sp-grid>\n <sp-action-bar variant=\"fixed\" style=\"display: none\">\n <sp-checkbox @click=${handleActionBarChange} checked>\n <span class=\"selected\"></span>\n Selected\n <span class=\"ids\"></span>\n </sp-checkbox>\n <sp-action-group quiet>\n <sp-action-button>\n <sp-icon-edit slot=\"icon\" label=\"Edit\"></sp-icon-edit>\n </sp-action-button>\n <sp-action-button>\n <sp-icon-more slot=\"icon\" label=\"More\"></sp-icon-more>\n </sp-action-button>\n </sp-action-group>\n </sp-action-bar>\n <h2>Random after content that is focusable</h2>\n <input id=\"last-input\" />\n `;\n};\n\nexport const sized = (): TemplateResult => {\n const items = generateItems(1000);\n\n const renderItem = (\n item: Item,\n index: number,\n selected: boolean\n ): TemplateResult => {\n return html`\n <sp-card\n toggles\n variant=\"quiet\"\n heading=\"Card Heading ${item.id}\"\n subheading=\"JPG Photo\"\n style=\"contain: strict; padding: 1px;\"\n value=\"card-${item.id}\"\n .selected=${selected}\n key=${index}\n >\n <img\n alt=\"\"\n slot=\"preview\"\n src=\"https://picsum.photos/id/${item.id}/200/300\"\n decoding=\"async\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `;\n };\n const handleChange = (event: Event & { currentTarget: Grid }): void => {\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n const selected = document.querySelector('.selected') as HTMLElement;\n const ids = document.querySelector('.ids') as HTMLElement;\n actionbar.open = !!event.currentTarget.selected.length;\n actionbar.style.setProperty(\n 'display',\n !!event.currentTarget.selected.length ? 'flex' : 'none'\n );\n selected.textContent = '' + event.currentTarget.selected.length;\n ids.textContent =\n '' +\n event.currentTarget.selected\n .map((selection) => selection.id)\n .join(', ');\n };\n const handleActionBarChange = (event: Event): void => {\n event.preventDefault();\n const grid = document.querySelector('sp-grid') as Grid;\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n actionbar.open = false;\n grid.selected = [];\n };\n return html`\n <h1>Random before content that is focusable</h1>\n <input id=\"first-input\" />\n <sp-grid\n @change=${handleChange}\n .items=${items}\n .focusableSelector=${'sp-card'}\n .renderItem=${renderItem}\n .itemSize=${{\n width: 200,\n height: 300,\n }}\n .gap=${'10px'}\n ></sp-grid>\n <sp-action-bar variant=\"fixed\" style=\"display: none\">\n <sp-checkbox @click=${handleActionBarChange} checked>\n <span class=\"selected\"></span>\n Selected\n <span class=\"ids\"></span>\n </sp-checkbox>\n <sp-action-group quiet>\n <sp-action-button>\n <sp-icon-edit slot=\"icon\" label=\"Edit\"></sp-icon-edit>\n </sp-action-button>\n <sp-action-button>\n <sp-icon-more slot=\"icon\" label=\"More\"></sp-icon-more>\n </sp-action-button>\n </sp-action-group>\n </sp-action-bar>\n <h2>Random after content that is focusable</h2>\n <input id=\"last-input\" />\n `;\n};\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["grid.stories.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, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport '@spectrum-web-components/action-bar/sp-action-bar.js';\nimport '@spectrum-web-components/card/sp-card.js';\nimport '@spectrum-web-components/checkbox/sp-checkbox.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport type { ActionBar } from '@spectrum-web-components/action-bar';\nimport type { Grid } from '@spectrum-web-components/grid';\n\nexport default {\n title: 'Grid',\n component: 'sp-grid',\n};\n\ninterface Item extends Record<string, unknown> {\n id: number;\n}\n\nfunction generateItems(count: number): Item[] {\n const items: Item[] = [];\n while (count) {\n count -= 1;\n items.unshift({ id: count });\n }\n return items;\n}\n\nexport const Default = (): TemplateResult => {\n const items = generateItems(1000);\n\n const renderItem = (\n item: Item,\n index: number,\n selected: boolean\n ): TemplateResult => {\n return html`\n <sp-card\n toggles\n variant=\"quiet\"\n heading=\"Card Heading ${item.id}\"\n subheading=\"JPG Photo\"\n style=\"contain: strict; padding: 1px;\"\n value=\"card-${item.id}\"\n .selected=${selected}\n key=${index}\n >\n <img\n alt=\"\"\n slot=\"preview\"\n src=\"https://picsum.photos/id/${item.id}/200/300\"\n decoding=\"async\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `;\n };\n const handleChange = (event: Event & { currentTarget: Grid }): void => {\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n const selected = document.querySelector('.selected') as HTMLElement;\n const ids = document.querySelector('.ids') as HTMLElement;\n actionbar.open = !!event.currentTarget.selected.length;\n actionbar.style.setProperty(\n 'display',\n !!event.currentTarget.selected.length ? 'flex' : 'none'\n );\n selected.textContent = '' + event.currentTarget.selected.length;\n ids.textContent =\n '' +\n event.currentTarget.selected\n .map((selection) => selection.id)\n .join(', ');\n };\n const handleActionBarChange = (event: Event): void => {\n event.preventDefault();\n const grid = document.querySelector('sp-grid') as Grid;\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n actionbar.open = false;\n grid.selected = [];\n };\n return html`\n <h1>Random before content that is focusable</h1>\n <input id=\"first-input\" />\n <sp-grid\n @change=${handleChange}\n .items=${items}\n .focusableSelector=${'sp-card'}\n .renderItem=${renderItem}\n ></sp-grid>\n <sp-action-bar variant=\"fixed\" style=\"display: none\">\n <sp-checkbox @click=${handleActionBarChange} checked>\n <span class=\"selected\"></span>\n Selected\n <span class=\"ids\"></span>\n </sp-checkbox>\n <sp-action-group quiet>\n <sp-action-button>\n <sp-icon-edit slot=\"icon\" label=\"Edit\"></sp-icon-edit>\n </sp-action-button>\n <sp-action-button>\n <sp-icon-more slot=\"icon\" label=\"More\"></sp-icon-more>\n </sp-action-button>\n </sp-action-group>\n </sp-action-bar>\n <h2>Random after content that is focusable</h2>\n <input id=\"last-input\" />\n `;\n};\n\nexport const sized = (): TemplateResult => {\n const items = generateItems(1000);\n\n const renderItem = (\n item: Item,\n index: number,\n selected: boolean\n ): TemplateResult => {\n return html`\n <sp-card\n toggles\n variant=\"quiet\"\n heading=\"Card Heading ${item.id}\"\n subheading=\"JPG Photo\"\n style=\"contain: strict; padding: 1px;\"\n value=\"card-${item.id}\"\n .selected=${selected}\n key=${index}\n >\n <img\n alt=\"\"\n slot=\"preview\"\n src=\"https://picsum.photos/id/${item.id}/200/300\"\n decoding=\"async\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `;\n };\n const handleChange = (event: Event & { currentTarget: Grid }): void => {\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n const selected = document.querySelector('.selected') as HTMLElement;\n const ids = document.querySelector('.ids') as HTMLElement;\n actionbar.open = !!event.currentTarget.selected.length;\n actionbar.style.setProperty(\n 'display',\n !!event.currentTarget.selected.length ? 'flex' : 'none'\n );\n selected.textContent = '' + event.currentTarget.selected.length;\n ids.textContent =\n '' +\n event.currentTarget.selected\n .map((selection) => selection.id)\n .join(', ');\n };\n const handleActionBarChange = (event: Event): void => {\n event.preventDefault();\n const grid = document.querySelector('sp-grid') as Grid;\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n actionbar.open = false;\n grid.selected = [];\n };\n return html`\n <h1>Random before content that is focusable</h1>\n <input id=\"first-input\" />\n <sp-grid\n @change=${handleChange}\n .items=${items}\n .focusableSelector=${'sp-card'}\n .renderItem=${renderItem}\n .itemSize=${{\n width: 200,\n height: 300,\n }}\n .gap=${'10px'}\n ></sp-grid>\n <sp-action-bar variant=\"fixed\" style=\"display: none\">\n <sp-checkbox @click=${handleActionBarChange} checked>\n <span class=\"selected\"></span>\n Selected\n <span class=\"ids\"></span>\n </sp-checkbox>\n <sp-action-group quiet>\n <sp-action-button>\n <sp-icon-edit slot=\"icon\" label=\"Edit\"></sp-icon-edit>\n </sp-action-button>\n <sp-action-button>\n <sp-icon-more slot=\"icon\" label=\"More\"></sp-icon-more>\n </sp-action-button>\n </sp-action-group>\n </sp-action-bar>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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBlC;",
6
+ "names": []
7
+ }
@@ -1,18 +1,7 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import '@spectrum-web-components/grid/sp-grid.js';
13
- import { html } from '@spectrum-web-components/base';
14
- import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
15
- measureFixtureCreation(html `
1
+ import "@spectrum-web-components/grid/sp-grid.js";
2
+ import { html } from "@spectrum-web-components/base";
3
+ import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
4
+ measureFixtureCreation(html`
16
5
  <sp-grid></sp-grid>
17
6
  `);
18
- //# sourceMappingURL=basic-test.js.map
7
+ //# sourceMappingURL=basic-test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"basic-test.js","sourceRoot":"","sources":["basic-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,sBAAsB,CAAC,IAAI,CAAA;;CAE1B,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-grid></sp-grid>\n`);\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["basic-test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-grid></sp-grid>\n`);\n"],
5
+ "mappings": "AAYA;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA,CAEtB;",
6
+ "names": []
7
+ }
package/test/grid.test.js CHANGED
@@ -1,184 +1,172 @@
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 { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';
13
- import { html } from '@spectrum-web-components/base';
14
- import '../sp-grid.js';
15
- import { Default } from '../stories/grid.stories.js';
16
- import { sendKeys } from '@web/test-runner-commands';
17
- describe('Grid', () => {
18
- it('loads default grid accessibly', async () => {
19
- const test = await fixture(html `
1
+ import { elementUpdated, expect, fixture, nextFrame } from "@open-wc/testing";
2
+ import { html } from "@spectrum-web-components/base";
3
+ import "@spectrum-web-components/grid/sp-grid.js";
4
+ import { Default } from "../stories/grid.stories.js";
5
+ import { sendKeys } from "@web/test-runner-commands";
6
+ describe("Grid", () => {
7
+ it("loads default grid accessibly", async () => {
8
+ const test = await fixture(html`
20
9
  <div>${Default()}</div>
21
10
  `);
22
- const el = test.querySelector('sp-grid');
23
- await elementUpdated(el);
24
- await expect(el).to.be.accessible();
25
- });
26
- it('accepts focus', async () => {
27
- const test = await fixture(html `
11
+ const el = test.querySelector("sp-grid");
12
+ await elementUpdated(el);
13
+ await expect(el).to.be.accessible();
14
+ });
15
+ it("accepts focus", async () => {
16
+ const test = await fixture(html`
28
17
  <div>${Default()}</div>
29
18
  `);
30
- const el = test.querySelector('sp-grid');
31
- await elementUpdated(el);
32
- expect(el.tabIndex).to.equal(0);
33
- el.focus();
34
- await nextFrame();
35
- await nextFrame();
36
- expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
37
- });
38
- it('allows to tab in and out', async () => {
39
- const test = await fixture(html `
19
+ const el = test.querySelector("sp-grid");
20
+ await elementUpdated(el);
21
+ expect(el.tabIndex).to.equal(0);
22
+ el.focus();
23
+ await nextFrame();
24
+ await nextFrame();
25
+ expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
26
+ });
27
+ it("allows to tab in and out", async () => {
28
+ const test = await fixture(html`
40
29
  <div>${Default()}</div>
41
30
  `);
42
- const el = test.querySelector('sp-grid');
43
- const firstInput = test.querySelector('#first-input');
44
- const lastInput = test.querySelector('#last-input');
45
- await elementUpdated(el);
46
- expect(el.tabIndex).to.equal(0);
47
- firstInput.focus();
48
- expect(firstInput === document.activeElement).to.be.true;
49
- expect(el.tabIndex).to.equal(0);
50
- await sendKeys({
51
- press: 'Tab',
52
- });
53
- await nextFrame();
54
- await nextFrame();
55
- expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
56
- expect(el.tabIndex).to.equal(-1);
57
- await sendKeys({
58
- press: 'Tab',
59
- });
60
- await nextFrame();
61
- await nextFrame();
62
- await elementUpdated(el);
63
- expect(lastInput === document.activeElement).to.be.true;
64
- expect(el.tabIndex).to.equal(0);
65
- await sendKeys({
66
- press: 'Shift+Tab',
67
- });
68
- await nextFrame();
69
- await nextFrame();
70
- await nextFrame();
71
- await nextFrame();
72
- expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
73
- expect(el.tabIndex).to.equal(-1);
31
+ const el = test.querySelector("sp-grid");
32
+ const firstInput = test.querySelector("#first-input");
33
+ const lastInput = test.querySelector("#last-input");
34
+ await elementUpdated(el);
35
+ expect(el.tabIndex).to.equal(0);
36
+ firstInput.focus();
37
+ expect(firstInput === document.activeElement).to.be.true;
38
+ expect(el.tabIndex).to.equal(0);
39
+ await sendKeys({
40
+ press: "Tab"
41
+ });
42
+ await nextFrame();
43
+ await nextFrame();
44
+ expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
45
+ expect(el.tabIndex).to.equal(-1);
46
+ await sendKeys({
47
+ press: "Tab"
74
48
  });
75
- it('manages roving tabindex', async () => {
76
- const test = await fixture(html `
49
+ await nextFrame();
50
+ await nextFrame();
51
+ await elementUpdated(el);
52
+ expect(lastInput === document.activeElement).to.be.true;
53
+ expect(el.tabIndex).to.equal(0);
54
+ await sendKeys({
55
+ press: "Shift+Tab"
56
+ });
57
+ await nextFrame();
58
+ await nextFrame();
59
+ await nextFrame();
60
+ await nextFrame();
61
+ expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
62
+ expect(el.tabIndex).to.equal(-1);
63
+ });
64
+ it("manages roving tabindex", async () => {
65
+ const test = await fixture(html`
77
66
  <div>${Default()}</div>
78
67
  `);
79
- const el = test.querySelector('sp-grid');
80
- await elementUpdated(el);
81
- expect(el.tabIndex).to.equal(0);
82
- el.focus();
83
- await nextFrame();
84
- await nextFrame();
85
- let focused = el.querySelector(el.focusableSelector);
86
- await elementUpdated(focused);
87
- expect(focused === document.activeElement).to.be.true;
88
- expect(focused.focused).to.be.true;
89
- await sendKeys({
90
- press: 'ArrowRight',
91
- });
92
- focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
93
- await elementUpdated(focused);
94
- expect(focused === document.activeElement).to.be.true;
95
- expect(focused.focused).to.be.true;
96
- await sendKeys({
97
- press: 'ArrowDown',
98
- });
99
- focused = el.querySelector(`${el.focusableSelector}:nth-child(5)`);
100
- await elementUpdated(focused);
101
- expect(focused === document.activeElement).to.be.true;
102
- expect(focused.focused).to.be.true;
103
- await sendKeys({
104
- press: 'ArrowLeft',
105
- });
106
- focused = el.querySelector(`${el.focusableSelector}:nth-child(4)`);
107
- await elementUpdated(focused);
108
- expect(focused === document.activeElement).to.be.true;
109
- expect(focused.focused).to.be.true;
110
- await sendKeys({
111
- press: 'ArrowUp',
112
- });
113
- focused = el.querySelector(`${el.focusableSelector}`);
114
- await elementUpdated(focused);
115
- expect(focused === document.activeElement).to.be.true;
116
- expect(focused.focused).to.be.true;
68
+ const el = test.querySelector("sp-grid");
69
+ await elementUpdated(el);
70
+ expect(el.tabIndex).to.equal(0);
71
+ el.focus();
72
+ await nextFrame();
73
+ await nextFrame();
74
+ let focused = el.querySelector(el.focusableSelector);
75
+ await elementUpdated(focused);
76
+ expect(focused === document.activeElement).to.be.true;
77
+ expect(focused.focused).to.be.true;
78
+ await sendKeys({
79
+ press: "ArrowRight"
80
+ });
81
+ focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
82
+ await elementUpdated(focused);
83
+ expect(focused === document.activeElement).to.be.true;
84
+ expect(focused.focused).to.be.true;
85
+ await sendKeys({
86
+ press: "ArrowDown"
87
+ });
88
+ focused = el.querySelector(`${el.focusableSelector}:nth-child(5)`);
89
+ await elementUpdated(focused);
90
+ expect(focused === document.activeElement).to.be.true;
91
+ expect(focused.focused).to.be.true;
92
+ await sendKeys({
93
+ press: "ArrowLeft"
117
94
  });
118
- it('manages selection', async () => {
119
- const test = await fixture(html `
95
+ focused = el.querySelector(`${el.focusableSelector}:nth-child(4)`);
96
+ await elementUpdated(focused);
97
+ expect(focused === document.activeElement).to.be.true;
98
+ expect(focused.focused).to.be.true;
99
+ await sendKeys({
100
+ press: "ArrowUp"
101
+ });
102
+ focused = el.querySelector(`${el.focusableSelector}`);
103
+ await elementUpdated(focused);
104
+ expect(focused === document.activeElement).to.be.true;
105
+ expect(focused.focused).to.be.true;
106
+ });
107
+ it("manages selection", async () => {
108
+ const test = await fixture(html`
120
109
  <div>${Default()}</div>
121
110
  `);
122
- const el = test.querySelector('sp-grid');
123
- await elementUpdated(el);
124
- expect(el.tabIndex).to.equal(0);
125
- el.focus();
126
- await nextFrame();
127
- await nextFrame();
128
- let focused = el.querySelector(el.focusableSelector);
129
- await elementUpdated(focused);
130
- expect(focused === document.activeElement).to.be.true;
131
- expect(focused.focused).to.be.true;
132
- await sendKeys({
133
- press: 'ArrowRight',
134
- });
135
- focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
136
- await elementUpdated(focused);
137
- expect(focused === document.activeElement).to.be.true;
138
- expect(focused.focused).to.be.true;
139
- await sendKeys({
140
- press: 'Space',
141
- });
142
- await elementUpdated(el);
143
- expect(el.selected).to.deep.equal([{ id: 1 }]);
144
- await sendKeys({
145
- press: 'ArrowDown',
146
- });
147
- focused = el.querySelector(`${el.focusableSelector}:nth-child(5)`);
148
- await elementUpdated(focused);
149
- expect(focused === document.activeElement).to.be.true;
150
- expect(focused.focused).to.be.true;
151
- await sendKeys({
152
- press: 'Space',
153
- });
154
- await elementUpdated(el);
155
- expect(el.selected).to.deep.equal([{ id: 1 }, { id: 4 }]);
156
- await sendKeys({
157
- press: 'ArrowUp',
158
- });
159
- focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
160
- await elementUpdated(focused);
161
- expect(focused === document.activeElement).to.be.true;
162
- expect(focused.focused).to.be.true;
163
- await sendKeys({
164
- press: 'Space',
165
- });
166
- await elementUpdated(el);
167
- expect(el.selected).to.deep.equal([{ id: 4 }]);
111
+ const el = test.querySelector("sp-grid");
112
+ await elementUpdated(el);
113
+ expect(el.tabIndex).to.equal(0);
114
+ el.focus();
115
+ await nextFrame();
116
+ await nextFrame();
117
+ let focused = el.querySelector(el.focusableSelector);
118
+ await elementUpdated(focused);
119
+ expect(focused === document.activeElement).to.be.true;
120
+ expect(focused.focused).to.be.true;
121
+ await sendKeys({
122
+ press: "ArrowRight"
123
+ });
124
+ focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
125
+ await elementUpdated(focused);
126
+ expect(focused === document.activeElement).to.be.true;
127
+ expect(focused.focused).to.be.true;
128
+ await sendKeys({
129
+ press: "Space"
130
+ });
131
+ await elementUpdated(el);
132
+ expect(el.selected).to.deep.equal([{ id: 1 }]);
133
+ await sendKeys({
134
+ press: "ArrowDown"
135
+ });
136
+ focused = el.querySelector(`${el.focusableSelector}:nth-child(5)`);
137
+ await elementUpdated(focused);
138
+ expect(focused === document.activeElement).to.be.true;
139
+ expect(focused.focused).to.be.true;
140
+ await sendKeys({
141
+ press: "Space"
142
+ });
143
+ await elementUpdated(el);
144
+ expect(el.selected).to.deep.equal([{ id: 1 }, { id: 4 }]);
145
+ await sendKeys({
146
+ press: "ArrowUp"
147
+ });
148
+ focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
149
+ await elementUpdated(focused);
150
+ expect(focused === document.activeElement).to.be.true;
151
+ expect(focused.focused).to.be.true;
152
+ await sendKeys({
153
+ press: "Space"
168
154
  });
169
- it('does not claim lit-virtualizer on the global registry', async () => {
170
- const test = await fixture(html `
155
+ await elementUpdated(el);
156
+ expect(el.selected).to.deep.equal([{ id: 4 }]);
157
+ });
158
+ it("does not claim lit-virtualizer on the global registry", async () => {
159
+ const test = await fixture(html`
171
160
  <div>${Default()}</div>
172
161
  `);
173
- const el = test.querySelector('sp-grid');
174
- await elementUpdated(el);
175
- customElements.define('lit-virtualizer', class extends HTMLElement {
176
- });
177
- // make sure we also don't prevent *any* registration of lit-virtualizer
178
- expect(() => {
179
- customElements.define('lit-virtualizer', class extends HTMLElement {
180
- });
181
- }).to.throw();
162
+ const el = test.querySelector("sp-grid");
163
+ await elementUpdated(el);
164
+ customElements.define("lit-virtualizer", class extends HTMLElement {
182
165
  });
166
+ expect(() => {
167
+ customElements.define("lit-virtualizer", class extends HTMLElement {
168
+ });
169
+ }).to.throw();
170
+ });
183
171
  });
184
- //# sourceMappingURL=grid.test.js.map
172
+ //# sourceMappingURL=grid.test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"grid.test.js","sourceRoot":"","sources":["grid.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGrD,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,IAAI,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA;uBACO,OAAO,EAAE;aACnB,CACJ,CAAC;QACF,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAS,CAAC;QAEjD,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC,CAAC,C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AE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACnE,MAAM,IAAI,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA;uBACO,OAAO,EAAE;aACnB,CACJ,CAAC;QACF,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAS,CAAC;QAEjD,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAM,SAAQ,WAAW;SAAG,CAAC,CAAC;QAEvE,wEAAwE;QACxE,MAAM,CAAC,GAAG,EAAE;YACR,cAAc,CAAC,MAAM,CACjB,iBAAiB,EACjB,KAAM,SAAQ,WAAW;aAAG,CAC/B,CAAC;QACN,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,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 { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { html } from '@spectrum-web-components/base';\nimport { Card } from '@spectrum-web-components/card';\n\nimport '../sp-grid.js';\nimport { Grid } from '..';\nimport { Default } from '../stories/grid.stories.js';\nimport { sendKeys } from '@web/test-runner-commands';\n\ndescribe('Grid', () => {\n it('loads default grid accessibly', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('accepts focus', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n });\n it('allows to tab in and out', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n const firstInput = test.querySelector('#first-input') as HTMLElement;\n const lastInput = test.querySelector('#last-input') as HTMLElement;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n firstInput.focus();\n expect(firstInput === document.activeElement).to.be.true;\n expect(el.tabIndex).to.equal(0);\n\n await sendKeys({\n press: 'Tab',\n });\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n expect(el.tabIndex).to.equal(-1);\n\n await sendKeys({\n press: 'Tab',\n });\n\n await nextFrame();\n await nextFrame();\n\n await elementUpdated(el);\n expect(lastInput === document.activeElement).to.be.true;\n expect(el.tabIndex).to.equal(0);\n\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n expect(el.tabIndex).to.equal(-1);\n });\n it('manages roving tabindex', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n let focused = el.querySelector(el.focusableSelector) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowDown',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(5)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(4)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowUp',\n });\n\n focused = el.querySelector(`${el.focusableSelector}`) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n });\n it('manages selection', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n let focused = el.querySelector(el.focusableSelector) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 1 }]);\n\n await sendKeys({\n press: 'ArrowDown',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(5)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 1 }, { id: 4 }]);\n\n await sendKeys({\n press: 'ArrowUp',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 4 }]);\n });\n it('does not claim lit-virtualizer on the global registry', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n customElements.define('lit-virtualizer', class extends HTMLElement {});\n\n // make sure we also don't prevent *any* registration of lit-virtualizer\n expect(() => {\n customElements.define(\n 'lit-virtualizer',\n class extends HTMLElement {}\n );\n }).to.throw();\n });\n});\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["grid.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { html } from '@spectrum-web-components/base';\nimport { Card } from '@spectrum-web-components/card';\n\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport { Grid } from '@spectrum-web-components/grid';\nimport { Default } from '../stories/grid.stories.js';\nimport { sendKeys } from '@web/test-runner-commands';\n\ndescribe('Grid', () => {\n it('loads default grid accessibly', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('accepts focus', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n });\n it('allows to tab in and out', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n const firstInput = test.querySelector('#first-input') as HTMLElement;\n const lastInput = test.querySelector('#last-input') as HTMLElement;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n firstInput.focus();\n expect(firstInput === document.activeElement).to.be.true;\n expect(el.tabIndex).to.equal(0);\n\n await sendKeys({\n press: 'Tab',\n });\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n expect(el.tabIndex).to.equal(-1);\n\n await sendKeys({\n press: 'Tab',\n });\n\n await nextFrame();\n await nextFrame();\n\n await elementUpdated(el);\n expect(lastInput === document.activeElement).to.be.true;\n expect(el.tabIndex).to.equal(0);\n\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n expect(el.tabIndex).to.equal(-1);\n });\n it('manages roving tabindex', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n let focused = el.querySelector(el.focusableSelector) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowDown',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(5)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(4)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowUp',\n });\n\n focused = el.querySelector(`${el.focusableSelector}`) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n });\n it('manages selection', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n let focused = el.querySelector(el.focusableSelector) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 1 }]);\n\n await sendKeys({\n press: 'ArrowDown',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(5)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 1 }, { id: 4 }]);\n\n await sendKeys({\n press: 'ArrowUp',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 4 }]);\n });\n it('does not claim lit-virtualizer on the global registry', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n customElements.define('lit-virtualizer', class extends HTMLElement {});\n\n // make sure we also don't prevent *any* registration of lit-virtualizer\n expect(() => {\n customElements.define(\n 'lit-virtualizer',\n class extends HTMLElement {}\n );\n }).to.throw();\n });\n});\n"],
5
+ "mappings": "AAYA;AACA;AAGA;AAEA;AACA;AAEA,SAAS,QAAQ,MAAM;AACnB,KAAG,iCAAiC,YAAY;AAC5C,UAAM,OAAO,MAAM,QACf;AAAA,uBACW,QAAQ;AAAA,aAEvB;AACA,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,iBAAiB,YAAY;AAC5B,UAAM,OAAO,MAAM,QACf;AAAA,uBACW,QAAQ;AAAA,aAEvB;AACA,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;AAE9B,OAAG,MAAM;AAET,UAAM,UAAU;AAChB,UAAM,UAAU;AAEhB,WACI,GAAG,cAAc,GAAG,iBAAiB,MAAM,SAAS,aACxD,EAAE,GAAG,GAAG;AAAA,EACZ,CAAC;AACD,KAAG,4BA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