feat(router): add router-level events for GuardsCheck and Resolve (#17601)
This commit is contained in:
@ -82,8 +82,10 @@ describe('bootstrap', () => {
|
||||
const router = res.injector.get(Router);
|
||||
const data = router.routerState.snapshot.root.firstChild !.data;
|
||||
expect(data['test']).toEqual('test-data');
|
||||
expect(log).toEqual(
|
||||
['TestModule', 'NavigationStart', 'RoutesRecognized', 'RootCmp', 'NavigationEnd']);
|
||||
expect(log).toEqual([
|
||||
'TestModule', 'NavigationStart', 'RoutesRecognized', 'GuardsCheckStart', 'GuardsCheckEnd',
|
||||
'ResolveStart', 'ResolveEnd', 'RootCmp', 'NavigationEnd'
|
||||
]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -116,8 +118,11 @@ describe('bootstrap', () => {
|
||||
platformBrowserDynamic([]).bootstrapModule(TestModule).then(res => {
|
||||
const router = res.injector.get(Router);
|
||||
expect(router.routerState.snapshot.root.firstChild).toBeNull();
|
||||
// NavigationEnd has not been emitted yet because bootstrap returned too early
|
||||
expect(log).toEqual(['TestModule', 'RootCmp', 'NavigationStart', 'RoutesRecognized']);
|
||||
// ResolveEnd has not been emitted yet because bootstrap returned too early
|
||||
expect(log).toEqual([
|
||||
'TestModule', 'RootCmp', 'NavigationStart', 'RoutesRecognized', 'GuardsCheckStart',
|
||||
'GuardsCheckEnd', 'ResolveStart'
|
||||
]);
|
||||
|
||||
router.events.subscribe((e) => {
|
||||
if (e instanceof NavigationEnd) {
|
||||
|
Reference in New Issue
Block a user