@@ -76,15 +76,28 @@ test.describe('Filtering the storefront by availability', () => {
|
|||||||
await expect(storefront.gridCell(NAMES.sold)).toHaveCount(0);
|
await expect(storefront.gridCell(NAMES.sold)).toHaveCount(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// The control sits beside the Filters button rather than inside the drawer,
|
// Since #188 the tally is the number of chips, not the number of drawer
|
||||||
// so its state must not be counted as one of the drawer's filters.
|
// controls, so a bar dimension counts like any other. This test asserted the
|
||||||
test('does not inflate the Filters count', async ({ page, storefront }) => {
|
// older rule and went unnoticed for days because nothing updated it when that
|
||||||
|
// rule changed — see #239.
|
||||||
|
//
|
||||||
|
// The count and the chip row are deliberately the same number. Availability
|
||||||
|
// emits a chip for any non-default status so that ?status=reserved is not an
|
||||||
|
// empty grid with no Clear filters button, and counting bar chips differently
|
||||||
|
// from drawer ones would restore exactly the per-screen special-casing #188
|
||||||
|
// removed.
|
||||||
|
test('counts the availability preset in the Filters tally', async ({ page, storefront }) => {
|
||||||
await storefront.goto();
|
await storefront.goto();
|
||||||
await storefront.chooseAvailability('Sold');
|
await storefront.chooseAvailability('Sold');
|
||||||
|
|
||||||
// Matched loosely and asserted on the text, because antd's icon contributes
|
// Matched loosely and asserted on the text, because antd's icon contributes
|
||||||
// its own aria-label to the button's accessible name. The text is the part
|
// its own aria-label to the button's accessible name.
|
||||||
// that would gain a "(1)" if status were counted as a drawer filter.
|
await expect(storefront.filtersButton).toHaveText('Filters (1)');
|
||||||
|
|
||||||
|
// The default earns silence: returning to it removes the chip, so the tally
|
||||||
|
// goes with it. Without this the test would pass on a tally that never
|
||||||
|
// decremented.
|
||||||
|
await storefront.chooseAvailability('Not sold');
|
||||||
await expect(storefront.filtersButton).toHaveText('Filters');
|
await expect(storefront.filtersButton).toHaveText('Filters');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user