Skip to content

Commit 5aca7cb

Browse files
committed
adding extra test
1 parent 389069c commit 5aca7cb

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

test/src/tests.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,18 +530,39 @@ test('blur should close list and remove focus from select but preserve filterTex
530530
}
531531
});
532532

533+
const selectInput = document.querySelector('.svelte-select input');
534+
533535
select.$set({focused: true});
534536
select.$set({filterText: 'potato'});
535537
div.click();
536538
div.remove();
537539
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+
540542
await wait(0);
541543
t.ok(selectInput.value === 'potato');
542544
select.$destroy();
543545
});
544546

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+
545566
test('selecting item should close list but keep focus on select', async (t) => {
546567
const select = new Select({
547568
target,

0 commit comments

Comments
 (0)