think-router
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "think-router", | ||
"description": "Router for ThinkJS", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "welefen", |
@@ -132,2 +132,3 @@ const helper = require('think-helper'); | ||
query[queryItem.name] = match[index + 1]; | ||
pathname = pathname.replace(`:${queryItem.name}`, query[queryItem.name]); | ||
} | ||
@@ -134,0 +135,0 @@ }); |
@@ -5,3 +5,3 @@ /* | ||
* @Last Modified by: lushijie | ||
* @Last Modified time: 2017-07-23 10:31:45 | ||
* @Last Modified time: 2017-07-23 17:12:32 | ||
*/ | ||
@@ -1036,1 +1036,25 @@ import test from 'ava'; | ||
}); | ||
test.serial.cb('routerChange', t => { | ||
let options = helper.extend({}, defaultOptions); | ||
let ctx = helper.extend({}, defaultCtx, { | ||
path: '' | ||
}); | ||
let app = helper.extend({}, defaultApp, { | ||
modules: ['admin', 'home'], | ||
on: function(event, cb) { | ||
//cb(); | ||
cb(['^\/admin\/article\/list', 'admin/article/list', 'get']); | ||
} | ||
}); | ||
ctx.app = app; | ||
parseRouter(options, app)(ctx, next).then(data => { | ||
t.deepEqual(RESULT, { | ||
module: 'home', | ||
controller: 'index', | ||
action: 'index' | ||
}); | ||
t.end(); | ||
}); | ||
}); |
37082
1281