Skip to content

Commit 31c4dad

Browse files
authored
fix(material/schematics): remove NoopAnimationsModule from generated tests (#30562)
Removes the `NoopAnimationsModule` from the tests generated by `ng generate` since it requires the animations module to be installed. Fixes #30560.
1 parent fc46997 commit 31c4dad

File tree

6 files changed

+26
-38
lines changed

6 files changed

+26
-38
lines changed

Diff for: src/cdk/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('<%= classify(name) %>Component', () => {
1010
TestBed.configureTestingModule({
1111
declarations: [<%= classify(name) %>Component],
1212
imports: [DragDropModule]
13-
}).compileComponents();
13+
});
1414
}));<% } %>
1515

1616
beforeEach(() => {

Diff for: src/material/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';<% if(!standalone) { %>
1+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';<% if(!standalone) { %>
32
import { ReactiveFormsModule } from '@angular/forms';
43
import { MatButtonModule } from '@angular/material/button';
54
import { MatCardModule } from '@angular/material/card';
@@ -11,23 +10,21 @@ import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.compone
1110

1211
describe('<%= classify(name) %>Component', () => {
1312
let component: <%= classify(name) %>Component;
14-
let fixture: ComponentFixture<<%= classify(name) %>Component>;
13+
let fixture: ComponentFixture<<%= classify(name) %>Component>;<% if(!standalone) { %>
1514

1615
beforeEach(waitForAsync(() => {
17-
TestBed.configureTestingModule({<% if(standalone) { %>
18-
imports: [NoopAnimationsModule]<% } else { %>
16+
TestBed.configureTestingModule({
1917
declarations: [<%= classify(name) %>Component],
2018
imports: [
21-
NoopAnimationsModule,
2219
ReactiveFormsModule,
2320
MatButtonModule,
2421
MatCardModule,
2522
MatInputModule,
2623
MatRadioModule,
2724
MatSelectModule,
28-
]<% } %>
29-
}).compileComponents();
30-
}));
25+
]
26+
});
27+
}));<% } %>
3128

3229
beforeEach(() => {
3330
fixture = TestBed.createComponent(<%= classify(name) %>Component);

Diff for: src/material/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';<% if(!standalone) { %>
1+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';<% if(!standalone) { %>
32
import { MatButtonModule } from '@angular/material/button';
43
import { MatCardModule } from '@angular/material/card';
54
import { MatGridListModule } from '@angular/material/grid-list';
@@ -10,22 +9,20 @@ import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.compone
109

1110
describe('<%= classify(name) %>Component', () => {
1211
let component: <%= classify(name) %>Component;
13-
let fixture: ComponentFixture<<%= classify(name) %>Component>;
12+
let fixture: ComponentFixture<<%= classify(name) %>Component>;<% if(!standalone) { %>
1413

1514
beforeEach(waitForAsync(() => {
16-
TestBed.configureTestingModule({<% if(standalone) { %>
17-
imports: [NoopAnimationsModule]<% } else { %>
15+
TestBed.configureTestingModule({
1816
declarations: [<%= classify(name) %>Component],
1917
imports: [
20-
NoopAnimationsModule,
2118
MatButtonModule,
2219
MatCardModule,
2320
MatGridListModule,
2421
MatIconModule,
2522
MatMenuModule,
26-
]<% } %>
27-
}).compileComponents();
28-
}));
23+
]
24+
});
25+
}));<% } %>
2926

3027
beforeEach(() => {
3128
fixture = TestBed.createComponent(<%= classify(name) %>Component);

Diff for: src/material/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';<% if(!standalone) { %>
1+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';<% if(!standalone) { %>
32
import { MatButtonModule } from '@angular/material/button';
43
import { MatIconModule } from '@angular/material/icon';
54
import { MatListModule } from '@angular/material/list';
@@ -10,22 +9,20 @@ import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.compone
109

1110
describe('<%= classify(name) %>Component', () => {
1211
let component: <%= classify(name) %>Component;
13-
let fixture: ComponentFixture<<%= classify(name) %>Component>;
12+
let fixture: ComponentFixture<<%= classify(name) %>Component>;<% if(standalone) { %>
1413

1514
beforeEach(waitForAsync(() => {
16-
TestBed.configureTestingModule({<% if(standalone) { %>
17-
imports: [NoopAnimationsModule]<% } else { %>
15+
TestBed.configureTestingModule({
1816
declarations: [<%= classify(name) %>Component],
1917
imports: [
20-
NoopAnimationsModule,
2118
MatButtonModule,
2219
MatIconModule,
2320
MatListModule,
2421
MatSidenavModule,
2522
MatToolbarModule,
26-
]<% } %>
27-
}).compileComponents();
28-
}));
23+
]
24+
});
25+
}));<% } %>
2926

3027
beforeEach(() => {
3128
fixture = TestBed.createComponent(<%= classify(name) %>Component);

Diff for: src/material/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';<% if(!standalone) { %>
1+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';<% if(!standalone) { %>
32
import { MatPaginatorModule } from '@angular/material/paginator';
43
import { MatSortModule } from '@angular/material/sort';
54
import { MatTableModule } from '@angular/material/table';<% } %>
@@ -8,20 +7,18 @@ import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.compone
87

98
describe('<%= classify(name) %>Component', () => {
109
let component: <%= classify(name) %>Component;
11-
let fixture: ComponentFixture<<%= classify(name) %>Component>;
10+
let fixture: ComponentFixture<<%= classify(name) %>Component>;<% if(!standalone) { %>
1211

1312
beforeEach(waitForAsync(() => {
14-
TestBed.configureTestingModule({<% if(standalone) { %>
15-
imports: [NoopAnimationsModule]<% } else { %>
13+
TestBed.configureTestingModule({
1614
declarations: [<%= classify(name) %>Component],
1715
imports: [
18-
NoopAnimationsModule,
1916
MatPaginatorModule,
2017
MatSortModule,
2118
MatTableModule,
22-
]<% } %>
23-
}).compileComponents();
24-
}));
19+
]
20+
});
21+
}));<% } %>
2522

2623
beforeEach(() => {
2724
fixture = TestBed.createComponent(<%= classify(name) %>Component);

Diff for: src/material/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('<%= classify(name) %>Component', () => {
1717
MatIconModule,
1818
MatTreeModule,
1919
]
20-
}).compileComponents();
20+
});
2121
}));<% } %>
2222

2323
beforeEach(() => {

0 commit comments

Comments
 (0)