-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/dropdown): remove shadow-dom workaround (#777)
- Loading branch information
1 parent
b38f3c0
commit 03a3099
Showing
8 changed files
with
250 additions
and
74 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
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
101 changes: 101 additions & 0 deletions
101
packages/core/src/components/dropdown/test/dropdown.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,101 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 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. | ||
*/ | ||
|
||
/* | ||
* SPDX-FileCopyrightText: 2023 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 { expect, Locator } from '@playwright/test'; | ||
import { test } from '@utils/test'; | ||
|
||
test('renders', async ({ mount, page }) => { | ||
await mount(` | ||
<ix-split-button label="Test 1"> | ||
<ix-dropdown-item>Test 1</ix-dropdown-item> | ||
</ix-split-button> | ||
<ix-split-button label="Test 2"> | ||
<ix-dropdown-item>Test 1</ix-dropdown-item> | ||
</ix-split-button> | ||
<ix-group header="Title" sub-header="Subtitle"> | ||
<ix-dropdown slot="dropdown"> | ||
<ix-dropdown-item label="Item 1" icon="pin" /> | ||
<ix-dropdown-item label="Item 2" icon="star" /> | ||
<ix-dropdown-item label="Item 3" icon="heart" /> | ||
<ix-dropdown-item label="Item 4" icon="cogwheel" /> | ||
</ix-dropdown> | ||
</ix-group> | ||
<ix-group header="Title" sub-header="Subtitle"> | ||
<ix-dropdown slot="dropdown"> | ||
<ix-dropdown-item label="Item 1" icon="pin" /> | ||
<ix-dropdown-item label="Item 2" icon="star" /> | ||
<ix-dropdown-item label="Item 3" icon="heart" /> | ||
<ix-dropdown-item label="Item 4" icon="cogwheel" /> | ||
</ix-dropdown> | ||
</ix-group> | ||
`); | ||
|
||
const sb1 = page.locator('ix-split-button').nth(0); | ||
const sb2 = page.locator('ix-split-button').nth(1); | ||
|
||
const g1 = page.locator('ix-group').nth(0); | ||
const g2 = page.locator('ix-group').nth(1); | ||
|
||
const sb1Dropdown = sb1.locator('ix-dropdown'); | ||
const sb2Dropdown = sb2.locator('ix-dropdown'); | ||
const g1Dropdown = g1.locator('ix-dropdown'); | ||
const g2Dropdown = g2.locator('ix-dropdown'); | ||
|
||
await sb1 | ||
.getByRole('button') | ||
.filter({ hasText: 'context-menu' }) | ||
.first() | ||
.click(); | ||
|
||
await expectToBeVisible( | ||
[sb1Dropdown, sb2Dropdown, g1Dropdown, g2Dropdown], | ||
0 | ||
); | ||
|
||
await sb2 | ||
.getByRole('button') | ||
.filter({ hasText: 'context-menu' }) | ||
.first() | ||
.click(); | ||
|
||
await expectToBeVisible( | ||
[sb1Dropdown, sb2Dropdown, g1Dropdown, g2Dropdown], | ||
1 | ||
); | ||
|
||
await g2.getByRole('button').filter({ hasText: 'context-menu' }).click(); | ||
|
||
await expectToBeVisible( | ||
[sb1Dropdown, sb2Dropdown, g1Dropdown, g2Dropdown], | ||
3 | ||
); | ||
}); | ||
|
||
function expectToBeVisible(elements: Locator[], index: number) { | ||
return Promise.all( | ||
elements.map(async (element, i) => { | ||
let ef = expect(element); | ||
if (i !== index) { | ||
ef = ef.not; | ||
} | ||
await ef.toBeVisible(); | ||
}) | ||
); | ||
} |
47 changes: 47 additions & 0 deletions
47
packages/core/src/components/pagination/test/pagination.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,47 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 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 { expect } from '@playwright/test'; | ||
import { test } from '@utils/test'; | ||
|
||
test('renders', async ({ mount, page }) => { | ||
await mount(` | ||
<ix-pagination> | ||
</ix-pagination> | ||
`); | ||
const element = page.locator('ix-pagination'); | ||
|
||
await expect(element).toHaveClass(/hydrated/); | ||
}); | ||
|
||
test('advanced', async ({ mount, page }) => { | ||
await mount(` | ||
<ix-pagination advanced> | ||
</ix-pagination> | ||
`); | ||
const element = page.locator('ix-pagination[advanced]'); | ||
|
||
await expect(element).toHaveClass(/hydrated/); | ||
}); | ||
|
||
test('open show number of page dropdown', async ({ mount, page }) => { | ||
await mount(` | ||
<ix-pagination advanced> | ||
</ix-pagination> | ||
`); | ||
const element = page.locator('ix-pagination[advanced]'); | ||
|
||
await element | ||
.getByRole('button') | ||
.filter({ hasText: 'chevron-down-small' }) | ||
.click(); | ||
|
||
const dropdown = element.locator('ix-dropdown'); | ||
|
||
await expect(dropdown).toBeVisible(); | ||
}); |
Oops, something went wrong.