Skip to content

Commit

Permalink
fix(core/select): fix editable mode with shadow DOM (#758)
Browse files Browse the repository at this point in the history
Co-authored-by: Tiago Viegas <tiago.viegas@siemens.com>
  • Loading branch information
Tiagogv and tiagogviegas committed Sep 19, 2023
1 parent 950c66a commit 55a514a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,20 @@ export class Select {
private labelMutationObserver: MutationObserver;

get items() {
return Array.from(this.hostElement.querySelectorAll('ix-select-item'));
return [
...Array.from(this.hostElement.querySelectorAll('ix-select-item')),
...Array.from(
this.hostElement.shadowRoot.querySelectorAll('ix-select-item')
),
];
}

get selectedItems() {
return this.items.filter((item) => item.selected);
}

get addItemButton() {
return this.hostElement.querySelector('.add-item');
return this.hostElement.shadowRoot.querySelector('.add-item');
}

get isSingleMode() {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/components/select/test/select.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ test('editable mode', async ({ mount, page }) => {
await expect(add).toBeVisible();

await add.click();

await expect(page.getByTestId('input')).toHaveValue(/Not existing/);

await page.locator('.chevron-down-container').click();

await expect(page.getByRole('button', { name: 'Item 1' })).toBeVisible();
Expand Down

0 comments on commit 55a514a

Please sign in to comment.