From 700846385fe737913c1db9fb6cc0c5cd06ee650d Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Thu, 31 Aug 2023 09:02:14 -0700 Subject: [PATCH] fix(list): Stop emitting calciteListChange when a list-item is disabled or closed. (#7624) **Related Issue:** #7627 ## Summary - calciteListChange shouldn't be emitting when an item is disabled or closed. --- packages/calcite-components/src/components/list/list.e2e.ts | 3 +++ packages/calcite-components/src/components/list/list.tsx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/calcite-components/src/components/list/list.e2e.ts b/packages/calcite-components/src/components/list/list.e2e.ts index c1c94207e81..0dccb24cc46 100755 --- a/packages/calcite-components/src/components/list/list.e2e.ts +++ b/packages/calcite-components/src/components/list/list.e2e.ts @@ -391,10 +391,12 @@ describe("calcite-list", () => { expect(await isElementFocused(page, "#two")).toBe(true); + const calciteListChange = await page.spyOnEvent("calciteListChange"); const listItemThree = await page.find("#three"); listItemThree.setProperty("disabled", false); await page.waitForChanges(); await page.waitForTimeout(listDebounceTimeout); + expect(calciteListChange).toHaveReceivedEventTimes(0); await list.press("ArrowDown"); @@ -404,6 +406,7 @@ describe("calcite-list", () => { listItemFour.setProperty("closed", false); await page.waitForChanges(); await page.waitForTimeout(listDebounceTimeout); + expect(calciteListChange).toHaveReceivedEventTimes(0); await list.press("ArrowDown"); diff --git a/packages/calcite-components/src/components/list/list.tsx b/packages/calcite-components/src/components/list/list.tsx index 391125d83d5..ba60916ca83 100755 --- a/packages/calcite-components/src/components/list/list.tsx +++ b/packages/calcite-components/src/components/list/list.tsx @@ -279,7 +279,7 @@ export class List implements InteractiveComponent, LoadableComponent, SortableCo } event.stopPropagation(); - this.updateListItems(true); + this.updateListItems(); } @Listen("calciteInternalListItemGroupDefaultSlotChange")