Skip to content

Commit

Permalink
fixup! feat(router): Create APIs for using Router without RouterModule
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKushnir committed Aug 10, 2022
1 parent 7db44bd commit f8ab94e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 13 deletions.
5 changes: 0 additions & 5 deletions goldens/public-api/router/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@ import * as i1 from '@angular/router';
import { Injector } from '@angular/core';
import { Location as Location_2 } from '@angular/common';
import { ModuleWithProviders } from '@angular/core';
import { Provider } from '@angular/core';
import { Route } from '@angular/router';
import { Router } from '@angular/router';
import { RouteReuseStrategy } from '@angular/router';
import { RouterFeatures } from '@angular/router';
import { Routes } from '@angular/router';
import { TitleStrategy } from '@angular/router';
import { UrlHandlingStrategy } from '@angular/router';
import { UrlSerializer } from '@angular/router';

// @public
export function provideRouterForTesting(routes?: Routes, ...features: RouterFeatures[]): Provider[];

// @public
export class RouterTestingModule {
// (undocumented)
Expand Down
2 changes: 1 addition & 1 deletion packages/router/test/computed_state_restoration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {CanActivate, CanDeactivate, Resolve, Router, RouterModule, RouterOutlet,
import {EMPTY, Observable, of} from 'rxjs';

import {isUrlTree} from '../src/url_tree';
import {provideRouterForTesting} from '../testing';
import {provideRouterForTesting} from '../testing/src/provide_router_for_testing';

describe('`restoredState#ɵrouterPageId`', () => {
@Injectable({providedIn: 'root'})
Expand Down
3 changes: 2 additions & 1 deletion packages/router/test/page_title_strategy_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {DOCUMENT} from '@angular/common';
import {Component, Inject, Injectable, NgModule} from '@angular/core';
import {fakeAsync, TestBed, tick} from '@angular/core/testing';
import {Router, RouterModule, RouterStateSnapshot, TitleStrategy} from '@angular/router';
import {provideRouterForTesting} from '@angular/router/testing';

import {provideRouterForTesting} from '../testing/src/provide_router_for_testing';

describe('title strategy', () => {
describe('DefaultTitleStrategy', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/router/test/regression_integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import {SpyLocation} from '@angular/common/testing';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injectable, NgModule, TemplateRef, Type, ViewChild, ViewContainerRef} from '@angular/core';
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {ChildrenOutletContexts, Resolve, Router, RouterOutlet} from '@angular/router';
import {provideRouterForTesting, RouterTestingModule} from '@angular/router/testing';
import {RouterTestingModule} from '@angular/router/testing';
import {of} from 'rxjs';
import {delay, mapTo} from 'rxjs/operators';

import {provideRouterForTesting} from '../testing/src/provide_router_for_testing';

describe('Integration', () => {
describe('routerLinkActive', () => {
it('should update when the associated routerLinks change - #18469', fakeAsync(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/router/test/router_preloader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {catchError, delay, filter, switchMap, take} from 'rxjs/operators';

import {Route, RouteConfigLoadEnd, RouteConfigLoadStart, Router, RouterModule} from '../index';
import {getLoadedComponent, getLoadedInjector, getLoadedRoutes, getProvidersInjector} from '../src/utils/config';
import {provideRouterForTesting} from '../testing';
import {provideRouterForTesting} from '../testing/src/provide_router_for_testing';


describe('RouterPreloader', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/router/testing/src/provide_router_for_testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ import {provideRouter, RouterFeatures, Routes} from '@angular/router';
* @param routes A set of `Route`s to use during the test.
* @param features Optional features to configure additional router behaviors.
* @returns A set of providers to setup Router for testing.
*
* @publicApi
* @developerPreview
*/
export function provideRouterForTesting(
routes: Routes = [], ...features: RouterFeatures[]): Provider[] {
Expand Down
1 change: 0 additions & 1 deletion packages/router/testing/src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
* Entry point for all public APIs of the router/testing package.
*/
export * from './router_testing_module';
export * from './provide_router_for_testing';
export * from './spy_ng_module_factory_loader';

0 comments on commit f8ab94e

Please sign in to comment.