Skip to content

Commit

Permalink
fix: prevent long chips from exceeding available input width (#6905)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Sep 19, 2024
1 parent 3e072bd commit 93198fa
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ registerStyles(
#wrapper {
display: flex;
width: 100%;
min-width: 0;
}
:host([auto-expand-vertically]) #wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const multiSelectComboBox = css`
[part='chip'] {
flex: 0 1 auto;
overflow: hidden;
}
:host(:is([readonly], [disabled])) ::slotted(input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@ describe('multi-select-combo-box', () => {
element.selectedItems = items;
await visualDiff(div, 'auto-expand-height');
});

it('auto expand long chip', async () => {
element.style.maxWidth = '300px';
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip');
});

it('auto expand long chip clear button', async () => {
element.style.maxWidth = '300px';
element.clearButtonVisible = true;
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip-clear-button');
});
});

describe('opened', () => {
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.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,23 @@ describe('multi-select-combo-box', () => {
element.style.maxWidth = '250px';
await visualDiff(div, 'auto-expand-max-width');
});

it('auto expand long chip', async () => {
element.style.maxWidth = '250px';
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip');
});

it('auto expand long chip clear button', async () => {
element.style.maxWidth = '250px';
element.clearButtonVisible = true;
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip-clear-button');
});
});

describe('opened', () => {
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.

0 comments on commit 93198fa

Please sign in to comment.