Skip to content

Commit 0419d71

Browse files
authored
refactor(multiple): remove remaining references to NoopAnimationsModule (#31810)
Cleans up the remaining references to `NoopAnimationsModule` in comments and in tests.
1 parent 1b5f334 commit 0419d71

File tree

9 files changed

+18
-17
lines changed

9 files changed

+18
-17
lines changed

src/cdk/overlay/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ ts_project(
6868
":overlay",
6969
"//:node_modules/@angular/common",
7070
"//:node_modules/@angular/core",
71-
"//:node_modules/@angular/platform-browser",
7271
"//:node_modules/rxjs",
7372
"//src/cdk/bidi",
7473
"//src/cdk/keycodes",

src/cdk/overlay/overlay-directives.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Component, ElementRef, Injector, signal, ViewChild, WritableSignal} from '@angular/core';
22
import {ComponentFixture, fakeAsync, TestBed, tick, waitForAsync} from '@angular/core/testing';
3-
import {By} from '@angular/platform-browser';
43
import {Subject} from 'rxjs';
54
import {Direction} from '../bidi';
65
import {A, ESCAPE} from '../keycodes';
@@ -381,7 +380,7 @@ describe('Overlay directives', () => {
381380
});
382381

383382
it('should set the offsetY', () => {
384-
const trigger = fixture.debugElement.query(By.css('button'))!.nativeElement;
383+
const trigger = fixture.nativeElement.querySelector('button');
385384
trigger.style.position = 'absolute';
386385
trigger.style.top = '30px';
387386
trigger.style.height = '20px';

src/cdk/overlay/overlay.spec.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {Location} from '@angular/common';
22
import {SpyLocation} from '@angular/common/testing';
33
import {
4+
ANIMATION_MODULE_TYPE,
45
Component,
56
ErrorHandler,
67
EventEmitter,
78
Injectable,
89
Injector,
9-
Type,
10+
Provider,
1011
ViewChild,
1112
ViewContainerRef,
1213
WritableSignal,
@@ -21,7 +22,6 @@ import {
2122
tick,
2223
waitForAsync,
2324
} from '@angular/core/testing';
24-
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
2525
import {Direction, Directionality} from '../bidi';
2626
import {CdkPortal, ComponentPortal, TemplatePortal} from '../portal';
2727
import {dispatchFakeEvent} from '../testing/private';
@@ -47,16 +47,16 @@ describe('Overlay', () => {
4747
let dir: WritableSignal<Direction>;
4848
let mockLocation: SpyLocation;
4949

50-
function setup(imports: Type<unknown>[] = []) {
50+
function setup(providers: Provider[] = []) {
5151
dir = signal<Direction>('ltr');
5252
TestBed.configureTestingModule({
53-
imports,
5453
providers: [
5554
provideFakeDirectionality(dir),
5655
{
5756
provide: Location,
5857
useClass: SpyLocation,
5958
},
59+
...providers,
6060
],
6161
});
6262

@@ -892,7 +892,12 @@ describe('Overlay', () => {
892892
it('should set a class on the backdrop when animations are disabled', () => {
893893
cleanup();
894894
TestBed.resetTestingModule();
895-
setup([NoopAnimationsModule]);
895+
setup([
896+
{
897+
provide: ANIMATION_MODULE_TYPE,
898+
useValue: 'NoopAnimations',
899+
},
900+
]);
896901

897902
let overlayRef = createOverlayRef(injector, config);
898903
overlayRef.attach(componentPortal);

src/material/button-toggle/button-toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ export class MatButtonToggle implements OnInit, AfterViewInit, OnDestroy {
716716
// This serves two purposes:
717717
// 1. We don't want the animation to fire on the first render for pre-checked toggles so we
718718
// delay adding the class until the view is rendered.
719-
// 2. We don't want animation if the `NoopAnimationsModule` is provided.
719+
// 2. We don't want to animate if animations are disabled.
720720
if (!this._animationDisabled) {
721721
this._elementRef.nativeElement.classList.add('mat-button-toggle-animations-enabled');
722722
}

src/material/core/ripple/ripple.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const globalRippleConfig: RippleGlobalOptions = {
118118
};
119119
```
120120

121-
**Note**: Ripples will also have no animation if the `NoopAnimationsModule` is being used. This
121+
**Note**: Ripples will also have no animation if animations are disabled globally. This
122122
also means that the durations in the `animation` configuration won't be taken into account.
123123

124124
### Animation behavior

src/material/core/ripple/ripple.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface RippleGlobalOptions {
3434
/**
3535
* Default configuration for the animation duration of the ripples. There are two phases with
3636
* different durations for the ripples: `enter` and `leave`. The durations will be overwritten
37-
* by the value of `matRippleAnimation` or if the `NoopAnimationsModule` is included.
37+
* by the value of `matRippleAnimation` or if animations are disabled.
3838
*/
3939
animation?: RippleAnimationConfig;
4040

@@ -88,8 +88,8 @@ export class MatRipple implements OnInit, OnDestroy, RippleTarget {
8888

8989
/**
9090
* Configuration for the ripple animation. Allows modifying the enter and exit animation
91-
* duration of the ripples. The animation durations will be overwritten if the
92-
* `NoopAnimationsModule` is being used.
91+
* duration of the ripples. The animation durations will be overwritten if animations are
92+
* disabled.
9393
*/
9494
@Input('matRippleAnimation') animation: RippleAnimationConfig;
9595

src/material/expansion/expansion-panel-header.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ $fallbacks: m3-expansion.get-tokens();
5656
}
5757
}
5858

59-
// If the `NoopAnimationsModule` is used, disable the height transition.
6059
&._mat-animation-noopable {
6160
transition: none;
6261
}

src/material/progress-spinner/progress-spinner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export interface MatProgressSpinnerDefaultOptions {
3838
/** Width of the spinner's stroke. */
3939
strokeWidth?: number;
4040
/**
41-
* Whether the animations should be force to be enabled, ignoring if the current environment is
42-
* using NoopAnimationsModule.
41+
* Whether the animations should be force to be enabled, ignoring if the current environment
42+
* disables them.
4343
*/
4444
_forceAnimations?: boolean;
4545
}

src/material/sidenav/drawer.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ $fallbacks: m3-sidenav.get-tokens();
5454
z-index: $drawer-backdrop-z-index;
5555
}
5656

57-
// Note that the `NoopAnimationsModule` is being handled inside of the component code.
5857
&.ng-animate-disabled,
5958
.ng-animate-disabled & {
6059
.mat-drawer-backdrop,

0 commit comments

Comments
 (0)