Skip to content

Commit ea2ea5e

Browse files
crisbetoalxhub
authored andcommitted
test(core): update tests that were relying on implicit animations module (#59762)
We had some tests that were relying on the fact that the server module was importing animations implicitly. PR Close #59762
1 parent fc5d187 commit ea2ea5e

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

packages/core/test/acceptance/integration_spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {getLView} from '@angular/core/src/render3/state';
3838
import {ngDevModeResetPerfCounters} from '@angular/core/src/util/ng_dev_mode';
3939
import {fakeAsync, flushMicrotasks, TestBed} from '@angular/core/testing';
4040
import {By} from '@angular/platform-browser';
41+
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
4142
import {expectPerfCounters} from '@angular/private/testing';
4243

4344
describe('acceptance integration tests', () => {
@@ -2889,6 +2890,7 @@ describe('acceptance integration tests', () => {
28892890

28902891
TestBed.configureTestingModule({
28912892
declarations: [Cmp, AnimationComp],
2893+
imports: [NoopAnimationsModule],
28922894
providers: [{provide: AnimationDriver, useClass: MockAnimationDriver}],
28932895
});
28942896
const fixture = TestBed.createComponent(Cmp);
@@ -2979,6 +2981,7 @@ describe('acceptance integration tests', () => {
29792981

29802982
TestBed.configureTestingModule({
29812983
declarations: [Cmp, InnerComp],
2984+
imports: [NoopAnimationsModule],
29822985
providers: [{provide: AnimationDriver, useClass: MockAnimationDriver}],
29832986
});
29842987
const fixture = TestBed.createComponent(Cmp);

packages/core/test/acceptance/property_binding_spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {CommonModule} from '@angular/common';
1010
import {Component, Directive, EventEmitter, Input, Output, ViewContainerRef} from '@angular/core';
1111
import {TestBed} from '@angular/core/testing';
1212
import {By, DomSanitizer, SafeUrl} from '@angular/platform-browser';
13+
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
1314

1415
describe('property bindings', () => {
1516
it('should support bindings to properties', () => {
@@ -689,7 +690,10 @@ describe('property bindings', () => {
689690
})
690691
class App {}
691692

692-
TestBed.configureTestingModule({declarations: [App, MyDir, MyComp]});
693+
TestBed.configureTestingModule({
694+
declarations: [App, MyDir, MyComp],
695+
imports: [NoopAnimationsModule],
696+
});
693697

694698
expect(() => {
695699
const fixture = TestBed.createComponent(App);

packages/core/test/change_detection_scheduler_spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,8 @@ describe('Angular with zoneless enabled', () => {
372372
expect(host.innerHTML).toEqual('<dynamic-cmp>binding</dynamic-cmp>');
373373

374374
const component2 = createComponent(DynamicCmp, {environmentInjector});
375-
// TODO(atscott): Only needed because renderFactory will not run if ApplicationRef has no
376-
// views. This should likely be fixed in ApplicationRef
377375
appRef.attachView(component2.hostView);
378376
appRef.detachView(component.hostView);
379-
// DOM is not synchronously removed because change detection hasn't run
380-
expect(host.innerHTML).toEqual('<dynamic-cmp>binding</dynamic-cmp>');
381377
expect(isStable()).toBe(false);
382378
await whenStable();
383379
expect(host.innerHTML).toEqual('');

packages/core/test/linker/change_detection_integration_spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {isTextNode} from '@angular/platform-browser/testing/src/browser_util';
4545
import {expect} from '@angular/platform-browser/testing/src/matchers';
4646

4747
import {MockResourceLoader} from './resource_loader_mock';
48+
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
4849

4950
const TEST_COMPILER_PROVIDERS: Provider[] = [
5051
{provide: ResourceLoader, useClass: MockResourceLoader, deps: []},
@@ -110,6 +111,7 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [
110111
beforeEach(() => {
111112
TestBed.configureCompiler({providers: TEST_COMPILER_PROVIDERS});
112113
TestBed.configureTestingModule({
114+
imports: [NoopAnimationsModule],
113115
declarations: [
114116
TestData,
115117
TestDirective,

packages/platform-server/test/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ts_library(
4747
"//packages/localize",
4848
"//packages/localize/init",
4949
"//packages/platform-browser",
50+
"//packages/platform-browser/animations",
5051
"//packages/platform-server",
5152
"//packages/private/testing",
5253
"//packages/router",

packages/platform-server/test/integration_spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import {provideRouter, RouterOutlet, Routes} from '@angular/router';
6666
import {Observable} from 'rxjs';
6767

6868
import {renderApplication, SERVER_CONTEXT} from '../src/utils';
69+
import {BrowserAnimationsModule, provideAnimations} from '@angular/platform-browser/animations';
6970

7071
const APP_CONFIG: ApplicationConfig = {
7172
providers: [provideServerRendering()],
@@ -390,11 +391,13 @@ function createMyAnimationApp(standalone: boolean) {
390391
}
391392

392393
const MyAnimationApp = createMyAnimationApp(false);
393-
const MyAnimationAppStandalone = getStandaloneBootstrapFn(createMyAnimationApp(true));
394+
const MyAnimationAppStandalone = getStandaloneBootstrapFn(createMyAnimationApp(true), [
395+
provideAnimations(),
396+
]);
394397

395398
@NgModule({
396399
declarations: [MyAnimationApp],
397-
imports: [BrowserModule, ServerModule],
400+
imports: [BrowserModule, BrowserAnimationsModule, ServerModule],
398401
bootstrap: [MyAnimationApp],
399402
})
400403
class AnimationServerModule {}

0 commit comments

Comments
 (0)