@spectrum-web-components/table 0.36.0 → 0.38.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.
@@ -229,5 +229,44 @@ describe("Table", () => {
229
229
  expect(tableHeadCheckboxCell.checkbox.checked).to.be.false;
230
230
  expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.false;
231
231
  });
232
+ it("can be headerless", async () => {
233
+ const el = await fixture(html`
234
+ <sp-table>
235
+ <sp-table-body style="height: 120px">
236
+ <sp-table-row value="row1">
237
+ <sp-table-cell>Row Item Alpha</sp-table-cell>
238
+ <sp-table-cell>Row Item Alpha</sp-table-cell>
239
+ <sp-table-cell>Row Item Alpha</sp-table-cell>
240
+ </sp-table-row>
241
+ <sp-table-row value="row2">
242
+ <sp-table-cell>Row Item Bravo</sp-table-cell>
243
+ <sp-table-cell>Row Item Bravo</sp-table-cell>
244
+ <sp-table-cell>Row Item Bravo</sp-table-cell>
245
+ </sp-table-row>
246
+ <sp-table-row value="row3">
247
+ <sp-table-cell>Row Item Charlie</sp-table-cell>
248
+ <sp-table-cell>Row Item Charlie</sp-table-cell>
249
+ <sp-table-cell>Row Item Charlie</sp-table-cell>
250
+ </sp-table-row>
251
+ <sp-table-row value="row4">
252
+ <sp-table-cell>Row Item Delta</sp-table-cell>
253
+ <sp-table-cell>Row Item Delta</sp-table-cell>
254
+ <sp-table-cell>Row Item Delta</sp-table-cell>
255
+ </sp-table-row>
256
+ <sp-table-row value="row5">
257
+ <sp-table-cell>Row Item Echo</sp-table-cell>
258
+ <sp-table-cell>Row Item Echo</sp-table-cell>
259
+ <sp-table-cell>Row Item Echo</sp-table-cell>
260
+ </sp-table-row>
261
+ </sp-table-body>
262
+ </sp-table>
263
+ `);
264
+ await elementUpdated(el);
265
+ expect(el.size).to.equal("m");
266
+ const tableHead = el.querySelector("sp-table-head");
267
+ expect(tableHead).to.not.exist;
268
+ const tableRows = el.querySelectorAll("sp-table-row");
269
+ expect(tableRows.length).to.equal(5);
270
+ });
232
271
  });
233
272
  //# sourceMappingURL=table.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["table.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*/\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n} from '@open-wc/testing';\n\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport type { Theme } from '@spectrum-web-components/theme';\nimport '@spectrum-web-components/table/sp-table.js';\nimport '@spectrum-web-components/table/sp-table-head.js';\nimport '@spectrum-web-components/table/sp-table-head-cell.js';\nimport '@spectrum-web-components/table/sp-table-body.js';\nimport '@spectrum-web-components/table/sp-table-row.js';\nimport '@spectrum-web-components/table/sp-table-cell.js';\nimport type { Table, TableCheckboxCell } from '@spectrum-web-components/table';\nimport { elements } from '../stories/table-elements.stories.js';\nimport { spy } from 'sinon';\n\nlet globalErrorHandler: undefined | OnErrorEventHandler = undefined;\nbefore(function () {\n // Save Mocha's handler.\n (\n Mocha as unknown as { process: { removeListener(name: string): void } }\n ).process.removeListener('uncaughtException');\n globalErrorHandler = window.onerror;\n addEventListener('error', (error) => {\n if (error.message?.match?.(/ResizeObserver loop limit exceeded/)) {\n return;\n } else {\n globalErrorHandler?.(error);\n }\n });\n});\nafter(function () {\n window.onerror = globalErrorHandler as OnErrorEventHandler;\n});\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme theme=\"classic\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('Table', () => {\n it('loads default table accessibly', async () => {\n const el = await styledFixture<Table>(elements());\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await expect(el).to.be.accessible();\n });\n\n it('can be size `s`', async () => {\n const el = await fixture<Table>(html`\n <sp-table size=\"s\">\n <sp-table-head>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n </sp-table-head>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n await elementUpdated(el);\n\n expect(el.size).to.equal('s');\n });\n\n it('dispatches `change` events', async () => {\n const changeSpy = spy();\n const el = await fixture<Table>(html`\n <sp-table\n size=\"m\"\n selects=\"multiple\"\n .selected=${['row1', 'row2']}\n @change=${({ target }: Event & { target: Table }) => {\n changeSpy(target);\n }}\n >\n <sp-table-head>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n </sp-table-head>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n const rowThreeCheckboxCell = el.querySelector(\n '[value=\"row3\"] sp-table-checkbox-cell'\n ) as TableCheckboxCell;\n\n const tableHeadCheckboxCell = el.querySelector(\n 'sp-table-head sp-table-checkbox-cell'\n ) as TableCheckboxCell;\n\n expect(el.selected).to.deep.equal(['row1', 'row2']);\n\n rowThreeCheckboxCell.checkbox.click();\n\n expect(el.selected).to.deep.equal(['row1', 'row2', 'row3']);\n expect(changeSpy.calledOnce).to.be.true;\n expect(changeSpy.calledWithExactly(el)).to.be.true;\n\n changeSpy.resetHistory();\n\n tableHeadCheckboxCell.checkbox.click();\n\n expect(el.selected).to.deep.equal([\n 'row1',\n 'row2',\n 'row3',\n 'row4',\n 'row5',\n ]);\n expect(changeSpy.calledOnce).to.to.true;\n expect(changeSpy.calledWithExactly(el)).to.be.true;\n });\n\n it('accepts change events dispatched from TableHead `<sp-table-checkbox-cell>`', async () => {\n const changeSpy = spy();\n const el = await fixture<Table>(html`\n <sp-table\n size=\"m\"\n selects=\"multiple\"\n .selected=${['row1', 'row2']}\n @change=${({ target }: Event & { target: Table }) => {\n changeSpy(target);\n }}\n >\n <sp-table-head>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n </sp-table-head>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n const tableHeadCheckboxCell = el.querySelector(\n 'sp-table-head sp-table-checkbox-cell'\n ) as TableCheckboxCell;\n\n expect(el.selected).to.deep.equal(['row1', 'row2']);\n expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.true;\n expect(tableHeadCheckboxCell.checkbox.checked).to.be.false;\n\n tableHeadCheckboxCell.checkbox.click();\n await elementUpdated(el);\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(changeSpy.calledWithExactly(el)).to.be.true;\n expect(tableHeadCheckboxCell.checkbox.checked).to.be.true;\n expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.false;\n\n expect(el.selected).to.deep.equal([\n 'row1',\n 'row2',\n 'row3',\n 'row4',\n 'row5',\n ]);\n\n tableHeadCheckboxCell.checkbox.click();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([]);\n expect(tableHeadCheckboxCell.checkbox.checked).to.be.false;\n expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.false;\n });\n});\n"],
