@@ -2,7 +2,15 @@ import { mount } from '@vue/test-utils'
22import Component from '../CPagination'
33
44const ComponentName = 'CPagination'
5- const defaultWrapper = mount ( Component )
5+ const wrapper = mount ( Component , {
6+ slots : {
7+ 'first-button' : 'Go to first' ,
8+ 'previous-button' : 'Go to previous' ,
9+ 'next-button' : 'Go to next' ,
10+ 'last-button' : 'Go to last' ,
11+ }
12+ } )
13+
614const customWrapper = mount ( Component , {
715 propsData : {
816 activePage : 9 ,
@@ -13,15 +21,16 @@ const customWrapper = mount(Component, {
1321 dots : false ,
1422 arrows : false ,
1523 doubleArrows : false
16- }
24+ } ,
25+
1726} )
1827
1928describe ( ComponentName , ( ) => {
2029 it ( 'has a name' , ( ) => {
2130 expect ( Component . name ) . toMatch ( ComponentName )
2231 } )
2332 it ( 'renders correctly' , ( ) => {
24- expect ( defaultWrapper . element ) . toMatchSnapshot ( )
33+ expect ( wrapper . element ) . toMatchSnapshot ( )
2534 } )
2635 it ( 'renders correctly' , ( ) => {
2736 expect ( customWrapper . element ) . toMatchSnapshot ( )
@@ -31,11 +40,11 @@ describe(ComponentName, () => {
3140 expect ( customWrapper . emitted ( ) [ 'update:activePage' ] ) . toBeTruthy ( )
3241 } )
3342 it ( 'emits update:activePage event when inactive item is clicked' , ( ) => {
34- const links = defaultWrapper . findAll ( '.page-link' )
43+ const links = wrapper . findAll ( '.page-link' )
3544 links . at ( 2 ) . trigger ( 'click' )
36- expect ( defaultWrapper . emitted ( ) [ 'update:activePage' ] ) . not . toBeTruthy ( )
45+ expect ( wrapper . emitted ( ) [ 'update:activePage' ] ) . not . toBeTruthy ( )
3746
3847 links . at ( 4 ) . trigger ( 'click' )
39- expect ( defaultWrapper . emitted ( ) [ 'update:activePage' ] ) . toBeTruthy ( )
48+ expect ( wrapper . emitted ( ) [ 'update:activePage' ] ) . toBeTruthy ( )
4049 } )
4150} )
0 commit comments