test(animations): fix Node.js detection in animation tests (#24139)

PR Close #24139
This commit is contained in:
Vikram Subramanian
2018-05-25 13:52:58 -07:00
committed by Victor Berchet
parent f04aef48f2
commit 9d28a27215
14 changed files with 14 additions and 18 deletions

View File

@ -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;

View File

@ -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(() => {

View File

@ -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', () => {

View File

@ -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',
() => {

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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', () => {