File tree 4 files changed +47
-4
lines changed
4 files changed +47
-4
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = {
2
2
testURL : 'http://localhost/' ,
3
3
moduleFileExtensions : [ 'js' , 'vue' ] ,
4
+ moduleNameMapper : {
5
+ '^vue$' : 'vue/dist/vue.common.js' ,
6
+ } ,
4
7
transform : {
5
8
'^.+\\.js$' : '<rootDir>/node_modules/babel-jest' ,
6
9
'.*\\.(vue)$' : '<rootDir>/node_modules/jest-vue-preprocessor' ,
Original file line number Diff line number Diff line change 41
41
"prod" : " NODE_ENV=production rollup -c ./build/rollup.config.js --configProd" ,
42
42
"release" : " bash ./build/release.sh" ,
43
43
"lint" : " eslint src/**/* build/*.js test/**/*" ,
44
- "test" : " jest --coverage" ,
45
- "test:node" : " jest --coverage --env=node"
44
+ "test" : " jest --coverage --verbose " ,
45
+ "test:node" : " jest --coverage --verbose -- env=node"
46
46
},
47
47
"devDependencies" : {
48
48
"babel-jest" : " ^23.4.2" ,
Original file line number Diff line number Diff line change
1
+ import Vue from 'vue'
2
+ import Router from '../src/router.js'
3
+ import IonVueRouter from '../src/components/ion-vue-router.vue'
4
+
5
+ describe ( 'IonVueRouter' , ( ) => {
6
+ it ( 'Renders correctly' , ( ) => {
7
+ Vue . use ( Router )
8
+ Vue . config . ignoredElements . push ( / ^ i o n - / )
9
+
10
+ const app = new Vue ( {
11
+ render ( h ) {
12
+ return h ( 'ion-vue-router' )
13
+ } ,
14
+ router : new Router ( {
15
+ routes : [ { path : '/' , component : { template : '<h1>foo</h1>' } } ] ,
16
+ } ) ,
17
+ } ) . $mount ( )
18
+
19
+ app . $router . push ( '/foo' )
20
+ app . $router . back ( )
21
+
22
+ expect ( app . $el . textContent ) . toBe ( 'foo' )
23
+ } )
24
+
25
+ it ( 'Sets the default data correctly' , ( ) => {
26
+ expect ( typeof IonVueRouter . data ) . toBe ( 'function' )
27
+ expect ( IonVueRouter . data ( ) ) . toMatchObject ( {
28
+ leavingEl : null ,
29
+ enteringEl : null ,
30
+ } )
31
+ } )
32
+
33
+ it ( 'Sets the default props correctly' , ( ) => {
34
+ const constructor = Vue . extend ( IonVueRouter )
35
+ const component = new constructor ( )
36
+ expect ( component . bindCss ) . toBeFalsy ( )
37
+ expect ( component . animated ) . toBeTruthy ( )
38
+ expect ( component . name ) . toBe ( 'default' )
39
+ } )
40
+ } )
Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
2
3
- describe ( 'asd ' , ( ) => {
4
- it ( 'qqq ' , ( ) => {
3
+ describe ( 'Router node ' , ( ) => {
4
+ it ( 'Sets globals correctly ' , ( ) => {
5
5
window . Vue = undefined
6
6
global . Vue = Vue
7
7
require ( '../src/router.js' )
You can’t perform that action at this time.
0 commit comments