-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/category-filter): does not clear category preview (#1441)
- Loading branch information
1 parent
da1f10e
commit a69f108
Showing
5 changed files
with
89 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@siemens/ix': patch | ||
--- | ||
|
||
fix(core/category-filter): does not clear category preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
packages/core/src/components/category-filter/test/category-filter.ct.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Siemens AG | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import { test } from '@utils/test'; | ||
import { expect } from '@playwright/test'; | ||
|
||
test('renders', async ({ mount, page }) => { | ||
await mount(`<ix-category-filter></ix-category-filter>`); | ||
const categoryFilter = page.locator('ix-category-filter'); | ||
await expect(categoryFilter).toHaveClass(/hydrated/); | ||
}); | ||
|
||
test.describe('category-preview test', () => { | ||
test.beforeEach(async ({ mount, page }) => { | ||
await mount( | ||
` | ||
<ix-category-filter></ix-category-filter> | ||
` | ||
); | ||
|
||
const categoryFilter = page.locator('ix-category-filter'); | ||
await categoryFilter.evaluate((el: HTMLIxCategoryFilterElement) => { | ||
el.categories = { | ||
ID_1: { | ||
label: 'Vendor', | ||
options: ['Apple', 'MS', 'Siemens'], | ||
}, | ||
ID_2: { | ||
label: 'Product', | ||
options: ['iPhone X', 'Windows', 'APS'], | ||
}, | ||
}; | ||
}); | ||
}); | ||
|
||
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 categoryPreviewPromise = page.evaluate(() => { | ||
return new Promise((resolve) => { | ||
function onCategoryChanged(event) { | ||
resolve(event.detail); | ||
} | ||
|
||
document.addEventListener('categoryChanged', onCategoryChanged); | ||
}); | ||
}); | ||
|
||
await page.locator('ix-icon-button').first().click(); | ||
const categoryPreview = await categoryPreviewPromise; | ||
|
||
expect(categoryPreview).toEqual(null); | ||
}); | ||
}); |