Revert "feat(router): allow linking to auxiliary routes"
This reverts commit 0b1ff2db9e
.
This commit is contained in:
@ -31,7 +31,6 @@ import {
|
||||
RouterLink,
|
||||
RouterOutlet,
|
||||
AsyncRoute,
|
||||
AuxRoute,
|
||||
Route,
|
||||
RouteParams,
|
||||
RouteConfig,
|
||||
@ -199,7 +198,7 @@ export function main() {
|
||||
name: 'ChildWithGrandchild'
|
||||
})
|
||||
]))
|
||||
.then((_) => router.navigateByUrl('/child-with-grandchild/grandchild'))
|
||||
.then((_) => router.navigate(['/ChildWithGrandchild']))
|
||||
.then((_) => {
|
||||
fixture.detectChanges();
|
||||
expect(DOM.getAttribute(fixture.debugElement.componentViewChildren[1]
|
||||
@ -235,21 +234,6 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should generate links to auxiliary routes', inject([AsyncTestCompleter], (async) => {
|
||||
compile()
|
||||
.then((_) => router.config([new Route({path: '/...', component: AuxLinkCmp})]))
|
||||
.then((_) => router.navigateByUrl('/'))
|
||||
.then((_) => {
|
||||
rootTC.detectChanges();
|
||||
expect(DOM.getAttribute(rootTC.debugElement.componentViewChildren[1]
|
||||
.componentViewChildren[0]
|
||||
.nativeElement,
|
||||
'href'))
|
||||
.toEqual('/(aside)');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
describe('router-link-active CSS class', () => {
|
||||
it('should be added to the associated element', inject([AsyncTestCompleter], (async) => {
|
||||
@ -487,17 +471,3 @@ class AmbiguousBookCmp {
|
||||
title: string;
|
||||
constructor(params: RouteParams) { this.title = params.get('title'); }
|
||||
}
|
||||
|
||||
@Component({selector: 'aux-cmp'})
|
||||
@View({
|
||||
template:
|
||||
`<a [router-link]="[\'./Hello\', [ \'Aside\' ] ]">aside</a> |
|
||||
<router-outlet></router-outlet> | aside <router-outlet name="aside"></router-outlet>`,
|
||||
directives: ROUTER_DIRECTIVES
|
||||
})
|
||||
@RouteConfig([
|
||||
new Route({path: '/', component: HelloCmp, name: 'Hello'}),
|
||||
new AuxRoute({path: '/aside', component: Hello2Cmp, name: 'Aside'})
|
||||
])
|
||||
class AuxLinkCmp {
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ export function main() {
|
||||
.toEqual('second');
|
||||
});
|
||||
|
||||
xit('should generate URLs that account for redirects', () => {
|
||||
it('should generate URLs that account for redirects', () => {
|
||||
registry.config(
|
||||
RootHostCmp,
|
||||
new Route({path: '/first/...', component: DummyParentRedirectCmp, name: 'FirstCmp'}));
|
||||
@ -60,7 +60,7 @@ export function main() {
|
||||
.toEqual('first/second');
|
||||
});
|
||||
|
||||
xit('should generate URLs in a hierarchy of redirects', () => {
|
||||
it('should generate URLs in a hierarchy of redirects', () => {
|
||||
registry.config(
|
||||
RootHostCmp,
|
||||
new Route({path: '/first/...', component: DummyMultipleRedirectCmp, name: 'FirstCmp'}));
|
||||
@ -89,7 +89,7 @@ export function main() {
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
registry.config(
|
||||
RootHostCmp,
|
||||
new AsyncRoute({path: '/first/...', loader: asyncParentLoader, name: 'FirstCmp'}));
|
||||
new AsyncRoute({path: '/first/...', loader: AsyncParentLoader, name: 'FirstCmp'}));
|
||||
|
||||
expect(() => registry.generate(['FirstCmp', 'SecondCmp'], RootHostCmp))
|
||||
.toThrowError('Could not find route named "SecondCmp".');
|
||||
@ -103,20 +103,12 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('should throw when generating a url and a parent has no config', () => {
|
||||
expect(() => registry.generate(['FirstCmp', 'SecondCmp'], RootHostCmp))
|
||||
.toThrowError('Component "RootHostCmp" has no route config.');
|
||||
});
|
||||
|
||||
it('should generate URLs for aux routes', () => {
|
||||
registry.config(RootHostCmp,
|
||||
new Route({path: '/primary', component: DummyCmpA, name: 'Primary'}));
|
||||
registry.config(RootHostCmp, new AuxRoute({path: '/aux', component: DummyCmpB, name: 'Aux'}));
|
||||
|
||||
expect(stringifyInstruction(registry.generate(['Primary', ['Aux']], RootHostCmp)))
|
||||
.toEqual('primary(aux)');
|
||||
});
|
||||
|
||||
it('should prefer static segments to dynamic', inject([AsyncTestCompleter], (async) => {
|
||||
registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpB}));
|
||||
registry.config(RootHostCmp, new Route({path: '/home', component: DummyCmpA}));
|
||||
@ -201,7 +193,7 @@ export function main() {
|
||||
it('should match the URL using an async parent component',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
registry.config(RootHostCmp,
|
||||
new AsyncRoute({path: '/first/...', loader: asyncParentLoader}));
|
||||
new AsyncRoute({path: '/first/...', loader: AsyncParentLoader}));
|
||||
|
||||
registry.recognize('/first/second', RootHostCmp)
|
||||
.then((instruction) => {
|
||||
@ -283,17 +275,17 @@ export function main() {
|
||||
});
|
||||
}
|
||||
|
||||
function asyncParentLoader() {
|
||||
function AsyncParentLoader() {
|
||||
return PromiseWrapper.resolve(DummyParentCmp);
|
||||
}
|
||||
|
||||
function asyncChildLoader() {
|
||||
function AsyncChildLoader() {
|
||||
return PromiseWrapper.resolve(DummyCmpB);
|
||||
}
|
||||
|
||||
class RootHostCmp {}
|
||||
|
||||
@RouteConfig([new AsyncRoute({path: '/second', loader: asyncChildLoader})])
|
||||
@RouteConfig([new AsyncRoute({path: '/second', loader: AsyncChildLoader})])
|
||||
class DummyAsyncCmp {
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user