@@ -6,7 +6,7 @@ import { VListItem } from '@/components/VList'
6
6
// Utilities
7
7
import { commands , generate , render , screen , userEvent } from '@test'
8
8
import { getAllByRole } from '@testing-library/vue'
9
- import { cloneVNode , ref } from 'vue'
9
+ import { cloneVNode , nextTick , ref } from 'vue'
10
10
11
11
const variants = [ 'underlined' , 'outlined' , 'filled' , 'solo' , 'plain' ] as const
12
12
const densities = [ 'default' , 'comfortable' , 'compact' ] as const
@@ -587,16 +587,32 @@ describe('VSelect', () => {
587
587
} )
588
588
589
589
// https://github.com/vuetifyjs/vuetify/issues/18556
590
- it ( 'should show menu if focused and items are added' , async ( ) => {
591
- const { rerender } = render ( VSelect )
590
+ // https://github.com/vuetifyjs/vuetify/issues/21205
591
+ it ( 'should show menu if focused and items are added when hideNoData is true"' , async ( ) => {
592
+ const items = ref ( )
593
+ render ( ( ) => < VSelect items = { items . value } hideNoData /> )
592
594
593
595
await userEvent . keyboard ( '{Tab}' )
594
596
expect ( screen . queryByRole ( 'listbox' ) ) . toBeNull ( )
595
597
596
- await rerender ( { items : [ 'Foo' , 'Bar' ] } )
598
+ items . value = [ 'Foo' , 'Bar' ]
599
+ await nextTick ( )
597
600
await expect . poll ( ( ) => screen . queryByRole ( 'listbox' ) ) . toBeVisible ( )
598
601
} )
599
602
603
+ // https://github.com/vuetifyjs/vuetify/issues/21205
604
+ it ( 'should not show menu if focused and items are added when hideNoData is false' , async ( ) => {
605
+ const items = ref ( )
606
+ render ( ( ) => < VSelect items = { items . value } /> )
607
+
608
+ await userEvent . keyboard ( '{Tab}' )
609
+ expect ( screen . queryByRole ( 'listbox' ) ) . toBeNull ( )
610
+
611
+ items . value = [ 'Foo' , 'Bar' ]
612
+ await nextTick ( )
613
+ await expect . poll ( ( ) => screen . queryByRole ( 'listbox' ) ) . toBeNull ( )
614
+ } )
615
+
600
616
// https://github.com/vuetifyjs/vuetify/issues/19346
601
617
it ( 'should not show menu when focused and existing non-empty items are changed' , async ( ) => {
602
618
const { element, rerender } = render ( VSelect , {
0 commit comments