8000 Added test cases for querystring coding. · vuejs/vue-router@c51c764 · GitHub
[go: up one dir, main page]

Skip to content

Commit c51c764

Browse files
dragantlyyx990803
authored andcommitted
Added test cases for querystring coding.
1 parent b6b1858 commit c51c764

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/unit/specs/core.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,36 @@ describe('Core', function () {
9696
], done)
9797
})
9898

99+
it('go () querystring coding', function (done) {
100+
router = new Router({ abstract: true })
101+
router.map({
102+
'/a': {
103+
component: { template: 'A{{$route.qyery.msg}}' }
104+
},
105+
'/b': {
106+
name: 'b',
107+
component: { template: 'B{{$route.query.msg}}' }
108+
},
109+
'/c': {
110+
component: { template: 'C{{$route.query.msg}}' }
111+
}
112+
})
113+
var App = Vue.extend({
114+
replace: false,
115+
template: '<router-view></router-view>'
116+
})
117+
var query = {msg: 'https://www.google.com/#q=vuejs'}
118+
router.start(App, el)
119+
assertRoutes([
120+
// object with path
121+
[{ path: '/a', query: query }, 'A' + query.msg],
122+
// object with named route
123+
[{ name: 'b', query: query }, 'B' + query.msg],
124+
// string path
125+
['/c?msg=' + encodeURIComponent(query.msg), 'C' + query.msg]
126+
], done)
127+
})
128+
99129
it('matching nested views', function (done) {
100130
router = new Router({ abstract: true })
101131
router.map({

0 commit comments

Comments
 (0)
0