fix(router): fix for leading slash in dart
Using string1 === string2 translates to identical(string1, string2) in dart, which is incorrect as it is possilbe for dart strings to have different reference.
This commit is contained in:
parent
f356d03362
commit
c9cec60007
|
@ -43,7 +43,7 @@ export class RouteRecognizer {
|
|||
StringMapWrapper.set(solution, 'params', pathRecognizer.parseParams(url));
|
||||
|
||||
//TODO(btford): determine a good generic way to deal with terminal matches
|
||||
if (url === '/') {
|
||||
if (url == '/') {
|
||||
StringMapWrapper.set(solution, 'matchedUrl', '/');
|
||||
StringMapWrapper.set(solution, 'unmatchedUrl', '');
|
||||
} else {
|
||||
|
|
|
@ -30,6 +30,17 @@ export function main() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should work with leading slash', () => {
|
||||
recognizer.addConfig('/', handler);
|
||||
|
||||
expect(recognizer.recognize('/')[0]).toEqual({
|
||||
'handler': { 'components': { 'a': 'b' } },
|
||||
'params': {},
|
||||
'matchedUrl': '/',
|
||||
'unmatchedUrl': ''
|
||||
});
|
||||
});
|
||||
|
||||
it('should work with a dynamic segment', () => {
|
||||
recognizer.addConfig('/user/:name', handler);
|
||||
expect(recognizer.recognize('/user/brian')[0]).toEqual({
|
||||
|
|
Loading…
Reference in New Issue