parent
913563a41d
commit
f013c57186
@ -2634,46 +2634,48 @@ describe('Integration', () => {
|
|||||||
expect(canceledStatus).toEqual(false);
|
expect(canceledStatus).toEqual(false);
|
||||||
})));
|
})));
|
||||||
|
|
||||||
fixmeIvy('FW-766: One router test is wrong')
|
it('works with componentless routes',
|
||||||
.it('works with componentless routes',
|
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
|
||||||
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
|
const fixture = createRoot(router, RootCmp);
|
||||||
const fixture = createRoot(router, RootCmp);
|
|
||||||
|
|
||||||
router.resetConfig([
|
router.resetConfig([
|
||||||
{
|
{
|
||||||
path: 'grandparent',
|
path: 'grandparent',
|
||||||
canDeactivate: ['RecordingDeactivate'],
|
canDeactivate: ['RecordingDeactivate'],
|
||||||
children: [{
|
children: [{
|
||||||
path: 'parent',
|
path: 'parent',
|
||||||
canDeactivate: ['RecordingDeactivate'],
|
canDeactivate: ['RecordingDeactivate'],
|
||||||
children: [{
|
children: [{
|
||||||
path: 'child',
|
path: 'child',
|
||||||
canDeactivate: ['RecordingDeactivate'],
|
canDeactivate: ['RecordingDeactivate'],
|
||||||
children: [{
|
children: [{
|
||||||
path: 'simple',
|
path: 'simple',
|
||||||
component: SimpleCmp,
|
component: SimpleCmp,
|
||||||
canDeactivate: ['RecordingDeactivate']
|
canDeactivate: ['RecordingDeactivate']
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{path: 'simple', component: SimpleCmp}
|
{path: 'simple', component: SimpleCmp}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
router.navigateByUrl('/grandparent/parent/child/simple');
|
router.navigateByUrl('/grandparent/parent/child/simple');
|
||||||
advance(fixture);
|
advance(fixture);
|
||||||
expect(location.path()).toEqual('/grandparent/parent/child/simple');
|
expect(location.path()).toEqual('/grandparent/parent/child/simple');
|
||||||
|
|
||||||
router.navigateByUrl('/simple');
|
router.navigateByUrl('/simple');
|
||||||
advance(fixture);
|
advance(fixture);
|
||||||
|
|
||||||
const child = fixture.debugElement.children[1].componentInstance;
|
const child = fixture.debugElement.children[1].componentInstance;
|
||||||
|
|
||||||
expect(log.map((a: any) => a.path)).toEqual([
|
expect(log.map((a: any) => a.path)).toEqual([
|
||||||
'simple', 'child', 'parent', 'grandparent'
|
'simple', 'child', 'parent', 'grandparent'
|
||||||
]);
|
]);
|
||||||
expect(log.map((a: any) => a.component)).toEqual([child, null, null, null]);
|
expect(log[0].component instanceof SimpleCmp).toBeTruthy();
|
||||||
})));
|
[1, 2, 3].forEach(i => expect(log[i].component).toBeNull());
|
||||||
|
expect(child instanceof SimpleCmp).toBeTruthy();
|
||||||
|
expect(child).not.toBe(log[0].component);
|
||||||
|
})));
|
||||||
|
|
||||||
it('works with aux routes',
|
it('works with aux routes',
|
||||||
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
|
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user