@@ -193,7 +193,7 @@ describe('chips', () => {
193
193
expect ( overflow . hasAttribute ( 'hidden' ) ) . to . be . true ;
194
194
} ) ;
195
195
196
- it ( 'should always show at least one chip in addition to overflow' , async ( ) => {
196
+ it ( 'should always show at least one chip in addition to overflow if there is enough space ' , async ( ) => {
197
197
comboBox . style . width = 'auto' ;
198
198
await nextResize ( comboBox ) ;
199
199
@@ -205,9 +205,20 @@ describe('chips', () => {
205
205
expect ( getChipContent ( chips [ 1 ] ) ) . to . equal ( 'orange' ) ;
206
206
} ) ;
207
207
208
- it ( 'should set show max width on the chip based on CSS property' , async ( ) => {
208
+ it ( 'should move all chips to the overflow if there is not enough space for a single chip' , async ( ) => {
209
+ comboBox . style . width = '100px' ;
210
+ await nextResize ( comboBox ) ;
211
+
212
+ comboBox . selectedItems = [ 'apple' , 'orange' ] ;
213
+ await nextRender ( ) ;
214
+
215
+ const chips = getChips ( comboBox ) ;
216
+ expect ( chips . length ) . to . equal ( 1 ) ;
217
+ expect ( overflow . hasAttribute ( 'hidden' ) ) . to . be . false ;
218
+ } ) ;
219
+
220
+ it ( 'should set max width on the chip based on the remaining space' , async ( ) => {
209
221
comboBox . style . width = 'auto' ;
210
- comboBox . clearButtonVisible = true ;
211
222
await nextResize ( comboBox ) ;
212
223
213
224
comboBox . selectedItems = [ 'apple' , 'orange' ] ;
@@ -216,7 +227,7 @@ describe('chips', () => {
216
227
const chips = getChips ( comboBox ) ;
217
228
const minWidth = getComputedStyle ( comboBox ) . getPropertyValue ( '--_chip-min-width' ) ;
218
229
expect ( minWidth ) . to . be . ok ;
219
- expect ( chips [ 1 ] . style . maxWidth ) . to . equal ( minWidth ) ;
230
+ expect ( parseInt ( chips [ 1 ] . style . maxWidth ) ) . to . be . greaterThan ( parseInt ( minWidth ) ) ;
220
231
} ) ;
221
232
} ) ;
222
233
} ) ;
0 commit comments