Skip to content

Commit 1272f90

Browse files
committed
test for router.go() using object
1 parent 83bfeee commit 1272f90

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

test/unit/specs/core.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ describe('Core', function () {
3535
], done)
3636
})
3737

38+
it('go() with object', function (done) {
39+
router = new Router({ abstract: true })
40+
router.map({
41+
'/a/:msg': {
42+
name: 'a',
43+
component: { template: 'A{{$route.params.msg}}' }
44+
},
45+
'/b/:msg': {
46+
name: 'b',
47+
component: { template: 'B{{$route.params.msg}}{{$route.query.msg}}' }
48+
}
49+
})
50+
var App = Vue.extend({
51+
template: '<div><router-view></router-view></div>'
52+
})
53+
router.start(App, el)
54+
assertRoutes([
55+
[{ path: '/a/A' }, 'AA'],
56+
[{ path: '/b/B' }, 'BB'],
57+
// relative
58+
[{ path: '../a/A' }, 'AA'],
59+
[{ path: '../b/B' }, 'BB'],
60+
// named routes
61+
[{ name: 'a', params: {msg: 'A'}}, 'AA'],
62+
[{ name: 'b', params: {msg: 'B'}, query: {msg: 'B'}}, 'BBB']
63+
], done)
64+
})
65+
3866
it('matching nested views', function (done) {
3967
router = new Router({ abstract: true })
4068
router.map({
@@ -89,6 +117,7 @@ describe('Core', function () {
89117
})
90118

91119
it('route context', function (done) {
120+
Vue.config.silent = true
92121
router = new Router({ abstract: true })
93122
router.map({
94123
'/a/:id': {
@@ -122,7 +151,10 @@ describe('Core', function () {
122151
['/a/123?id=234', '/a/123?id=234,123,234,custom|/a/123?id=234,123,234,custom'],
123152
// relative query
124153
['?id=345', '/a/123?id=345,123,345,custom|/a/123?id=345,123,345,custom']
125-
], done)
154+
], function () {
155+
Vue.config.silent = false
156+
done()
157+
})
126158
})
127159

128160
it('v-link', function (done) {

0 commit comments

Comments
 (0)