8000 docs(docs-infra): replace deprecated RouterTestingModule with RouterM… · angular/angular@59983ef · GitHub
[go: up one dir, main page]

Skip to content

Commit 59983ef

Browse files
akib1997thePunderWoman
authored andcommitted
docs(docs-infra): replace deprecated RouterTestingModule with RouterModule.forRoot([]) (#62364)
PR Close #62364
1 parent d1d131a commit 59983ef

File tree

9 files changed

+28
-20
lines changed

9 files changed

+28
-20
lines changed

adev/shared-docs/components/breadcrumb/breadcrumb.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {Breadcrumb} from './breadcrumb.component';
1212
import {NavigationState} from '../../services';
1313
import {NavigationItem} from '../../interfaces';
1414
import {By} from '@angular/platform-browser';
15-
import {RouterTestingModule} from '@angular/router/testing';
15+
import {provideRouter} from '@angular/router';
1616
import {provideZonelessChangeDetection} from '@angular/core';
1717

1818
describe('Breadcrumb', () => {
@@ -23,8 +23,9 @@ describe('Breadcrumb', () => {
2323
navigationStateSpy = jasmine.createSpyObj('NavigationState', ['activeNavigationItem']);
2424

2525
TestBed.configureTestingModule({
26-
imports: [Breadcrumb, RouterTestingModule],
26+
imports: [Breadcrumb],
2727
providers: [
28+
provideRouter([]),
2829
provideZonelessChangeDetection(),
2930
{
3031
provide: NavigationState,

adev/shared-docs/components/search-dialog/search-dialog.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import {ALGOLIA_CLIENT, Search} from '../../services';
1414
import {FakeEventTarget} from '../../testing/index';
1515
import {By} from '@angular/platform-browser';
1616
import {AlgoliaIcon} from '../algolia-icon/algolia-icon.component';
17-
import {RouterTestingModule} from '@angular/router/testing';
18-
import {Router} from '@angular/router';
17+
import {Router, provideRouter} from '@angular/router';
1918
import {ApplicationRef, provideZonelessChangeDetection, ResourceStatus} from '@angular/core';
2019
import {SearchResult} from '../../interfaces';
2120

@@ -32,8 +31,9 @@ describe('SearchDialog', () => {
3231
searchResults.and.returnValue([]);
3332

3433
TestBed.configureTestingModule({
35-
imports: [SearchDialog, RouterTestingModule],
34+
imports: [SearchDialog],
3635
providers: [
36+
provideRouter([]),
3737
provideZonelessChangeDetection(),
3838
{provide: ENVIRONMENT, useValue: {algolia: {index: 'fakeIndex'}}},
3939
{provide: ALGOLIA_CLIENT, useValue: {search: searchResults}},

adev/shared-docs/components/table-of-contents/table-of-contents.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {ComponentFixture, TestBed} from '@angular/core/testing';
1010
import {TableOfContents} from './table-of-contents.component';
11-
import {RouterTestingModule} from '@angular/router/testing';
11+
import {provideRouter} from '@angular/router';
1212
import {TableOfContentsItem, TableOfContentsLevel} from '../../interfaces/index';
1313
import {TableOfContentsLoader} from '../../services/index';
1414
import {WINDOW} from '../../providers/index';
@@ -41,8 +41,9 @@ describe('TableOfContents', () => {
4141

4242
beforeEach(async () => {
4343
await TestBed.configureTestingModule({
44-
imports: [TableOfContents, RouterTestingModule],
44+
imports: [TableOfContents],
4545
providers: [
46+
provideRouter([]),
4647
provideZonelessChangeDetection(),
4748
{
4849
provide: WINDOW,

adev/shared-docs/directives/click-outside/click-outside.directive.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {Component} from '@angular/core';
1010
import {ComponentFixture, TestBed} from '@angular/core/testing';
11-
import {RouterTestingModule} from '@angular/router/testing';
11+
import {provideRouter} from '@angular/router';
1212
import {ClickOutside} from './click-outside.directive';
1313
import {By} from '@angular/platform-browser';
1414

@@ -18,7 +18,8 @@ describe('ClickOutside', () => {
1818

1919
beforeEach(() => {
2020
TestBed.configureTestingModule({
21-
imports: [ExampleComponent, RouterTestingModule],
21+
imports: [ExampleComponent],
22+
providers: [provideRouter([])],
2223
});
2324
fixture = TestBed.createComponent(ExampleComponent);
2425
component = fixture.componentInstance;

adev/shared-docs/directives/external-link/external-link.directive.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88

99
import {Component} from '@angular/core';
1010
import {ExternalLink} from './external-link.directive';
11-
import {RouterLink} from '@angular/router';
11+
import {provideRouter, RouterLink} from '@angular/router';
1212
import {ComponentFixture, TestBed} from '@angular/core/testing';
1313
import {WINDOW} from '../../providers';
14-
import {RouterTestingModule} from '@angular/router/testing';
1514
import {By} from '@angular/platform-browser';
1615

1716
describe('ExternalLink', () => {
@@ -24,8 +23,9 @@ describe('ExternalLink', () => {
2423

2524
beforeEach(() => {
2625
TestBed.configureTestingModule({
27-
imports: [ExampleComponentWithLinks, RouterTestingModule],
26+
imports: [ExampleComponentWithLinks],
2827
providers: [
28+
provideRouter([]),
2929
{
3030
provide: WINDOW,
3131
useValue: fakeWindow,

adev/src/app/core/layout/footer/footer.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {ComponentFixture, TestBed} from '@angular/core/testing';
1010

1111
import {WINDOW} from '@angular/docs';
12-
import {RouterTestingModule} from '@angular/router/testing';
12+
import {provideRouter} from '@angular/router';
1313
import {Footer} from './footer.component';
1414

1515
describe('Footer', () => {
@@ -23,8 +23,9 @@ describe('Footer', () => {
2323

2424
beforeEach(() => {
2525
TestBed.configureTestingModule({
26-
imports: [Footer, RouterTestingModule],
26+
imports: [Footer],
2727
providers: [
28+
provideRouter([]),
2829
{
2930
provide: WINDOW,
3031
useValue: fakeWindow,

adev/src/app/core/layout/navigation/navigation.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {ComponentFixture, TestBed} from '@angular/core/testing';
1010

1111
import {Navigation} from './navigation.component';
12-
import {RouterTestingModule} from '@angular/router/testing';
12+
import {provideRouter} from '@angular/router';
1313
import {By} from '@angular/platform-browser';
1414
import {PagePrefix} from '../../enums/pages';
1515
import {Theme, ThemeManager} from '../../services/theme-manager.service';
@@ -38,8 +38,9 @@ describe('Navigation', () => {
3838

3939
beforeEach(async () => {
4040
await TestBed.configureTestingModule({
41-
imports: [Navigation, RouterTestingModule],
41+
imports: [Navigation],
4242
providers: [
43+
provideRouter([]),
4344
{
4445
provide: WINDOW,
4546
useValue: fakeWindow,

adev/src/app/core/layout/progress-bar/progress-bar.component.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
import {ComponentFixture, TestBed} from '@angular/core/testing';
1010

1111
import {PROGRESS_BAR_DELAY, ProgressBarComponent} from './progress-bar.component';
12-
import {RouterTestingHarness, RouterTestingModule} from '@angular/router/testing';
12+
import {RouterTestingHarness} from '@angular/router/testing';
13+
import {provideRouter} from '@angular/router';
1314

1415
describe('ProgressBarComponent', () => {
1516
let component: ProgressBarComponent;
1617
let fixture: ComponentFixture<ProgressBarComponent>;
1718

1819
beforeEach(async () => {
1920
await TestBed.configureTestingModule({
20-
imports: [ProgressBarComponent, RouterTestingModule],
21+
imports: [ProgressBarComponent],
22+
providers: [provideRouter([])],
2123
});
2224

2325
fixture = TestBed.createComponent(ProgressBarComponent);

adev/src/app/features/docs/docs.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {ComponentFixture, TestBed} from '@angular/core/testing';
1010

1111
import DocsComponent from './docs.component';
12-
import {RouterTestingModule} from '@angular/router/testing';
12+
import {provideRouter} from '@angular/router';
1313
import {DOCS_CONTENT_LOADER, WINDOW} from '@angular/docs';
1414

1515
describe('DocsComponent', () => {
@@ -25,8 +25,9 @@ describe('DocsComponent', () => {
2525

2626
beforeEach(() => {
2727
TestBed.configureTestingModule({
28-
imports: [DocsComponent, RouterTestingModule],
28+
imports: [DocsComponent],
2929
providers: [
30+
provideRouter([]),
3031
{
3132
provide: WINDOW,
3233
useValue: fakeWindow,

0 commit comments

Comments
 (0)
0