Skip to content

Commit

Permalink
fix: prevent long chips from exceeding available input width
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Dec 4, 2023
1 parent 01e5878 commit 3f637db
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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 @@ -41,6 +41,10 @@ const multiSelectComboBox = css`
flex: 0 1 auto;
}
::slotted([slot='chip']) {
overflow: hidden;
}
:host(:is([readonly], [disabled])) ::slotted(input) {
flex-grow: 0;
flex-basis: 0;
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 3f637db

Please sign in to comment.