Skip to content

Commit

Permalink
fix(core/dropdown): fix editable dropdown width (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington committed Mar 9, 2023
1 parent d658546 commit ca2312b
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export class Select {
? this.selectedItems?.map((item) => (
<ix-filter-chip
disabled={this.disabled || this.readonly}
key={item.value}
onCloseClick={(e) => {
e.preventDefault();
e.stopPropagation();
Expand Down Expand Up @@ -439,9 +440,9 @@ export class Select {
trigger={this.dropdownWrapperRef}
onShowChanged={(e) => this.dropdownVisibilityChanged(e)}
placement="auto-start"
overwriteDropdownStyle={async (delegateConfig) => {
overwriteDropdownStyle={async () => {
return {
width: `${delegateConfig.triggerRef.clientWidth}px`,
width: `${this.hostElement.clientWidth}px`,
};
}}
>
Expand Down
24 changes: 24 additions & 0 deletions packages/core/src/tests/select/editable/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
SPDX-FileCopyrightText: 2023 Siemens AG
SPDX-License-Identifier: MIT
-->

<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>
</head>
<body style="padding: 2rem">
<ix-select editable selected-indices="2">
<ix-select-item label="Item 1" value="1"></ix-select-item>
<ix-select-item label="Item 2" value="2"></ix-select-item>
<ix-select-item label="Item 3" value="3"></ix-select-item>
</ix-select>
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions packages/core/src/tests/select/select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ regressionTest.describe('select', () => {
});
});

regressionTest('editable', async ({ page }) => {
await page.goto('select/editable');
await page.locator('.chevron-down-container').click();
await page.waitForSelector('.dropdown-menu.show');
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot({
maxDiffPixelRatio: 0.05,
});
});

regressionTest('mode-multiple', async ({ page }) => {
await page.goto('select/mode-multiple');
await page.locator('.chevron-down-container').click();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca2312b

Please sign in to comment.