@@ -509,45 +509,51 @@ describe('VDataTable.ts', () => {
509
509
510
510
// https://github.com/vuetifyjs/vuetify/issues/8184
511
511
it ( 'should default to first option in itemsPerPageOptions if it does not include itemsPerPage' , async ( ) => {
512
- const itemsPerPage = jest . fn ( )
513
- const options = jest . fn ( )
514
512
const wrapper = mountFunction ( {
515
513
propsData : {
516
514
headers : testHeaders ,
517
515
items : testItems ,
518
516
footerProps : {
519
- itemsPerPageOptions : [ 5 , 6 ] ,
517
+ itemsPerPageOptions : [ 6 , 7 ] ,
520
518
} ,
521
519
} ,
522
- listeners : {
523
- 'update:items-per-page' : itemsPerPage ,
524
- 'update:options' : options ,
525
- } ,
526
520
} )
527
521
528
- expect ( itemsPerPage ) . toHaveBeenCalledWith ( 5 )
529
- expect ( options ) . toHaveBeenCalledWith ( expect . objectContaining ( {
530
- itemsPerPage : 5 ,
531
- } ) )
522
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
532
523
} )
533
524
534
525
// https://github.com/vuetifyjs/vuetify/issues/8817
535
526
it ( 'should handle object when checking if it should default to first option in itemsPerPageOptions' , async ( ) => {
536
- const itemsPerPage = jest . fn ( )
537
527
const wrapper = mountFunction ( {
538
528
propsData : {
539
529
headers : testHeaders ,
540
530
items : testItems ,
541
531
itemsPerPage : - 1 ,
542
532
footerProps : {
543
- itemsPerPageOptions : [ 5 , 6 , { text : 'All' , value : - 1 } ] ,
533
+ itemsPerPageOptions : [ 6 , { text : 'All' , value : - 1 } ] ,
534
+ } ,
535
+ } ,
536
+ } )
537
+
538
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
539
+ } )
540
+
541
+ // https://github.com/vuetifyjs/vuetify/issues/9599
542
+ it ( 'should not immediately emit items-per-page' , async ( ) => {
543
+ const itemsPerPage = jest . fn ( )
544
+ const wrapper = mountFunction ( {
545
+ propsData : {
546
+ headers : testHeaders ,
547
+ items : testItems ,
548
+ footerProps : {
549
+ itemsPerPageOptions : [ 6 , 7 ] ,
544
550
} ,
545
551
} ,
546
552
listeners : {
547
- 'update:items-per-page ' : itemsPerPage ,
553
+ 'update:itemsPerPage ' : itemsPerPage ,
548
554
} ,
549
555
} )
550
556
551
- expect ( itemsPerPage ) . toHaveBeenCalledWith ( - 1 )
557
+ expect ( itemsPerPage ) . not . toHaveBeenCalled ( )
552
558
} )
553
559
} )
0 commit comments