test(animations): fix Node.js detection in animation tests (#24139)
PR Close #24139
This commit is contained in:
parent
1eafd04eb3
commit
3fd3c2ac4c
|
@ -20,7 +20,7 @@ function createDiv() {
|
|||
{
|
||||
describe('Animation', () => {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
let rootElement: any;
|
||||
let subElement1: any;
|
||||
|
|
|
@ -17,7 +17,7 @@ import {makeTrigger} from '../shared';
|
|||
{
|
||||
describe('AnimationTrigger', () => {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
let element: any;
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -16,9 +16,7 @@ import {assertElementExistsInDom, createElement, findKeyframeDefinition, forceRe
|
|||
const CSS_KEYFRAME_RULE_TYPE = 7;
|
||||
|
||||
describe('CssKeyframesDriver tests', () => {
|
||||
if (typeof Element == 'undefined' || typeof document == 'undefined' ||
|
||||
typeof(window as any)['AnimationEvent'] == 'undefined')
|
||||
return;
|
||||
if (isNode || typeof(window as any)['AnimationEvent'] == 'undefined') return;
|
||||
|
||||
describe('building keyframes', () => {
|
||||
it('should build CSS keyframe style object containing the keyframe styles', () => {
|
||||
|
|
|
@ -14,7 +14,7 @@ import {assertStyle, createElement} from './shared';
|
|||
const CSS_KEYFRAME_RULE_TYPE = 7;
|
||||
|
||||
describe('DirectStylePlayer tests', () => {
|
||||
if (typeof Element == 'undefined' || typeof document == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
it('should apply the styling to the given element when the animation starts and remove when destroyed',
|
||||
() => {
|
||||
|
|
|
@ -13,9 +13,7 @@ import {assertStyle, createElement, makeAnimationEvent, supportsAnimationEventCr
|
|||
const EMPTY_FN = () => {};
|
||||
{
|
||||
describe('ElementAnimationStyleHandler', () => {
|
||||
if (typeof Element == 'undefined' || typeof document == 'undefined' ||
|
||||
typeof(window as any)['AnimationEvent'] == 'undefined')
|
||||
return;
|
||||
if (isNode || typeof(window as any)['AnimationEvent'] == 'undefined') return;
|
||||
|
||||
it('should add and remove an animation on to an element\'s styling', () => {
|
||||
const element = createElement();
|
||||
|
|
|
@ -21,7 +21,7 @@ import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_a
|
|||
}
|
||||
|
||||
// these tests are only mean't to be run within the DOM
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('TimelineAnimationEngine', () => {
|
||||
let element: any;
|
||||
|
|
|
@ -20,7 +20,7 @@ const DEFAULT_NAMESPACE_ID = 'id';
|
|||
const driver = new MockAnimationDriver();
|
||||
|
||||
// these tests are only mean't to be run within the DOM
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('TransitionAnimationEngine', () => {
|
||||
let element: any;
|
||||
|
|
|
@ -12,7 +12,7 @@ import {WebAnimationsPlayer} from '../../../src/render/web_animations/web_animat
|
|||
|
||||
{
|
||||
describe('WebAnimationsDriver', () => {
|
||||
if (typeof Element == 'undefined' || typeof document == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('when web-animations are not supported natively', () => {
|
||||
it('should return an instance of a CssKeyframePlayer if scrubbing is not requested', () => {
|
||||
|
|
|
@ -20,7 +20,7 @@ const DEFAULT_COMPONENT_ID = '1';
|
|||
|
||||
(function() {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('animation tests', function() {
|
||||
function getLog(): MockAnimationPlayer[] {
|
||||
|
|
|
@ -21,7 +21,7 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async';
|
|||
|
||||
(function() {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('animation query tests', function() {
|
||||
function getLog(): MockAnimationPlayer[] {
|
||||
|
|
|
@ -16,7 +16,7 @@ import {RouterTestingModule} from '@angular/router/testing';
|
|||
|
||||
(function() {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('Animation Router Tests', function() {
|
||||
function getLog(): MockAnimationPlayer[] {
|
||||
|
|
|
@ -17,7 +17,7 @@ import {TestBed} from '../../testing';
|
|||
(function() {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
// Buggy in Chromium 39, see https://github.com/angular/angular/issues/15793
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
describe('animation integration tests using css keyframe animations', function() {
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import {TestBed} from '../../testing';
|
|||
(function() {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
// Buggy in Chromium 39, see https://github.com/angular/angular/issues/15793
|
||||
if (typeof Element == 'undefined' || !ɵsupportsWebAnimations()) return;
|
||||
if (isNode || !ɵsupportsWebAnimations()) return;
|
||||
|
||||
describe('animation integration tests using web animations', function() {
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ import {el} from '../../testing/src/browser_util';
|
|||
|
||||
describe('flushing animations', () => {
|
||||
// these tests are only mean't to be run within the DOM
|
||||
if (typeof Element == 'undefined') return;
|
||||
if (isNode) return;
|
||||
|
||||
it('should flush and fire callbacks when the zone becomes stable', (async) => {
|
||||
@Component({
|
||||
|
|
Loading…
Reference in New Issue