Skip to content

Commit

Permalink
test: add missing tests for showing at least one chip
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Sep 25, 2024
1 parent ebfa7e9 commit 43571f3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/multi-select-combo-box/test/chips.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,29 @@ describe('chips', () => {
await nextRender();
expect(overflow.hasAttribute('hidden')).to.be.true;
});

it('should always show at least one chip in addition to overflow', async () => {
comboBox.style.width = 'auto';
await nextResize(comboBox);
comboBox.selectedItems = ['apple', 'orange'];
await nextRender();
const chips = getChips(comboBox);
expect(chips.length).to.equal(2);
expect(getChipContent(chips[1])).to.equal('orange');
});

it('should set show max width on the chip based on CSS property', async () => {
comboBox.style.width = 'auto';
comboBox.clearButtonVisible = true;
await nextResize(comboBox);
comboBox.selectedItems = ['apple', 'orange'];
await nextRender();

const chips = getChips(comboBox);
const minWidth = getComputedStyle(comboBox).getPropertyValue('--_chip-min-width');
expect(minWidth).to.be.ok;
expect(chips[1].style.maxWidth).to.equal(minWidth);
});
});
});

Expand Down

0 comments on commit 43571f3

Please sign in to comment.