refactor(router): improve control flow of descendant route activation

This commit is contained in:
Brian Ford
2015-05-14 13:01:48 -07:00
parent 6b02cb9b44
commit c29ab86d85
5 changed files with 134 additions and 89 deletions

View File

@ -24,7 +24,7 @@ export function main() {
var instruction = registry.recognize('/test', rootHostComponent);
expect(instruction.getChildInstruction('default').component).toBe(DummyCompB);
expect(instruction.getChild('default').component).toBe(DummyCompB);
});
it('should prefer static segments to dynamic', () => {
@ -33,7 +33,7 @@ export function main() {
var instruction = registry.recognize('/home', rootHostComponent);
expect(instruction.getChildInstruction('default').component).toBe(DummyCompA);
expect(instruction.getChild('default').component).toBe(DummyCompA);
});
it('should prefer dynamic segments to star', () => {
@ -42,7 +42,7 @@ export function main() {
var instruction = registry.recognize('/home', rootHostComponent);
expect(instruction.getChildInstruction('default').component).toBe(DummyCompA);
expect(instruction.getChild('default').component).toBe(DummyCompA);
});
it('should match the full URL recursively', () => {
@ -50,8 +50,8 @@ export function main() {
var instruction = registry.recognize('/first/second', rootHostComponent);
var parentInstruction = instruction.getChildInstruction('default');
var childInstruction = parentInstruction.getChildInstruction('default');
var parentInstruction = instruction.getChild('default');
var childInstruction = parentInstruction.getChild('default');
expect(parentInstruction.component).toBe(DummyParentComp);
expect(childInstruction.component).toBe(DummyCompB);