refactor(router): remove RouteEvent base class (#19043)

* Introduced with #18407, `RouteEvents` don't actually have a common constructor. Reverting here to be able to add new functionality to ChildActivation events.

PR Close #19043
This commit is contained in:
Jason Aden
2017-09-05 11:54:33 -07:00
committed by Miško Hevery
parent 1a9d382da9
commit dce36751f5
6 changed files with 57 additions and 59 deletions

View File

@ -11,7 +11,7 @@ import {ChangeDetectionStrategy, Component, Injectable, NgModule, NgModuleFactor
import {ComponentFixture, TestBed, fakeAsync, inject, tick} from '@angular/core/testing';
import {By} from '@angular/platform-browser/src/dom/debug/by';
import {expect} from '@angular/platform-browser/testing/src/matchers';
import {ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanDeactivate, ChildActivationEnd, ChildActivationStart, DetachedRouteHandle, Event, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, PRIMARY_OUTLET, ParamMap, Params, PreloadAllModules, PreloadingStrategy, Resolve, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteEvent, RouteReuseStrategy, Router, RouterModule, RouterPreloader, RouterStateSnapshot, RoutesRecognized, RunGuardsAndResolvers, UrlHandlingStrategy, UrlSegmentGroup, UrlTree} from '@angular/router';
import {ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanDeactivate, ChildActivationEnd, ChildActivationStart, DetachedRouteHandle, Event, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, PRIMARY_OUTLET, ParamMap, Params, PreloadAllModules, PreloadingStrategy, Resolve, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterModule, RouterPreloader, RouterStateSnapshot, RoutesRecognized, RunGuardsAndResolvers, UrlHandlingStrategy, UrlSegmentGroup, UrlTree} from '@angular/router';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
import {of } from 'rxjs/observable/of';
@ -428,7 +428,7 @@ describe('Integration', () => {
}]);
const recordedEvents: any[] = [];
router.events.forEach(e => e instanceof RouteEvent || recordedEvents.push(e));
router.events.forEach(e => e instanceof RouterEvent && recordedEvents.push(e));
router.navigateByUrl('/team/22/user/victor');
advance(fixture);
@ -986,7 +986,7 @@ describe('Integration', () => {
[{path: 'simple', component: SimpleCmp, resolve: {error: 'resolveError'}}]);
const recordedEvents: any[] = [];
router.events.subscribe(e => e instanceof RouteEvent || recordedEvents.push(e));
router.events.subscribe(e => e instanceof RouterEvent && recordedEvents.push(e));
let e: any = null;
router.navigateByUrl('/simple') !.catch(error => e = error);
@ -3344,7 +3344,7 @@ describe('Integration', () => {
}]);
const events: any[] = [];
router.events.subscribe(e => e instanceof RouteEvent || events.push(e));
router.events.subscribe(e => e instanceof RouterEvent && events.push(e));
// supported URL
router.navigateByUrl('/include/user/kate');
@ -3408,7 +3408,7 @@ describe('Integration', () => {
}]);
const events: any[] = [];
router.events.subscribe(e => e instanceof RouteEvent || events.push(e));
router.events.subscribe(e => e instanceof RouterEvent && events.push(e));
location.go('/include/user/kate(aux:excluded)');
advance(fixture);