fix(card): disable all animations when using NoopAnimationsModule (#11538)

* fix(card): disable all animations when using NoopAnimationsModule

Fixes the card `box-shadow` transition not being disabled when it's inside something with the `NoopAnimationsModule`.

Relates to #10590.

* fix lint

* fix api test
This commit is contained in:
Kristiyan Kostadinov
2019-06-12 01:21:20 +02:00
committed by mmalerba
parent 2e047b4873
commit 11a4ff0a6d
3 changed files with 15 additions and 2 deletions
+2
View File
@@ -1,5 +1,6 @@
@import '../core/style/variables';
@import '../core/style/elevation';
@import '../core/style/noop-animation';
@import '../../cdk/a11y/a11y';
@@ -9,6 +10,7 @@ $mat-card-header-size: 40px !default;
.mat-card {
@include mat-elevation-transition;
@include _noop-animation();
display: block;
position: relative;
padding: $mat-card-padding;
+11 -2
View File
@@ -12,7 +12,10 @@ import {
ChangeDetectionStrategy,
Directive,
Input,
Optional,
Inject,
} from '@angular/core';
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
/**
@@ -156,9 +159,15 @@ export class MatCardAvatar {}
styleUrls: ['card.css'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
host: {'class': 'mat-card'}
host: {
'class': 'mat-card',
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
}
})
export class MatCard {}
export class MatCard {
// @breaking-change 9.0.0 `_animationMode` parameter to be made required.
constructor(@Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode?: string) {}
}
/**
+2
View File
@@ -1,4 +1,6 @@
export declare class MatCard {
_animationMode?: string | undefined;
constructor(_animationMode?: string | undefined);
}
export declare class MatCardActions {