diff --git a/src/shared/ui/CheckboxFilter/CheckboxFilter.svelte b/src/shared/ui/CheckboxFilter/CheckboxFilter.svelte deleted file mode 100644 index bf14acd..0000000 --- a/src/shared/ui/CheckboxFilter/CheckboxFilter.svelte +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - -
- -

{displayedLabel}

- - - {#if hasSelection} - - {selectedCount} - - {/if} - - -
- -
-
-
- - - {#if isOpen} -
-
-
- - - {#each filter.properties as property (property.id)} - - {/each} -
-
-
- {/if} -
diff --git a/src/shared/ui/CheckboxFilter/CheckboxFilter.stories.svelte b/src/shared/ui/FilterGroup/FilterGroup.stories.svelte similarity index 87% rename from src/shared/ui/CheckboxFilter/CheckboxFilter.stories.svelte rename to src/shared/ui/FilterGroup/FilterGroup.stories.svelte index 08df45a..d9d8ada 100644 --- a/src/shared/ui/CheckboxFilter/CheckboxFilter.stories.svelte +++ b/src/shared/ui/FilterGroup/FilterGroup.stories.svelte @@ -1,10 +1,10 @@ + +{#snippet icon()} + + + +{/snippet} + +
+ + +
+ {#each filter.properties as property (property.id)} + + {/each} +
+
diff --git a/src/shared/ui/CheckboxFilter/CheckboxFilter.svelte.test.ts b/src/shared/ui/FilterGroup/FilterGroup.svelte.test.ts similarity index 94% rename from src/shared/ui/CheckboxFilter/CheckboxFilter.svelte.test.ts rename to src/shared/ui/FilterGroup/FilterGroup.svelte.test.ts index 7e52cfb..085b646 100644 --- a/src/shared/ui/CheckboxFilter/CheckboxFilter.svelte.test.ts +++ b/src/shared/ui/FilterGroup/FilterGroup.svelte.test.ts @@ -13,10 +13,10 @@ import { expect, it, } from 'vitest'; -import CheckboxFilter from './CheckboxFilter.svelte'; +import FilterGroup from './FilterGroup.svelte'; /** - * Test Suite for CheckboxFilter Component + * Test Suite for FilterGroup Component * * This suite tests the actual Svelte component rendering, interactions, and behavior * using a real browser environment (Playwright) via @vitest/browser-playwright. @@ -29,7 +29,7 @@ import CheckboxFilter from './CheckboxFilter.svelte'; * not as . */ -describe('CheckboxFilter Component', () => { +describe('FilterGroup Component', () => { /** * Helper function to create a filter for testing */ @@ -52,7 +52,7 @@ describe('CheckboxFilter Component', () => { describe('Rendering', () => { it('displays the label', () => { const filter = createTestFilter(createMockProperties(3)); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test Label', filter, }); @@ -63,7 +63,7 @@ describe('CheckboxFilter Component', () => { it('renders all properties as checkboxes with labels', () => { const properties = createMockProperties(3); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -77,7 +77,7 @@ describe('CheckboxFilter Component', () => { it('shows selected count badge when items are selected', () => { const properties = createMockProperties(3, [0, 2]); // Select 2 items const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -88,7 +88,7 @@ describe('CheckboxFilter Component', () => { it('hides badge when no items selected', () => { const properties = createMockProperties(3); const filter = createTestFilter(properties); - const { container } = render(CheckboxFilter, { + const { container } = render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -100,7 +100,7 @@ describe('CheckboxFilter Component', () => { it('renders with no properties', () => { const filter = createTestFilter([]); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Empty Filter', filter, }); @@ -113,7 +113,7 @@ describe('CheckboxFilter Component', () => { it('checkboxes reflect initial selected state', async () => { const properties = createMockProperties(3, [0, 2]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -132,7 +132,7 @@ describe('CheckboxFilter Component', () => { it('clicking checkbox toggles property.selected state', async () => { const properties = createMockProperties(3, [0]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -164,7 +164,7 @@ describe('CheckboxFilter Component', () => { it('label styling changes based on selection state', async () => { const properties = createMockProperties(2, [0]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -192,7 +192,7 @@ describe('CheckboxFilter Component', () => { it('multiple checkboxes can be toggled independently', async () => { const properties = createMockProperties(3); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -223,7 +223,7 @@ describe('CheckboxFilter Component', () => { describe('Collapsible Behavior', () => { it('is open by default', () => { const filter = createTestFilter(createMockProperties(2)); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -235,7 +235,7 @@ describe('CheckboxFilter Component', () => { it('clicking trigger toggles open/close state', async () => { const filter = createTestFilter(createMockProperties(2)); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -263,7 +263,7 @@ describe('CheckboxFilter Component', () => { it('chevron icon rotates based on open state', async () => { const filter = createTestFilter(createMockProperties(2)); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -297,7 +297,7 @@ describe('CheckboxFilter Component', () => { it('badge shows correct count based on filter.selectedCount', async () => { const properties = createMockProperties(5, [0, 2, 4]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -318,7 +318,7 @@ describe('CheckboxFilter Component', () => { it('badge visibility changes with hasSelection (selectedCount > 0)', async () => { const properties = createMockProperties(2, [0]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -347,7 +347,7 @@ describe('CheckboxFilter Component', () => { it('badge shows count correctly when all items are selected', () => { const properties = createMockProperties(5, [0, 1, 2, 3, 4]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -359,7 +359,7 @@ describe('CheckboxFilter Component', () => { describe('Accessibility', () => { it('provides proper ARIA labels on buttons', () => { const filter = createTestFilter(createMockProperties(2)); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test Label', filter, }); @@ -372,7 +372,7 @@ describe('CheckboxFilter Component', () => { it('labels are properly associated with checkboxes', async () => { const properties = createMockProperties(3); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -391,7 +391,7 @@ describe('CheckboxFilter Component', () => { it('checkboxes have proper role', async () => { const filter = createTestFilter(createMockProperties(2)); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -406,7 +406,7 @@ describe('CheckboxFilter Component', () => { it('labels are clickable and toggle associated checkboxes', async () => { const properties = createMockProperties(2); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -447,7 +447,7 @@ describe('CheckboxFilter Component', () => { }, ]; const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -466,7 +466,7 @@ describe('CheckboxFilter Component', () => { { id: '3', name: '(Special) ', value: '3', selected: false }, ]; const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -481,7 +481,7 @@ describe('CheckboxFilter Component', () => { { id: '1', name: 'Only One', value: '1', selected: true }, ]; const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Single', filter, }); @@ -493,7 +493,7 @@ describe('CheckboxFilter Component', () => { it('handles very large number of properties', async () => { const properties = createMockProperties(50, [0, 25, 49]); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Large List', filter, }); @@ -506,7 +506,7 @@ describe('CheckboxFilter Component', () => { it('updates badge when filter is manipulated externally', async () => { const properties = createMockProperties(3); const filter = createTestFilter(properties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Test', filter, }); @@ -537,7 +537,7 @@ describe('CheckboxFilter Component', () => { { id: 'monospace', name: 'Monospace', value: 'monospace', selected: false }, ]; const filter = createTestFilter(realProperties); - render(CheckboxFilter, { + render(FilterGroup, { displayedLabel: 'Font Category', filter, });