Skip to content

Commit

Permalink
test(core/category-filter): update test
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington committed Nov 25, 2024
1 parent eda2fb9 commit 052e4c7
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,21 @@ test.describe('category-preview test', () => {
});

test('clear category-preview', async ({ page }) => {
await page.waitForSelector('ix-category-filter');
await page.locator('input').first().click();
await page.locator('.category-item').first().click();
const categoryFilter = page.locator('ix-category-filter');
await categoryFilter.locator('input').first().click();
await categoryFilter.locator('.category-item').first().click();

const categoryPreviewPromise = page.evaluate(() => {
return new Promise((resolve) => {
function onCategoryChanged(event: CustomEvent) {
resolve(event.detail);
}
const categoryPreviewPromise = categoryFilter.evaluate(
(element: HTMLIxCategoryFilterElement) => {
return new Promise((resolve) => {
function onCategoryChanged(event: CustomEvent) {
resolve(event.detail);
}

document.addEventListener(
'categoryChanged',
onCategoryChanged as EventListener
);
});
});
element.addEventListener('categoryChanged', onCategoryChanged);
});
}
);

await page.locator('ix-icon-button').first().click();
const categoryPreview = await categoryPreviewPromise;
Expand Down

0 comments on commit 052e4c7

Please sign in to comment.