diff --git a/packages/calcite-components/src/components/tree/tree.e2e.ts b/packages/calcite-components/src/components/tree/tree.e2e.ts index a0139e067a2..e2d664a2e16 100644 --- a/packages/calcite-components/src/components/tree/tree.e2e.ts +++ b/packages/calcite-components/src/components/tree/tree.e2e.ts @@ -433,7 +433,7 @@ describe("calcite-tree", () => { }); describe(`when tree-item selection-mode is "none"`, () => { - it("allows selecting items without a selection", async () => { + it("emits selection event without updating selection", async () => { const page = await newE2EPage(); await page.setContent(html` @@ -448,12 +448,12 @@ describe("calcite-tree", () => { await item1.click(); expect(selectEventSpy).toHaveReceivedEventTimes(1); - expect(await tree.getProperty("selectedItems")).toHaveLength(1); + expect(await tree.getProperty("selectedItems")).toHaveLength(0); expect(await page.findAll("calcite-tree-item[selected]")).toHaveLength(0); await item2.click(); expect(selectEventSpy).toHaveReceivedEventTimes(2); - expect(await tree.getProperty("selectedItems")).toHaveLength(1); + expect(await tree.getProperty("selectedItems")).toHaveLength(0); expect(await page.findAll("calcite-tree-item[selected]")).toHaveLength(0); }); }); diff --git a/packages/calcite-components/src/components/tree/tree.tsx b/packages/calcite-components/src/components/tree/tree.tsx index 1d00c9920a4..a941a262488 100644 --- a/packages/calcite-components/src/components/tree/tree.tsx +++ b/packages/calcite-components/src/components/tree/tree.tsx @@ -235,7 +235,7 @@ export class Tree { } this.selectedItems = isNoneSelectionMode - ? [target] + ? [] : (nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter( (i) => i.selected ) as HTMLCalciteTreeItemElement[]);