@@ -4,7 +4,7 @@ import { VForm } from '@/components/VForm'
44import { VListItem } from '@/components/VList'
55
66// Utilities
7- import { commands , generate , render , screen , userEvent } from '@test'
7+ import { commands , generate , render , screen , userEvent , waitForClickable } from '@test'
88import { getAllByRole } from '@testing-library/vue'
99import { cloneVNode , nextTick , ref } from 'vue'
1010
@@ -56,13 +56,11 @@ describe('VSelect', () => {
5656 expect ( element ) . not . toHaveClass ( 'v-select--active-menu' )
5757
5858 await userEvent . click ( menuIcon )
59- await commands . waitStable ( '.v-list' )
60- expect ( screen . queryAllByCSS ( '.v-list-item' ) ) . toHaveLength ( 2 )
59+ await expect . poll ( ( ) => screen . queryAllByCSS ( '.v-list-item' ) ) . toHaveLength ( 2 )
6160 expect ( element ) . toHaveClass ( 'v-select--active-menu' )
6261
6362 await userEvent . click ( menuIcon )
64- await commands . waitStable ( '.v-list' )
65- expect ( screen . queryAllByCSS ( '.v-list-item' ) ) . toHaveLength ( 0 )
63+ await expect . poll ( ( ) => screen . queryAllByCSS ( '.v-list-item' ) ) . toHaveLength ( 0 )
6664 expect ( element ) . not . toHaveClass ( 'v-select--active-menu' )
6765 } )
6866
@@ -153,7 +151,7 @@ describe('VSelect', () => {
153151 await expect ( screen . findAllByRole ( 'option' , { selected : true } ) ) . resolves . toHaveLength ( 2 )
154152
155153 const option = screen . getAllByRole ( 'option' ) [ 2 ]
156- await commands . waitStable ( '.v-list' )
154+ await waitForClickable ( option )
157155 await userEvent . click ( option )
158156 expect ( selectedItems . value ) . toStrictEqual ( [ 'California' , 'Colorado' , 'Florida' ] )
159157
@@ -204,8 +202,9 @@ describe('VSelect', () => {
204202
205203 await userEvent . click ( element )
206204 await expect ( screen . findAllByRole ( 'option' , { selected : true } ) ) . resolves . toHaveLength ( 2 )
207- await commands . waitStable ( '.v-list' )
208- await userEvent . click ( screen . getAllByRole ( 'option' ) [ 2 ] )
205+ const option = screen . getAllByRole ( 'option' ) [ 2 ]
206+ await waitForClickable ( option )
207+ await userEvent . click ( option )
209208 expect ( selectedItems . value ) . toStrictEqual ( [
210209 {
211210 title : 'Item 1' ,
@@ -280,6 +279,7 @@ describe('VSelect', () => {
280279 expect ( element ) . toHaveTextContent ( 'Item 1' )
281280 expect ( element ) . toHaveTextContent ( 'Item 2' )
282281
282+ await waitForClickable ( options [ 0 ] )
283283 await userEvent . click ( options [ 0 ] )
284284 expect ( selectedItems . value ) . toStrictEqual ( [ {
285285 text : 'Item 2' ,
@@ -484,6 +484,7 @@ describe('VSelect', () => {
484484 expect ( options ) . toHaveLength ( 2 )
485485 expect ( options [ 0 ] ) . toHaveTextContent ( 'Item 2' )
486486
487+ await waitForClickable ( options [ 0 ] )
487488 await userEvent . click ( options [ 0 ] )
488489 expect ( selectedItem . value ) . toStrictEqual ( { text : 'Item 2' , id : 'item2' } )
489490 expect ( screen . queryAllByRole ( 'option' , { selected : true } ) ) . toHaveLength ( 0 )
0 commit comments