test(filters): cover the tally and availability chip behaviour changes (#188)

This commit is contained in:
2026-08-25 15:48:09 -05:00
parent 147e280f88
commit 8771deeaca
2 changed files with 27 additions and 0 deletions
@@ -126,4 +126,16 @@ test.describe('Admin inventory filters', () => {
await expect(adminInventory.clearFiltersButton).toHaveCount(0); await expect(adminInventory.clearFiltersButton).toHaveCount(0);
await expect(adminInventory.filtersButton).toHaveText('Filters'); await expect(adminInventory.filtersButton).toHaveText('Filters');
}); });
// #188: the tally is the number of chips, so three statuses count as three.
// It read Filters (1) before, because status was added to the count by hand
// as a single flag regardless of how many were selected.
test('counts each selected status in the tally', async ({ admin, adminInventory }) => {
await admin.goto();
await adminInventory.toggleStatus('Available');
await adminInventory.toggleStatus('Reserved');
await adminInventory.toggleStatus('Sold');
await expect(adminInventory.filtersButton).toHaveText('Filters (3)');
});
}); });
+15
View File
@@ -232,4 +232,19 @@ test.describe('Storefront filters', () => {
await expect(wallArt.getByText(NAMES.vintage)).toBeVisible(); await expect(wallArt.getByText(NAMES.vintage)).toBeVisible();
await expect(wallArt.getByText(NAMES.oak)).toBeVisible(); await expect(wallArt.getByText(NAMES.oak)).toBeVisible();
}); });
// #188: choosing anything but the default now shows a removable chip. This is
// what lets one predicate serve both the tally and the empty-state message —
// without it, a storefront filtered to Sold with no results would report
// itself as an empty shop rather than as a filter that matched nothing.
test('shows a removable chip for a non-default availability', async ({ storefront }) => {
await storefront.goto();
await expect(storefront.filterChip('Sold')).toHaveCount(0);
await storefront.chooseAvailability('Sold');
await expect(storefront.filterChip('Sold')).toBeVisible();
await storefront.removeFilterChip('Sold').click();
await expect(storefront.filterChip('Sold')).toHaveCount(0);
});
}); });