diff --git a/packages/plugin-list/src/__tests__/ListView.test.tsx b/packages/plugin-list/src/__tests__/ListView.test.tsx index 85f481b60..8dcdcc238 100644 --- a/packages/plugin-list/src/__tests__/ListView.test.tsx +++ b/packages/plugin-list/src/__tests__/ListView.test.tsx @@ -1973,4 +1973,61 @@ describe('ListView', () => { expect(shareButton).toHaveAttribute('title', 'Sharing: collaborative'); }); }); + + // ============================ + // filterableFields whitelist + // ============================ + describe('filterableFields', () => { + it('should render with filterableFields whitelist restricting available fields', () => { + const schema: ListViewSchema = { + type: 'list-view', + objectName: 'contacts', + viewType: 'grid', + fields: [ + { name: 'name', label: 'Name', type: 'text' }, + { name: 'email', label: 'Email', type: 'text' }, + { name: 'phone', label: 'Phone', type: 'text' }, + ] as any, + filterableFields: ['name', 'email'], + }; + + renderWithProvider(); + // Filter button should still be visible + const filterButton = screen.getByRole('button', { name: /filter/i }); + expect(filterButton).toBeInTheDocument(); + }); + + it('should render filter button when filterableFields is not set', () => { + const schema: ListViewSchema = { + type: 'list-view', + objectName: 'contacts', + viewType: 'grid', + fields: [ + { name: 'name', label: 'Name', type: 'text' }, + { name: 'email', label: 'Email', type: 'text' }, + ] as any, + }; + + renderWithProvider(); + const filterButton = screen.getByRole('button', { name: /filter/i }); + expect(filterButton).toBeInTheDocument(); + }); + + it('should render filter button when filterableFields is empty array', () => { + const schema: ListViewSchema = { + type: 'list-view', + objectName: 'contacts', + viewType: 'grid', + fields: [ + { name: 'name', label: 'Name', type: 'text' }, + { name: 'email', label: 'Email', type: 'text' }, + ] as any, + filterableFields: [], + }; + + renderWithProvider(); + const filterButton = screen.getByRole('button', { name: /filter/i }); + expect(filterButton).toBeInTheDocument(); + }); + }); }); diff --git a/packages/react/src/spec-bridge/__tests__/SpecBridge.test.ts b/packages/react/src/spec-bridge/__tests__/SpecBridge.test.ts index 004dc72d4..bc5a097f8 100644 --- a/packages/react/src/spec-bridge/__tests__/SpecBridge.test.ts +++ b/packages/react/src/spec-bridge/__tests__/SpecBridge.test.ts @@ -172,6 +172,12 @@ describe('SpecBridge', () => { const small = bridgeListView({ rowHeight: 'small' }, {}); expect(small.density).toBe('compact'); + + const short = bridgeListView({ rowHeight: 'short' }, {}); + expect(short.density).toBe('compact'); + + const extraTall = bridgeListView({ rowHeight: 'extra_tall' }, {}); + expect(extraTall.density).toBe('spacious'); }); it('includes optional list properties', () => {