File tree 1 file changed +23
-2
lines changed
1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -530,18 +530,39 @@ test('blur should close list and remove focus from select but preserve filterTex
530
530
}
531
531
} ) ;
532
532
533
+ const selectInput = document . querySelector ( '.svelte-select input' ) ;
534
+
533
535
select . $set ( { focused : true } ) ;
534
536
select . $set ( { filterText : 'potato' } ) ;
535
537
div . click ( ) ;
536
538
div . remove ( ) ;
537
539
t . ok ( ! document . querySelector ( '.svelte-select-list' ) ) ;
538
- t . ok ( document . querySelector ( '.svelte-select input' ) !== document . activeElement ) ;
539
- const selectInput = document . querySelector ( '.svelte-select .value-container input' ) ;
540
+ t . ok ( selectInput !== document . activeElement ) ;
541
+
540
542
await wait ( 0 ) ;
541
543
t . ok ( selectInput . value === 'potato' ) ;
542
544
select . $destroy ( ) ;
543
545
} ) ;
544
546
547
+ test ( 'blur should close list and remove focus from select and clear filterText value' , async ( t ) => {
548
+ const select = new Select ( {
549
+ target,
550
+ props : {
551
+ items
552
+ }
553
+ } ) ;
554
+
555
+ const selectInput = document . querySelector ( '.svelte-select input' ) ;
556
+
557
+ select . $set ( { listOpen : true } ) ;
558
+ select . $set ( { filterText : 'potato' } ) ;
559
+ await wait ( 0 ) ;
560
+ selectInput . blur ( ) ;
561
+ await wait ( 0 ) ;
562
+ t . ok ( selectInput . value === '' ) ;
563
+ select . $destroy ( ) ;
564
+ } ) ;
565
+
545
566
test ( 'selecting item should close list but keep focus on select' , async ( t ) => {
546
567
const select = new Select ( {
547
568
target,
You can’t perform that action at this time.
0 commit comments