From 96f73591b650a6d3c385a7f33d898c189f352d32 Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Fri, 6 Dec 2024 11:32:43 -0800 Subject: [PATCH] feat(list): add filterLabel property. #8076 --- .../calcite-components/src/components/list/list.e2e.ts | 9 +++++++++ packages/calcite-components/src/components/list/list.tsx | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/packages/calcite-components/src/components/list/list.e2e.ts b/packages/calcite-components/src/components/list/list.e2e.ts index cd35e657ceb..dfd4d6c697d 100755 --- a/packages/calcite-components/src/components/list/list.e2e.ts +++ b/packages/calcite-components/src/components/list/list.e2e.ts @@ -161,6 +161,15 @@ describe("calcite-list", () => { ); }); + it("honors filterLabel property", async () => { + const page = await newE2EPage(); + const label = "hell world"; + await page.setContent(``); + + const filter = await page.find(`calcite-list >>> calcite-filter`); + expect(await filter.getProperty("label")).toBe(label); + }); + it("should set the displayMode property on items", async () => { const page = await newE2EPage(); await page.setContent( diff --git a/packages/calcite-components/src/components/list/list.tsx b/packages/calcite-components/src/components/list/list.tsx index ff490115c2d..23c5f8cef59 100755 --- a/packages/calcite-components/src/components/list/list.tsx +++ b/packages/calcite-components/src/components/list/list.tsx @@ -183,6 +183,9 @@ export class List /** When `true`, an input appears at the top of the component that can be used by end users to filter `calcite-list-item`s. */ @property({ reflect: true }) filterEnabled = false; + /** Specifies an accessible name for the filter.*/ + @property({ reflect: true }) filterLabel: string; + /** Placeholder text for the component's filter input field. */ @property({ reflect: true }) filterPlaceholder: string; @@ -979,6 +982,7 @@ export class List filterPlaceholder, filterText, filteredItems, + filterLabel, hasFilterActionsStart, hasFilterActionsEnd, hasFilterNoResults, @@ -1016,6 +1020,7 @@ export class List disabled={disabled} filterProps={effectiveFilterProps} items={dataForFilter} + label={filterLabel} oncalciteFilterChange={this.handleFilterChange} placeholder={filterPlaceholder} ref={this.setFilterEl}