5
- "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAGP,OAAO;AACP,OAAO;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,IAAI,qBAAsD;AAC1D,OAAO,WAAY;AAEf,EACI,MACF,QAAQ,eAAe,mBAAmB;AAC5C,uBAAqB,OAAO;AAC5B,mBAAiB,SAAS,CAAC,UAAU;AAxCzC;AAyCQ,SAAI,iBAAM,YAAN,mBAAe,UAAf,4BAAuB,uCAAuC;AAC9D;AAAA,IACJ,OAAO;AACH,+DAAqB;AAAA,IACzB;AAAA,EACJ,CAAC;AACL,CAAC;AACD,MAAM,WAAY;AACd,SAAO,UAAU;AACrB,CAAC;AAED,eAAe,cACX,OACU;AACV,QAAM,OAAO,MAAM,QAAe;AAAA;AAAA,cAExB,KAAK;AAAA;AAAA,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;AACrC,UAAM,eAAe,EAAE;AAEvB,WAAO,UAAU,UAAU,EAAE,GAAG,GAAG;AACnC,WAAO,UAAU,kBAAkB,EAAE,CAAC,EAAE,GAAG,GAAG;AAC9C,WAAO,sBAAsB,SAAS,OAAO,EAAE,GAAG,GAAG;AACrD,WAAO,sBAAsB,SAAS,aAAa,EAAE,GAAG,GAAG;AAE3D,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC;AAED,0BAAsB,SAAS,MAAM;AACrC,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;AACpC,WAAO,sBAAsB,SAAS,OAAO,EAAE,GAAG,GAAG;AACrD,WAAO,sBAAsB,SAAS,aAAa,EAAE,GAAG,GAAG;AAAA,EAC/D,CAAC;AACL,CAAC;",
4
+ "sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n nextFrame,\n} from '@open-wc/testing';\n\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport type { Theme } from '@spectrum-web-components/theme';\nimport '@spectrum-web-components/table/sp-table.js';\nimport '@spectrum-web-components/table/sp-table-head.js';\nimport '@spectrum-web-components/table/sp-table-head-cell.js';\nimport '@spectrum-web-components/table/sp-table-body.js';\nimport '@spectrum-web-components/table/sp-table-row.js';\nimport '@spectrum-web-components/table/sp-table-cell.js';\nimport type {\n Table,\n TableCheckboxCell,\n TableHead,\n} from '@spectrum-web-components/table';\nimport { elements } from '../stories/table-elements.stories.js';\nimport { spy } from 'sinon';\n\nlet globalErrorHandler: undefined | OnErrorEventHandler = undefined;\nbefore(function () {\n // Save Mocha's handler.\n (\n Mocha as unknown as { process: { removeListener(name: string): void } }\n ).process.removeListener('uncaughtException');\n globalErrorHandler = window.onerror;\n addEventListener('error', (error) => {\n if (error.message?.match?.(/ResizeObserver loop limit exceeded/)) {\n return;\n } else {\n globalErrorHandler?.(error);\n }\n });\n});\nafter(function () {\n window.onerror = globalErrorHandler as OnErrorEventHandler;\n});\n\nasync function styledFixture<T extends Element>(\n story: TemplateResult\n): Promise<T> {\n const test = await fixture<Theme>(html`\n <sp-theme theme=\"classic\" scale=\"medium\" color=\"light\">\n ${story}\n </sp-theme>\n `);\n return test.children[0] as T;\n}\n\ndescribe('Table', () => {\n it('loads default table accessibly', async () => {\n const el = await styledFixture<Table>(elements());\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await expect(el).to.be.accessible();\n });\n\n it('can be size `s`', async () => {\n const el = await fixture<Table>(html`\n <sp-table size=\"s\">\n <sp-table-head>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n </sp-table-head>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n await elementUpdated(el);\n\n expect(el.size).to.equal('s');\n });\n\n it('dispatches `change` events', async () => {\n const changeSpy = spy();\n const el = await fixture<Table>(html`\n <sp-table\n size=\"m\"\n selects=\"multiple\"\n .selected=${['row1', 'row2']}\n @change=${({ target }: Event & { target: Table }) => {\n changeSpy(target);\n }}\n >\n <sp-table-head>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n </sp-table-head>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n const rowThreeCheckboxCell = el.querySelector(\n '[value=\"row3\"] sp-table-checkbox-cell'\n ) as TableCheckboxCell;\n\n const tableHeadCheckboxCell = el.querySelector(\n 'sp-table-head sp-table-checkbox-cell'\n ) as TableCheckboxCell;\n\n expect(el.selected).to.deep.equal(['row1', 'row2']);\n\n rowThreeCheckboxCell.checkbox.click();\n\n expect(el.selected).to.deep.equal(['row1', 'row2', 'row3']);\n expect(changeSpy.calledOnce).to.be.true;\n expect(changeSpy.calledWithExactly(el)).to.be.true;\n\n changeSpy.resetHistory();\n\n tableHeadCheckboxCell.checkbox.click();\n\n expect(el.selected).to.deep.equal([\n 'row1',\n 'row2',\n 'row3',\n 'row4',\n 'row5',\n ]);\n expect(changeSpy.calledOnce).to.to.true;\n expect(changeSpy.calledWithExactly(el)).to.be.true;\n });\n\n it('accepts change events dispatched from TableHead `<sp-table-checkbox-cell>`', async () => {\n const changeSpy = spy();\n const el = await fixture<Table>(html`\n <sp-table\n size=\"m\"\n selects=\"multiple\"\n .selected=${['row1', 'row2']}\n @change=${({ target }: Event & { target: Table }) => {\n changeSpy(target);\n }}\n >\n <sp-table-head>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n <sp-table-head-cell>Column Title</sp-table-head-cell>\n </sp-table-head>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n const tableHeadCheckboxCell = el.querySelector(\n 'sp-table-head sp-table-checkbox-cell'\n ) as TableCheckboxCell;\n\n expect(el.selected).to.deep.equal(['row1', 'row2']);\n expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.true;\n expect(tableHeadCheckboxCell.checkbox.checked).to.be.false;\n\n tableHeadCheckboxCell.checkbox.click();\n await elementUpdated(el);\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(changeSpy.calledWithExactly(el)).to.be.true;\n expect(tableHeadCheckboxCell.checkbox.checked).to.be.true;\n expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.false;\n\n expect(el.selected).to.deep.equal([\n 'row1',\n 'row2',\n 'row3',\n 'row4',\n 'row5',\n ]);\n\n tableHeadCheckboxCell.checkbox.click();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([]);\n expect(tableHeadCheckboxCell.checkbox.checked).to.be.false;\n expect(tableHeadCheckboxCell.checkbox.indeterminate).to.be.false;\n });\n\n it('can be headerless', async () => {\n const el = await fixture<Table>(html`\n <sp-table>\n <sp-table-body style=\"height: 120px\">\n <sp-table-row value=\"row1\">\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n <sp-table-cell>Row Item Alpha</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row2\">\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n <sp-table-cell>Row Item Bravo</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row3\">\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n <sp-table-cell>Row Item Charlie</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row4\">\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n <sp-table-cell>Row Item Delta</sp-table-cell>\n </sp-table-row>\n <sp-table-row value=\"row5\">\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n <sp-table-cell>Row Item Echo</sp-table-cell>\n </sp-table-row>\n </sp-table-body>\n </sp-table>\n `);\n await elementUpdated(el);\n expect(el.size).to.equal('m');\n const tableHead = el.querySelector('sp-table-head') as TableHead;\n expect(tableHead).to.not.exist;\n const tableRows = el.querySelectorAll('sp-table-row');\n expect(tableRows.length).to.equal(5);\n });\n});\n"],
5
+ "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAGP,OAAO;AACP,OAAO;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAMP,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,IAAI,qBAAsD;AAC1D,OAAO,WAAY;AAEf,EACI,MACF,QAAQ,eAAe,mBAAmB;AAC5C,uBAAqB,OAAO;AAC5B,mBAAiB,SAAS,CAAC,UAAU;AA5CzC;AA6CQ,SAAI,iBAAM,YAAN,mBAAe,UAAf,4BAAuB,uCAAuC;AAC9D;AAAA,IACJ,OAAO;AACH,+DAAqB;AAAA,I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