File tree 1 file changed +22
-3
lines changed
1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 1
- import { shallow } from 'vue-test-utils'
2
- import { createRenderer } from 'vue-server-renderer'
3
-
1
+ import { mount } from 'vue-test-utils'
4
2
import TinyPagination from '../src/components/TinyPagination.vue'
5
3
4
+ // Helper function to create a component
5
+ const createComponent = propsData => mount ( TinyPagination , { propsData} )
6
+
6
7
describe ( 'TinyPagination.vue' , ( ) => {
8
+ let cmp
9
+
7
10
it ( 'has a created hook' , ( ) => {
8
11
expect ( typeof TinyPagination . created ) . toBe ( 'function' )
9
12
} )
13
+
14
+ it ( 'when the page property is set, the currentPage is equals' , ( ) => {
15
+ cmp = createComponent ( { total : 300 , page : 2 } )
16
+ expect ( cmp . vm . currentPage ) . toBe ( 2 )
17
+ } )
18
+
19
+ it ( 'Page 1 is the page by default' , ( ) => {
20
+ cmp = createComponent ( { total : 300 } )
21
+ expect ( cmp . vm . page ) . toBe ( 1 )
22
+ } )
23
+
24
+ it ( 'English is the language by default' , ( ) => {
25
+ cmp = createComponent ( { total : 300 } )
26
+ expect ( cmp . vm . lang ) . toBe ( 'en' )
27
+ } )
28
+
10
29
} )
You can’t perform that action at this time.
0 commit comments