refactor(router): rename navigate and navigateInstruction methods
This commit is contained in:
parent
5e49d7e624
commit
acc2722cb8
|
@ -78,7 +78,7 @@ function main() {
|
||||||
"var router = new RootRouter(registry, undefined, location, new Object());",
|
"var router = new RootRouter(registry, undefined, location, new Object());",
|
||||||
"$rootScope.$watch(function () { return $location.path(); }, function (path) {",
|
"$rootScope.$watch(function () { return $location.path(); }, function (path) {",
|
||||||
"if (router.lastNavigationAttempt !== path) {",
|
"if (router.lastNavigationAttempt !== path) {",
|
||||||
"router.navigate(path);",
|
"router.navigateByUrl(path);",
|
||||||
"}",
|
"}",
|
||||||
"});",
|
"});",
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
angular.module('myApp', ['ngComponentRouter'])
|
angular.module('myApp', ['ngComponentRouter'])
|
||||||
.controller('MyCtrl', ['$router', function ($router) {
|
.controller('MyCtrl', ['$router', function ($router) {
|
||||||
console.log($router);
|
console.log($router);
|
||||||
$router.navigate('/')
|
$router.navigateByUrl('/')
|
||||||
.then(console.log.bind(console, 'resolve'), console.log.bind(console, 'reject'));
|
.then(console.log.bind(console, 'resolve'), console.log.bind(console, 'reject'));
|
||||||
}]);
|
}]);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -307,7 +307,7 @@ function anchorLinkDirective($router) {
|
||||||
|
|
||||||
var href = element.attr(hrefAttrName);
|
var href = element.attr(hrefAttrName);
|
||||||
if (href && $router.recognize(href)) {
|
if (href && $router.recognize(href)) {
|
||||||
$router.navigate(href);
|
$router.navigateByUrl(href);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -63,7 +63,7 @@ describe('$componentMapper', function () {
|
||||||
{ path: '/', component: Ctrl }
|
{ path: '/', component: Ctrl }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$router.navigate('/');
|
$router.navigateByUrl('/');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.text()).toBe('howdy');
|
expect(elt.text()).toBe('howdy');
|
||||||
|
|
|
@ -51,7 +51,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div>outer { <div ng-outlet></div> }</div>');
|
compile('<div>outer { <div ng-outlet></div> }</div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
|
@ -69,7 +69,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalledWith(instructionFor(UserController), undefined);
|
expect(spy).toHaveBeenCalledWith(instructionFor(UserController), undefined);
|
||||||
|
@ -88,9 +88,9 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
$router.navigate('/post/123');
|
$router.navigateByUrl('/post/123');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).toHaveBeenCalledWith(instructionFor(activate),
|
expect(spy).toHaveBeenCalledWith(instructionFor(activate),
|
||||||
instructionFor(OneController));
|
instructionFor(OneController));
|
||||||
|
@ -108,7 +108,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user');
|
$router.navigateByUrl('/user');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(injectedScope).toBeDefined();
|
expect(injectedScope).toBeDefined();
|
||||||
|
@ -127,9 +127,9 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
$router.navigate('/b');
|
$router.navigateByUrl('/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
@ -147,9 +147,9 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
$router.navigate('/post/123');
|
$router.navigateByUrl('/post/123');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).toHaveBeenCalledWith(instructionFor(OneController),
|
expect(spy).toHaveBeenCalledWith(instructionFor(OneController),
|
||||||
instructionFor(deactivate));
|
instructionFor(deactivate));
|
||||||
|
@ -177,9 +177,9 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
$router.navigate('/b');
|
$router.navigateByUrl('/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(log).toEqual(['deactivate', 'activate']);
|
expect(log).toEqual(['deactivate', 'activate']);
|
||||||
|
@ -207,13 +207,13 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/on-reuse/1/a');
|
$router.navigateByUrl('/on-reuse/1/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(log).toEqual([]);
|
expect(log).toEqual([]);
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
expect(elt.text()).toBe('outer { reuse {one} }');
|
expect(elt.text()).toBe('outer { reuse {one} }');
|
||||||
|
|
||||||
$router.navigate('/on-reuse/2/b');
|
$router.navigateByUrl('/on-reuse/2/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(log).toEqual(['reuse: on-reuse/1 -> on-reuse/2']);
|
expect(log).toEqual(['reuse: on-reuse/1 -> on-reuse/2']);
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
|
@ -242,13 +242,13 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/never-reuse/1/a');
|
$router.navigateByUrl('/never-reuse/1/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(log).toEqual([]);
|
expect(log).toEqual([]);
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
expect(elt.text()).toBe('outer { reuse {one} }');
|
expect(elt.text()).toBe('outer { reuse {one} }');
|
||||||
|
|
||||||
$router.navigate('/never-reuse/2/b');
|
$router.navigateByUrl('/never-reuse/2/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(log).toEqual([]);
|
expect(log).toEqual([]);
|
||||||
expect(cmpInstanceCount).toBe(2);
|
expect(cmpInstanceCount).toBe(2);
|
||||||
|
@ -270,7 +270,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
expect(spy).not.toHaveBeenCalled();
|
||||||
|
@ -292,7 +292,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
|
@ -314,7 +314,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
|
@ -335,7 +335,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).toHaveBeenCalledWith({name: 'brian'}, $http);
|
expect(spy).toHaveBeenCalledWith({name: 'brian'}, $http);
|
||||||
}));
|
}));
|
||||||
|
@ -354,11 +354,11 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('outer { hi }');
|
expect(elt.text()).toBe('outer { hi }');
|
||||||
|
|
||||||
$router.navigate('/b');
|
$router.navigateByUrl('/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('outer { hi }');
|
expect(elt.text()).toBe('outer { hi }');
|
||||||
});
|
});
|
||||||
|
@ -377,11 +377,11 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('outer { hi }');
|
expect(elt.text()).toBe('outer { hi }');
|
||||||
|
|
||||||
$router.navigate('/b');
|
$router.navigateByUrl('/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('outer { one }');
|
expect(elt.text()).toBe('outer { one }');
|
||||||
});
|
});
|
||||||
|
@ -401,7 +401,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
|
@ -421,9 +421,9 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
$router.navigate('/post/123');
|
$router.navigateByUrl('/post/123');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).toHaveBeenCalledWith(instructionFor(OneController),
|
expect(spy).toHaveBeenCalledWith(instructionFor(OneController),
|
||||||
instructionFor(deactivate));
|
instructionFor(deactivate));
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe('navigation', function () {
|
||||||
{ path: '/', component: OneController }
|
{ path: '/', component: OneController }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$router.navigate('/');
|
$router.navigateByUrl('/');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.text()).toBe('one');
|
expect(elt.text()).toBe('one');
|
||||||
|
@ -59,7 +59,7 @@ describe('navigation', function () {
|
||||||
|
|
||||||
spyOn(console, 'warn');
|
spyOn(console, 'warn');
|
||||||
compile('<ng-outlet></ng-outlet>');
|
compile('<ng-outlet></ng-outlet>');
|
||||||
$router.navigate('/');
|
$router.navigateByUrl('/');
|
||||||
|
|
||||||
expect(console.warn).toHaveBeenCalledWith('Could not find controller for', 'NoControllerController');
|
expect(console.warn).toHaveBeenCalledWith('Could not find controller for', 'NoControllerController');
|
||||||
expect(elt.text()).toBe('4');
|
expect(elt.text()).toBe('4');
|
||||||
|
@ -72,11 +72,11 @@ describe('navigation', function () {
|
||||||
]);
|
]);
|
||||||
compile('<ng-outlet></ng-outlet>');
|
compile('<ng-outlet></ng-outlet>');
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('hello brian');
|
expect(elt.text()).toBe('hello brian');
|
||||||
|
|
||||||
$router.navigate('/user/igor');
|
$router.navigateByUrl('/user/igor');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('hello igor');
|
expect(elt.text()).toBe('hello igor');
|
||||||
});
|
});
|
||||||
|
@ -97,14 +97,14 @@ describe('navigation', function () {
|
||||||
]);
|
]);
|
||||||
compile('<ng-outlet></ng-outlet>');
|
compile('<ng-outlet></ng-outlet>');
|
||||||
|
|
||||||
$router.navigate('/parent/user/brian');
|
$router.navigateByUrl('/parent/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
expect(elt.text()).toBe('parent { hello brian }');
|
expect(elt.text()).toBe('parent { hello brian }');
|
||||||
|
|
||||||
spy.calls.reset();
|
spy.calls.reset();
|
||||||
|
|
||||||
$router.navigate('/parent/user/igor');
|
$router.navigateByUrl('/parent/user/igor');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(spy).not.toHaveBeenCalled();
|
expect(spy).not.toHaveBeenCalled();
|
||||||
expect(elt.text()).toBe('parent { hello igor }');
|
expect(elt.text()).toBe('parent { hello igor }');
|
||||||
|
@ -121,7 +121,7 @@ describe('navigation', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div>outer { <div ng-outlet></div> }</div>');
|
compile('<div>outer { <div ng-outlet></div> }</div>');
|
||||||
|
|
||||||
$router.navigate('/a/b');
|
$router.navigateByUrl('/a/b');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.text()).toBe('outer { inner { one } }');
|
expect(elt.text()).toBe('outer { inner { one } }');
|
||||||
|
@ -136,7 +136,7 @@ describe('navigation', function () {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
compile('<div>root { <div ng-outlet></div> }</div>');
|
compile('<div>root { <div ng-outlet></div> }</div>');
|
||||||
$router.navigate('/');
|
$router.navigateByUrl('/');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('root { one }');
|
expect(elt.text()).toBe('root { one }');
|
||||||
});
|
});
|
||||||
|
@ -152,7 +152,7 @@ describe('navigation', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user');
|
$router.navigateByUrl('/user');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(injectedScope).toBeDefined();
|
expect(injectedScope).toBeDefined();
|
||||||
|
@ -166,7 +166,7 @@ describe('navigation', function () {
|
||||||
|
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/user');
|
$router.navigateByUrl('/user');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect($location.path()).toBe('/user');
|
expect($location.path()).toBe('/user');
|
||||||
|
@ -181,7 +181,7 @@ describe('navigation', function () {
|
||||||
{ path: '/user', component: UserController }
|
{ path: '/user', component: UserController }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$router.navigate('/');
|
$router.navigateByUrl('/');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect($location.path()).toBe('/user');
|
expect($location.path()).toBe('/user');
|
||||||
|
@ -203,13 +203,13 @@ describe('navigation', function () {
|
||||||
|
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/old-parent/old-child');
|
$router.navigateByUrl('/old-parent/old-child');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect($location.path()).toBe('/new-parent/new-child');
|
expect($location.path()).toBe('/new-parent/new-child');
|
||||||
expect(elt.text()).toBe('inner { one }');
|
expect(elt.text()).toBe('inner { one }');
|
||||||
|
|
||||||
$router.navigate('/old-parent/old-child-two');
|
$router.navigateByUrl('/old-parent/old-child-two');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect($location.path()).toBe('/new-parent/new-child-two');
|
expect($location.path()).toBe('/new-parent/new-child-two');
|
||||||
|
@ -243,7 +243,7 @@ describe('navigation', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/pendingActivate');
|
$router.navigateByUrl('/pendingActivate');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect($router.navigating).toBe(true);
|
expect($router.navigating).toBe(true);
|
||||||
defer.resolve();
|
defer.resolve();
|
||||||
|
|
|
@ -42,7 +42,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<a ng-link="[\'/two\']">link</a> | outer { <div ng-outlet></div> }');
|
compile('<a ng-link="[\'/two\']">link</a> | outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.find('a').attr('href')).toBe('./b');
|
expect(elt.find('a').attr('href')).toBe('./b');
|
||||||
|
@ -57,7 +57,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('outer { <div ng-outlet></div> }');
|
compile('outer { <div ng-outlet></div> }');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.find('a').attr('href')).toBe('./b');
|
expect(elt.find('a').attr('href')).toBe('./b');
|
||||||
|
@ -74,7 +74,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.find('a').attr('href')).toBe('./b/lol');
|
expect(elt.find('a').attr('href')).toBe('./b/lol');
|
||||||
|
@ -91,7 +91,7 @@ describe('ngOutlet', function () {
|
||||||
]);
|
]);
|
||||||
compile('<div ng-outlet></div>');
|
compile('<div ng-outlet></div>');
|
||||||
|
|
||||||
$router.navigate('/a');
|
$router.navigateByUrl('/a');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
||||||
expect(elt.find('a').attr('href')).toBe('./b/one');
|
expect(elt.find('a').attr('href')).toBe('./b/one');
|
||||||
|
|
|
@ -46,7 +46,7 @@ describe('ngOutlet animations', function () {
|
||||||
{ path: '/user/:name', component: UserController }
|
{ path: '/user/:name', component: UserController }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$router.navigate('/user/brian');
|
$router.navigateByUrl('/user/brian');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('hello brian');
|
expect(elt.text()).toBe('hello brian');
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ describe('ngOutlet animations', function () {
|
||||||
expect(item.event).toBe('enter');
|
expect(item.event).toBe('enter');
|
||||||
|
|
||||||
// navigate to pete
|
// navigate to pete
|
||||||
$router.navigate('/user/pete');
|
$router.navigateByUrl('/user/pete');
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
expect(elt.text()).toBe('hello pete');
|
expect(elt.text()).toBe('hello pete');
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ export class Router {
|
||||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||||
*/
|
*/
|
||||||
navigate(url: string, _skipLocationChange: boolean = false): Promise<any> {
|
navigateByUrl(url: string, _skipLocationChange: boolean = false): Promise<any> {
|
||||||
return this._currentNavigation = this._currentNavigation.then((_) => {
|
return this._currentNavigation = this._currentNavigation.then((_) => {
|
||||||
this.lastNavigationAttempt = url;
|
this.lastNavigationAttempt = url;
|
||||||
this._startNavigating();
|
this._startNavigating();
|
||||||
|
@ -177,8 +177,8 @@ export class Router {
|
||||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||||
* complete.
|
* complete.
|
||||||
*/
|
*/
|
||||||
navigateInstruction(instruction: Instruction,
|
navigateByInstruction(instruction: Instruction,
|
||||||
_skipLocationChange: boolean = false): Promise<any> {
|
_skipLocationChange: boolean = false): Promise<any> {
|
||||||
if (isBlank(instruction)) {
|
if (isBlank(instruction)) {
|
||||||
return _resolveToFalse;
|
return _resolveToFalse;
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ export class Router {
|
||||||
if (isBlank(this.lastNavigationAttempt)) {
|
if (isBlank(this.lastNavigationAttempt)) {
|
||||||
return this._currentNavigation;
|
return this._currentNavigation;
|
||||||
}
|
}
|
||||||
return this.navigate(this.lastNavigationAttempt);
|
return this.navigateByUrl(this.lastNavigationAttempt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,10 +445,11 @@ export class RootRouter extends Router {
|
||||||
hostComponent: Type) {
|
hostComponent: Type) {
|
||||||
super(registry, pipeline, null, hostComponent);
|
super(registry, pipeline, null, hostComponent);
|
||||||
this._location = location;
|
this._location = location;
|
||||||
this._location.subscribe((change) => this.navigate(change['url'], isPresent(change['pop'])));
|
this._location.subscribe((change) =>
|
||||||
|
this.navigateByUrl(change['url'], isPresent(change['pop'])));
|
||||||
|
|
||||||
this.registry.configFromComponent(hostComponent);
|
this.registry.configFromComponent(hostComponent);
|
||||||
this.navigate(location.path());
|
this.navigateByUrl(location.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
commit(instruction: Instruction, _skipLocationChange: boolean = false): Promise<any> {
|
commit(instruction: Instruction, _skipLocationChange: boolean = false): Promise<any> {
|
||||||
|
@ -471,15 +472,15 @@ class ChildRouter extends Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
navigate(url: string, _skipLocationChange: boolean = false): Promise<any> {
|
navigateByUrl(url: string, _skipLocationChange: boolean = false): Promise<any> {
|
||||||
// Delegate navigation to the root router
|
// Delegate navigation to the root router
|
||||||
return this.parent.navigate(url, _skipLocationChange);
|
return this.parent.navigateByUrl(url, _skipLocationChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateInstruction(instruction: Instruction,
|
navigateByInstruction(instruction: Instruction,
|
||||||
_skipLocationChange: boolean = false): Promise<any> {
|
_skipLocationChange: boolean = false): Promise<any> {
|
||||||
// Delegate navigation to the root router
|
// Delegate navigation to the root router
|
||||||
return this.parent.navigateInstruction(instruction, _skipLocationChange);
|
return this.parent.navigateByInstruction(instruction, _skipLocationChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ export class RouterLink {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(): boolean {
|
onClick(): boolean {
|
||||||
this._router.navigateInstruction(this._navigationInstruction);
|
this._router.navigateByInstruction(this._navigationInstruction);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ export function main() {
|
||||||
it('should call the onActivate hook', inject([AsyncTestCompleter], (async) => {
|
it('should call the onActivate hook', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/on-activate'))
|
.then((_) => rtr.navigateByUrl('/on-activate'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('activate cmp');
|
expect(rootTC.nativeElement).toHaveText('activate cmp');
|
||||||
|
@ -110,7 +110,7 @@ export function main() {
|
||||||
completer.resolve(true);
|
completer.resolve(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rtr.navigate('/parent-activate/child-activate')
|
rtr.navigateByUrl('/parent-activate/child-activate')
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('parent {activate cmp}');
|
expect(rootTC.nativeElement).toHaveText('parent {activate cmp}');
|
||||||
|
@ -126,8 +126,8 @@ export function main() {
|
||||||
it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => {
|
it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/on-deactivate'))
|
.then((_) => rtr.navigateByUrl('/on-deactivate'))
|
||||||
.then((_) => rtr.navigate('/a'))
|
.then((_) => rtr.navigateByUrl('/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('A');
|
expect(rootTC.nativeElement).toHaveText('A');
|
||||||
|
@ -140,7 +140,7 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/parent-deactivate/child-deactivate'))
|
.then((_) => rtr.navigateByUrl('/parent-deactivate/child-deactivate'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
ObservableWrapper.subscribe<string>(eventBus, (ev) => {
|
ObservableWrapper.subscribe<string>(eventBus, (ev) => {
|
||||||
if (ev.startsWith('deactivate')) {
|
if (ev.startsWith('deactivate')) {
|
||||||
|
@ -149,7 +149,7 @@ export function main() {
|
||||||
expect(rootTC.nativeElement).toHaveText('parent {deactivate cmp}');
|
expect(rootTC.nativeElement).toHaveText('parent {deactivate cmp}');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rtr.navigate('/a').then((_) => {
|
rtr.navigateByUrl('/a').then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('A');
|
expect(rootTC.nativeElement).toHaveText('A');
|
||||||
expect(log).toEqual([
|
expect(log).toEqual([
|
||||||
|
@ -165,14 +165,14 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/on-reuse/1/a'))
|
.then((_) => rtr.navigateByUrl('/on-reuse/1/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(log).toEqual([]);
|
expect(log).toEqual([]);
|
||||||
expect(rootTC.nativeElement).toHaveText('reuse {A}');
|
expect(rootTC.nativeElement).toHaveText('reuse {A}');
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
})
|
})
|
||||||
.then((_) => rtr.navigate('/on-reuse/2/b'))
|
.then((_) => rtr.navigateByUrl('/on-reuse/2/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(log).toEqual(['reuse: /on-reuse/1 -> /on-reuse/2']);
|
expect(log).toEqual(['reuse: /on-reuse/1 -> /on-reuse/2']);
|
||||||
|
@ -187,14 +187,14 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/never-reuse/1/a'))
|
.then((_) => rtr.navigateByUrl('/never-reuse/1/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(log).toEqual([]);
|
expect(log).toEqual([]);
|
||||||
expect(rootTC.nativeElement).toHaveText('reuse {A}');
|
expect(rootTC.nativeElement).toHaveText('reuse {A}');
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
})
|
})
|
||||||
.then((_) => rtr.navigate('/never-reuse/2/b'))
|
.then((_) => rtr.navigateByUrl('/never-reuse/2/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(log).toEqual([]);
|
expect(log).toEqual([]);
|
||||||
|
@ -214,7 +214,7 @@ export function main() {
|
||||||
completer.resolve(true);
|
completer.resolve(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rtr.navigate('/can-activate/a')
|
rtr.navigateByUrl('/can-activate/a')
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('canActivate {A}');
|
expect(rootTC.nativeElement).toHaveText('canActivate {A}');
|
||||||
|
@ -234,7 +234,7 @@ export function main() {
|
||||||
completer.resolve(false);
|
completer.resolve(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rtr.navigate('/can-activate/a')
|
rtr.navigateByUrl('/can-activate/a')
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('');
|
expect(rootTC.nativeElement).toHaveText('');
|
||||||
|
@ -248,7 +248,7 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/can-deactivate/a'))
|
.then((_) => rtr.navigateByUrl('/can-deactivate/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('canDeactivate {A}');
|
expect(rootTC.nativeElement).toHaveText('canDeactivate {A}');
|
||||||
|
@ -260,7 +260,7 @@ export function main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rtr.navigate('/a').then((_) => {
|
rtr.navigateByUrl('/a').then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('A');
|
expect(rootTC.nativeElement).toHaveText('A');
|
||||||
expect(log).toEqual(['canDeactivate: /can-deactivate -> /a']);
|
expect(log).toEqual(['canDeactivate: /can-deactivate -> /a']);
|
||||||
|
@ -273,7 +273,7 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/can-deactivate/a'))
|
.then((_) => rtr.navigateByUrl('/can-deactivate/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('canDeactivate {A}');
|
expect(rootTC.nativeElement).toHaveText('canDeactivate {A}');
|
||||||
|
@ -285,7 +285,7 @@ export function main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rtr.navigate('/a').then((_) => {
|
rtr.navigateByUrl('/a').then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('canDeactivate {A}');
|
expect(rootTC.nativeElement).toHaveText('canDeactivate {A}');
|
||||||
expect(log).toEqual(['canDeactivate: /can-deactivate -> /a']);
|
expect(log).toEqual(['canDeactivate: /can-deactivate -> /a']);
|
||||||
|
@ -299,7 +299,7 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/activation-hooks/child'))
|
.then((_) => rtr.navigateByUrl('/activation-hooks/child'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(log).toEqual([
|
expect(log).toEqual([
|
||||||
'canActivate child: null -> /child',
|
'canActivate child: null -> /child',
|
||||||
|
@ -309,7 +309,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
log = [];
|
log = [];
|
||||||
return rtr.navigate('/a');
|
return rtr.navigateByUrl('/a');
|
||||||
})
|
})
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(log).toEqual([
|
expect(log).toEqual([
|
||||||
|
@ -325,7 +325,7 @@ export function main() {
|
||||||
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => {
|
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/reuse-hooks/1'))
|
.then((_) => rtr.navigateByUrl('/reuse-hooks/1'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(log).toEqual(
|
expect(log).toEqual(
|
||||||
['canActivate: null -> /reuse-hooks/1', 'onActivate: null -> /reuse-hooks/1']);
|
['canActivate: null -> /reuse-hooks/1', 'onActivate: null -> /reuse-hooks/1']);
|
||||||
|
@ -338,7 +338,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
log = [];
|
log = [];
|
||||||
return rtr.navigate('/reuse-hooks/2');
|
return rtr.navigateByUrl('/reuse-hooks/2');
|
||||||
})
|
})
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(log).toEqual([
|
expect(log).toEqual([
|
||||||
|
@ -352,7 +352,7 @@ export function main() {
|
||||||
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => {
|
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
|
||||||
.then((_) => rtr.navigate('/reuse-hooks/1'))
|
.then((_) => rtr.navigateByUrl('/reuse-hooks/1'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(log).toEqual(
|
expect(log).toEqual(
|
||||||
['canActivate: null -> /reuse-hooks/1', 'onActivate: null -> /reuse-hooks/1']);
|
['canActivate: null -> /reuse-hooks/1', 'onActivate: null -> /reuse-hooks/1']);
|
||||||
|
@ -364,7 +364,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
log = [];
|
log = [];
|
||||||
return rtr.navigate('/reuse-hooks/2');
|
return rtr.navigateByUrl('/reuse-hooks/2');
|
||||||
})
|
})
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(log).toEqual([
|
expect(log).toEqual([
|
||||||
|
|
|
@ -75,7 +75,7 @@ export function main() {
|
||||||
it('should work in a simple case', inject([AsyncTestCompleter], (async) => {
|
it('should work in a simple case', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
|
.then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
|
||||||
.then((_) => rtr.navigate('/test'))
|
.then((_) => rtr.navigateByUrl('/test'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('hello');
|
expect(rootTC.nativeElement).toHaveText('hello');
|
||||||
|
@ -88,12 +88,12 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/user/:name', component: UserCmp})]))
|
.then((_) => rtr.config([new Route({path: '/user/:name', component: UserCmp})]))
|
||||||
.then((_) => rtr.navigate('/user/brian'))
|
.then((_) => rtr.navigateByUrl('/user/brian'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('hello brian');
|
expect(rootTC.nativeElement).toHaveText('hello brian');
|
||||||
})
|
})
|
||||||
.then((_) => rtr.navigate('/user/igor'))
|
.then((_) => rtr.navigateByUrl('/user/igor'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('hello igor');
|
expect(rootTC.nativeElement).toHaveText('hello igor');
|
||||||
|
@ -105,7 +105,7 @@ export function main() {
|
||||||
it('should navigate to child routes', inject([AsyncTestCompleter], (async) => {
|
it('should navigate to child routes', inject([AsyncTestCompleter], (async) => {
|
||||||
compile('outer { <router-outlet></router-outlet> }')
|
compile('outer { <router-outlet></router-outlet> }')
|
||||||
.then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
|
.then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
|
||||||
.then((_) => rtr.navigate('/a/b'))
|
.then((_) => rtr.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('outer { inner { hello } }');
|
expect(rootTC.nativeElement).toHaveText('outer { inner { hello } }');
|
||||||
|
@ -117,7 +117,7 @@ export function main() {
|
||||||
it('should navigate to child routes of async routes', inject([AsyncTestCompleter], (async) => {
|
it('should navigate to child routes of async routes', inject([AsyncTestCompleter], (async) => {
|
||||||
compile('outer { <router-outlet></router-outlet> }')
|
compile('outer { <router-outlet></router-outlet> }')
|
||||||
.then((_) => rtr.config([new AsyncRoute({path: '/a/...', loader: parentLoader})]))
|
.then((_) => rtr.config([new AsyncRoute({path: '/a/...', loader: parentLoader})]))
|
||||||
.then((_) => rtr.navigate('/a/b'))
|
.then((_) => rtr.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('outer { inner { hello } }');
|
expect(rootTC.nativeElement).toHaveText('outer { inner { hello } }');
|
||||||
|
@ -133,7 +133,7 @@ export function main() {
|
||||||
new Redirect({path: '/original', redirectTo: '/redirected'}),
|
new Redirect({path: '/original', redirectTo: '/redirected'}),
|
||||||
new Route({path: '/redirected', component: HelloCmp})
|
new Route({path: '/redirected', component: HelloCmp})
|
||||||
]))
|
]))
|
||||||
.then((_) => rtr.navigate('/original'))
|
.then((_) => rtr.navigateByUrl('/original'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('hello');
|
expect(rootTC.nativeElement).toHaveText('hello');
|
||||||
|
@ -146,13 +146,13 @@ export function main() {
|
||||||
it('should reuse common parent components', inject([AsyncTestCompleter], (async) => {
|
it('should reuse common parent components', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
|
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
|
||||||
.then((_) => rtr.navigate('/team/angular/user/rado'))
|
.then((_) => rtr.navigateByUrl('/team/angular/user/rado'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
expect(rootTC.nativeElement).toHaveText('team angular { hello rado }');
|
expect(rootTC.nativeElement).toHaveText('team angular { hello rado }');
|
||||||
})
|
})
|
||||||
.then((_) => rtr.navigate('/team/angular/user/victor'))
|
.then((_) => rtr.navigateByUrl('/team/angular/user/victor'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
|
@ -165,14 +165,14 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
|
.then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
|
||||||
.then((_) => rtr.navigate('/team/angular/user/rado'))
|
.then((_) => rtr.navigateByUrl('/team/angular/user/rado'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
expect(childCmpInstanceCount).toBe(1);
|
expect(childCmpInstanceCount).toBe(1);
|
||||||
expect(rootTC.nativeElement).toHaveText('team angular { hello rado }');
|
expect(rootTC.nativeElement).toHaveText('team angular { hello rado }');
|
||||||
})
|
})
|
||||||
.then((_) => rtr.navigate('/team/dart/user/rado'))
|
.then((_) => rtr.navigateByUrl('/team/dart/user/rado'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(cmpInstanceCount).toBe(2);
|
expect(cmpInstanceCount).toBe(2);
|
||||||
|
@ -187,7 +187,7 @@ export function main() {
|
||||||
.then((_) => rtr.config([
|
.then((_) => rtr.config([
|
||||||
new Route({path: '/route-data', component: RouteDataCmp, data: {'isAdmin': true}})
|
new Route({path: '/route-data', component: RouteDataCmp, data: {'isAdmin': true}})
|
||||||
]))
|
]))
|
||||||
.then((_) => rtr.navigate('/route-data'))
|
.then((_) => rtr.navigateByUrl('/route-data'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
||||||
|
@ -202,7 +202,7 @@ export function main() {
|
||||||
new AsyncRoute(
|
new AsyncRoute(
|
||||||
{path: '/route-data', loader: AsyncRouteDataCmp, data: {isAdmin: true}})
|
{path: '/route-data', loader: AsyncRouteDataCmp, data: {isAdmin: true}})
|
||||||
]))
|
]))
|
||||||
.then((_) => rtr.navigate('/route-data'))
|
.then((_) => rtr.navigateByUrl('/route-data'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify({'isAdmin': true}));
|
||||||
|
@ -215,7 +215,7 @@ export function main() {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config(
|
.then((_) => rtr.config(
|
||||||
[new Route({path: '/route-data-default', component: RouteDataCmp})]))
|
[new Route({path: '/route-data-default', component: RouteDataCmp})]))
|
||||||
.then((_) => rtr.navigate('/route-data-default'))
|
.then((_) => rtr.navigateByUrl('/route-data-default'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('null');
|
expect(rootTC.nativeElement).toHaveText('null');
|
||||||
|
@ -228,7 +228,7 @@ export function main() {
|
||||||
.then((_) => rtr.config([
|
.then((_) => rtr.config([
|
||||||
new Route({path: '/route-data-array', component: RouteDataCmp, data: [1, 2, 3]})
|
new Route({path: '/route-data-array', component: RouteDataCmp, data: [1, 2, 3]})
|
||||||
]))
|
]))
|
||||||
.then((_) => rtr.navigate('/route-data-array'))
|
.then((_) => rtr.navigateByUrl('/route-data-array'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify([1, 2, 3]));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify([1, 2, 3]));
|
||||||
|
@ -242,7 +242,7 @@ export function main() {
|
||||||
new Route(
|
new Route(
|
||||||
{path: '/route-data-string', component: RouteDataCmp, data: 'hello world'})
|
{path: '/route-data-string', component: RouteDataCmp, data: 'hello world'})
|
||||||
]))
|
]))
|
||||||
.then((_) => rtr.navigate('/route-data-string'))
|
.then((_) => rtr.navigateByUrl('/route-data-string'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText(Json.stringify('hello world'));
|
expect(rootTC.nativeElement).toHaveText(Json.stringify('hello world'));
|
||||||
|
@ -254,7 +254,7 @@ export function main() {
|
||||||
it('should recognize a simple case', inject([AsyncTestCompleter], (async) => {
|
it('should recognize a simple case', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => rtr.config([new Route({path: '/...', component: AuxCmp})]))
|
.then((_) => rtr.config([new Route({path: '/...', component: AuxCmp})]))
|
||||||
.then((_) => rtr.navigate('/hello(modal)'))
|
.then((_) => rtr.navigateByUrl('/hello(modal)'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(rootTC.nativeElement).toHaveText('main {hello} | aux {modal}');
|
expect(rootTC.nativeElement).toHaveText('main {hello} | aux {modal}');
|
||||||
|
|
|
@ -72,7 +72,7 @@ export function main() {
|
||||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||||
tcb.createAsync(AppCmp).then((rootTC) => {
|
tcb.createAsync(AppCmp).then((rootTC) => {
|
||||||
var router = rootTC.componentInstance.router;
|
var router = rootTC.componentInstance.router;
|
||||||
PromiseWrapper.catchError(router.navigate('/cause-error'), (error) => {
|
PromiseWrapper.catchError(router.navigateByUrl('/cause-error'), (error) => {
|
||||||
expect(rootTC.nativeElement).toHaveText('outer { oh no }');
|
expect(rootTC.nativeElement).toHaveText('outer { oh no }');
|
||||||
expect(error).toContainError('oops!');
|
expect(error).toContainError('oops!');
|
||||||
async.done();
|
async.done();
|
||||||
|
@ -123,11 +123,11 @@ export function main() {
|
||||||
if (flipped) {
|
if (flipped) {
|
||||||
location.back();
|
location.back();
|
||||||
} else {
|
} else {
|
||||||
router.navigate(nextUrl);
|
router.navigateByUrl(nextUrl);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.navigate(history[0][0]);
|
router.navigateByUrl(history[0][0]);
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
});
|
});
|
||||||
|
@ -146,7 +146,7 @@ export function main() {
|
||||||
expect(rootTC.componentInstance.location.path()).toEqual('/parent/child');
|
expect(rootTC.componentInstance.location.path()).toEqual('/parent/child');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/parent/child');
|
router.navigateByUrl('/parent/child');
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ export function main() {
|
||||||
.toEqual('/my/app/parent/child');
|
.toEqual('/my/app/parent/child');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/parent/child');
|
router.navigateByUrl('/parent/child');
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
1000);
|
1000);
|
||||||
|
@ -190,7 +190,7 @@ export function main() {
|
||||||
.toEqual('/qs?q=search-for-something');*/
|
.toEqual('/qs?q=search-for-something');*/
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/qs?q=search-for-something');
|
router.navigateByUrl('/qs?q=search-for-something');
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
|
|
|
@ -76,7 +76,7 @@ export function main() {
|
||||||
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
||||||
.then((_) =>
|
.then((_) =>
|
||||||
router.config([new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
router.config([new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
||||||
.then((_) => router.navigate('/a/b'))
|
.then((_) => router.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(getHref(rootTC)).toEqual('/my/base/user');
|
expect(getHref(rootTC)).toEqual('/my/base/user');
|
||||||
|
@ -89,7 +89,7 @@ export function main() {
|
||||||
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
||||||
.then((_) =>
|
.then((_) =>
|
||||||
router.config([new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
router.config([new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
||||||
.then((_) => router.navigate('/a/b'))
|
.then((_) => router.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(getHref(rootTC)).toEqual('/user');
|
expect(getHref(rootTC)).toEqual('/user');
|
||||||
|
@ -102,7 +102,7 @@ export function main() {
|
||||||
compile('<a href="hello" [router-link]="[\'./user\', {name: name}]">{{name}}</a>')
|
compile('<a href="hello" [router-link]="[\'./user\', {name: name}]">{{name}}</a>')
|
||||||
.then((_) => router.config(
|
.then((_) => router.config(
|
||||||
[new Route({path: '/user/:name', component: UserCmp, as: 'user'})]))
|
[new Route({path: '/user/:name', component: UserCmp, as: 'user'})]))
|
||||||
.then((_) => router.navigate('/a/b'))
|
.then((_) => router.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.componentInstance.name = 'brian';
|
rootTC.componentInstance.name = 'brian';
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
|
@ -118,7 +118,7 @@ export function main() {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => router.config(
|
.then((_) => router.config(
|
||||||
[new Route({path: '/page/:number', component: SiblingPageCmp, as: 'page'})]))
|
[new Route({path: '/page/:number', component: SiblingPageCmp, as: 'page'})]))
|
||||||
.then((_) => router.navigate('/page/1'))
|
.then((_) => router.navigateByUrl('/page/1'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(DOM.getAttribute(
|
expect(DOM.getAttribute(
|
||||||
|
@ -159,7 +159,7 @@ export function main() {
|
||||||
compile()
|
compile()
|
||||||
.then((_) => router.config(
|
.then((_) => router.config(
|
||||||
[new Route({path: '/book/:title/...', component: BookCmp, as: 'book'})]))
|
[new Route({path: '/book/:title/...', component: BookCmp, as: 'book'})]))
|
||||||
.then((_) => router.navigate('/book/1984/page/1'))
|
.then((_) => router.navigateByUrl('/book/1984/page/1'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
expect(DOM.getAttribute(
|
expect(DOM.getAttribute(
|
||||||
|
@ -206,7 +206,7 @@ export function main() {
|
||||||
|
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/better-child');
|
router.navigateByUrl('/better-child');
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ export function main() {
|
||||||
|
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/child-with-grandchild/grandchild');
|
router.navigateByUrl('/child-with-grandchild/grandchild');
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -265,7 +265,7 @@ export function main() {
|
||||||
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
||||||
.then((_) => router.config(
|
.then((_) => router.config(
|
||||||
[new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
[new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
||||||
.then((_) => router.navigate('/a/b'))
|
.then((_) => router.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ export function main() {
|
||||||
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
compile('<a href="hello" [router-link]="[\'./user\']"></a>')
|
||||||
.then((_) => router.config(
|
.then((_) => router.config(
|
||||||
[new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
[new Route({path: '/user', component: UserCmp, as: 'user'})]))
|
||||||
.then((_) => router.navigate('/a/b'))
|
.then((_) => router.navigateByUrl('/a/b'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ export function main() {
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/parent/child');
|
expect(applicationRef.hostComponent.location.path()).toEqual('/parent/child');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/parent/child');
|
router.navigateByUrl('/parent/child');
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ export function main() {
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/after');
|
expect(applicationRef.hostComponent.location.path()).toEqual('/after');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/before');
|
router.navigateByUrl('/before');
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ export function main() {
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/hello');
|
router.navigateByUrl('/hello');
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ export function main() {
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigate('/hello');
|
router.navigateByUrl('/hello');
|
||||||
});
|
});
|
||||||
}), 1000);
|
}), 1000);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ export function main() {
|
||||||
testComponent.detectChanges();
|
testComponent.detectChanges();
|
||||||
// TODO: shouldn't this be just 'click' rather than '^click'?
|
// TODO: shouldn't this be just 'click' rather than '^click'?
|
||||||
testComponent.query(By.css('a')).triggerEventHandler('click', null);
|
testComponent.query(By.css('a')).triggerEventHandler('click', null);
|
||||||
expect(router.spy('navigateInstruction')).toHaveBeenCalledWith(dummyInstruction);
|
expect(router.spy('navigateByInstruction')).toHaveBeenCalledWith(dummyInstruction);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -68,7 +68,7 @@ export function main() {
|
||||||
|
|
||||||
router.registerPrimaryOutlet(outlet)
|
router.registerPrimaryOutlet(outlet)
|
||||||
.then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
|
.then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
|
||||||
.then((_) => router.navigate('/a'))
|
.then((_) => router.navigateByUrl('/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(outlet.spy('activate')).toHaveBeenCalled();
|
expect(outlet.spy('activate')).toHaveBeenCalled();
|
||||||
expect(location.urlChanges).toEqual(['/a']);
|
expect(location.urlChanges).toEqual(['/a']);
|
||||||
|
@ -82,7 +82,7 @@ export function main() {
|
||||||
|
|
||||||
router.registerPrimaryOutlet(outlet)
|
router.registerPrimaryOutlet(outlet)
|
||||||
.then((_) => router.config([new Route({path: '/b', component: DummyComponent})]))
|
.then((_) => router.config([new Route({path: '/b', component: DummyComponent})]))
|
||||||
.then((_) => router.navigate('/b', true))
|
.then((_) => router.navigateByUrl('/b', true))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(outlet.spy('activate')).toHaveBeenCalled();
|
expect(outlet.spy('activate')).toHaveBeenCalled();
|
||||||
expect(location.urlChanges).toEqual([]);
|
expect(location.urlChanges).toEqual([]);
|
||||||
|
@ -95,7 +95,7 @@ export function main() {
|
||||||
var outlet = makeDummyOutlet();
|
var outlet = makeDummyOutlet();
|
||||||
|
|
||||||
router.registerPrimaryOutlet(outlet)
|
router.registerPrimaryOutlet(outlet)
|
||||||
.then((_) => router.navigate('/a'))
|
.then((_) => router.navigateByUrl('/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(outlet.spy('activate')).not.toHaveBeenCalled();
|
expect(outlet.spy('activate')).not.toHaveBeenCalled();
|
||||||
return router.config([new Route({path: '/a', component: DummyComponent})]);
|
return router.config([new Route({path: '/a', component: DummyComponent})]);
|
||||||
|
@ -146,7 +146,7 @@ export function main() {
|
||||||
router.config([new AsyncRoute({path: '/first', loader: loader, as: 'FirstCmp'})]);
|
router.config([new AsyncRoute({path: '/first', loader: loader, as: 'FirstCmp'})]);
|
||||||
|
|
||||||
var instruction = router.generate(['/FirstCmp']);
|
var instruction = router.generate(['/FirstCmp']);
|
||||||
router.navigateInstruction(instruction)
|
router.navigateByInstruction(instruction)
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
expect(outlet.spy('activate')).toHaveBeenCalled();
|
expect(outlet.spy('activate')).toHaveBeenCalled();
|
||||||
async.done();
|
async.done();
|
||||||
|
@ -162,7 +162,7 @@ export function main() {
|
||||||
new Route({path: '/a', component: DummyComponent, as: 'A'}),
|
new Route({path: '/a', component: DummyComponent, as: 'A'}),
|
||||||
new Route({path: '/b', component: DummyComponent, as: 'B'})
|
new Route({path: '/b', component: DummyComponent, as: 'B'})
|
||||||
]))
|
]))
|
||||||
.then((_) => router.navigate('/a'))
|
.then((_) => router.navigateByUrl('/a'))
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
var instruction = router.generate(['/A']);
|
var instruction = router.generate(['/A']);
|
||||||
var otherInstruction = router.generate(['/B']);
|
var otherInstruction = router.generate(['/B']);
|
||||||
|
|
Loading…
Reference in New Issue