From 32c2fd5c9fec8dc8e6b73ac930a48c2de389ddfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Fri, 24 Feb 2017 00:32:19 -0800 Subject: [PATCH] refactor(animations): change NoOp -> Noop (#14690) --- modules/@angular/animations/src/animations.ts | 2 +- .../animations/src/players/animation_player.ts | 2 +- .../animations/src/browser_animation_module.ts | 4 ++-- .../style_normalization/animation_style_normalizer.ts | 2 +- .../platform-browser/animations/src/private_export.ts | 4 ++-- .../animations/src/render/animation_driver.ts | 8 ++++---- .../animations/src/render/dom_animation_engine.ts | 4 ++-- .../test/engine/dom_animation_engine_spec.ts | 11 +++++------ .../animations/testing/mock_animation_driver.ts | 4 ++-- .../animations/typings/animations.d.ts | 2 +- .../typings/animations/testing/index.d.ts | 2 +- 11 files changed, 22 insertions(+), 23 deletions(-) diff --git a/modules/@angular/animations/src/animations.ts b/modules/@angular/animations/src/animations.ts index 2ff5636d62..9ccc23a5d0 100644 --- a/modules/@angular/animations/src/animations.ts +++ b/modules/@angular/animations/src/animations.ts @@ -13,6 +13,6 @@ */ export {AnimationEvent} from './animation_event'; export {AUTO_STYLE, AnimateTimings, AnimationAnimateMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationMetadataType, AnimationSequenceMetadata, AnimationStateMetadata, AnimationStyleMetadata, AnimationTransitionMetadata, AnimationTriggerMetadata, animate, group, keyframes, sequence, state, style, transition, trigger, ɵStyleData} from './animation_metadata'; -export {AnimationPlayer, NoOpAnimationPlayer} from './players/animation_player'; +export {AnimationPlayer, NoopAnimationPlayer} from './players/animation_player'; export * from './private_export'; diff --git a/modules/@angular/animations/src/players/animation_player.ts b/modules/@angular/animations/src/players/animation_player.ts index c7ae2d0d93..077b389795 100644 --- a/modules/@angular/animations/src/players/animation_player.ts +++ b/modules/@angular/animations/src/players/animation_player.ts @@ -31,7 +31,7 @@ export abstract class AnimationPlayer { /** * @experimental Animation support is experimental. */ -export class NoOpAnimationPlayer implements AnimationPlayer { +export class NoopAnimationPlayer implements AnimationPlayer { private _onDoneFns: Function[] = []; private _onStartFns: Function[] = []; private _onDestroyFns: Function[] = []; diff --git a/modules/@angular/platform-browser/animations/src/browser_animation_module.ts b/modules/@angular/platform-browser/animations/src/browser_animation_module.ts index 4df8be7457..471a0a9b58 100644 --- a/modules/@angular/platform-browser/animations/src/browser_animation_module.ts +++ b/modules/@angular/platform-browser/animations/src/browser_animation_module.ts @@ -11,7 +11,7 @@ import {BrowserModule, ɵDomRendererFactoryV2} from '@angular/platform-browser'; import {AnimationEngine} from './animation_engine'; import {AnimationStyleNormalizer} from './dsl/style_normalization/animation_style_normalizer'; import {WebAnimationsStyleNormalizer} from './dsl/style_normalization/web_animations_style_normalizer'; -import {AnimationDriver, NoOpAnimationDriver} from './render/animation_driver'; +import {AnimationDriver, NoopAnimationDriver} from './render/animation_driver'; import {AnimationRendererFactory} from './render/animation_renderer'; import {DomAnimationEngine} from './render/dom_animation_engine'; import {WebAnimationsDriver, supportsWebAnimations} from './render/web_animations/web_animations_driver'; @@ -27,7 +27,7 @@ export function instantiateSupportedAnimationDriver() { if (supportsWebAnimations()) { return new WebAnimationsDriver(); } - return new NoOpAnimationDriver(); + return new NoopAnimationDriver(); } export function instantiateDefaultStyleNormalizer() { diff --git a/modules/@angular/platform-browser/animations/src/dsl/style_normalization/animation_style_normalizer.ts b/modules/@angular/platform-browser/animations/src/dsl/style_normalization/animation_style_normalizer.ts index 26022b4875..c2a3e0ae34 100644 --- a/modules/@angular/platform-browser/animations/src/dsl/style_normalization/animation_style_normalizer.ts +++ b/modules/@angular/platform-browser/animations/src/dsl/style_normalization/animation_style_normalizer.ts @@ -19,7 +19,7 @@ export abstract class AnimationStyleNormalizer { /** * @experimental Animation support is experimental. */ -export class NoOpAnimationStyleNormalizer { +export class NoopAnimationStyleNormalizer { normalizePropertyName(propertyName: string, errors: string[]): string { return propertyName; } normalizeStyleValue( diff --git a/modules/@angular/platform-browser/animations/src/private_export.ts b/modules/@angular/platform-browser/animations/src/private_export.ts index e26160660e..ce1194ce24 100644 --- a/modules/@angular/platform-browser/animations/src/private_export.ts +++ b/modules/@angular/platform-browser/animations/src/private_export.ts @@ -7,7 +7,7 @@ */ export {AnimationEngine as ɵAnimationEngine} from './animation_engine'; export {Animation as ɵAnimation} from './dsl/animation'; -export {AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoOpAnimationStyleNormalizer as ɵNoOpAnimationStyleNormalizer} from './dsl/style_normalization/animation_style_normalizer'; -export {NoOpAnimationDriver as ɵNoOpAnimationDriver} from './render/animation_driver'; +export {AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer} from './dsl/style_normalization/animation_style_normalizer'; +export {NoopAnimationDriver as ɵNoopAnimationDriver} from './render/animation_driver'; export {AnimationRenderer as ɵAnimationRenderer, AnimationRendererFactory as ɵAnimationRendererFactory} from './render/animation_renderer'; export {DomAnimationEngine as ɵDomAnimationEngine} from './render/dom_animation_engine'; diff --git a/modules/@angular/platform-browser/animations/src/render/animation_driver.ts b/modules/@angular/platform-browser/animations/src/render/animation_driver.ts index cbe6d1aeb3..59b46fddd4 100644 --- a/modules/@angular/platform-browser/animations/src/render/animation_driver.ts +++ b/modules/@angular/platform-browser/animations/src/render/animation_driver.ts @@ -6,18 +6,18 @@ * found in the LICENSE file at https://angular.io/license */ -import {AnimationPlayer, NoOpAnimationPlayer} from '@angular/animations'; +import {AnimationPlayer, NoopAnimationPlayer} from '@angular/animations'; /** * @experimental */ -export class NoOpAnimationDriver implements AnimationDriver { +export class NoopAnimationDriver implements AnimationDriver { animate( element: any, keyframes: {[key: string]: string | number}[], duration: number, delay: number, easing: string, previousPlayers: any[] = []): AnimationPlayer { - return new NoOpAnimationPlayer(); + return new NoopAnimationPlayer(); } } @@ -25,7 +25,7 @@ export class NoOpAnimationDriver implements AnimationDriver { * @experimental */ export abstract class AnimationDriver { - static NOOP: AnimationDriver = new NoOpAnimationDriver(); + static NOOP: AnimationDriver = new NoopAnimationDriver(); abstract animate( element: any, keyframes: {[key: string]: string | number}[], duration: number, delay: number, easing: string, previousPlayers?: any[]): any; diff --git a/modules/@angular/platform-browser/animations/src/render/dom_animation_engine.ts b/modules/@angular/platform-browser/animations/src/render/dom_animation_engine.ts index 9b15ab9aa7..522dd2262a 100644 --- a/modules/@angular/platform-browser/animations/src/render/dom_animation_engine.ts +++ b/modules/@angular/platform-browser/animations/src/render/dom_animation_engine.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {AnimationEvent, AnimationPlayer, AnimationTriggerMetadata, NoOpAnimationPlayer, ɵAnimationGroupPlayer, ɵStyleData} from '@angular/animations'; +import {AnimationEvent, AnimationPlayer, AnimationTriggerMetadata, NoopAnimationPlayer, ɵAnimationGroupPlayer, ɵStyleData} from '@angular/animations'; import {AnimationTimelineInstruction} from '../dsl/animation_timeline_instruction'; import {AnimationTransitionInstruction} from '../dsl/animation_transition_instruction'; @@ -406,7 +406,7 @@ function deleteFromArrayMap(map: Map, key: any, value: any) { function optimizeGroupPlayer(players: AnimationPlayer[]): AnimationPlayer { switch (players.length) { case 0: - return new NoOpAnimationPlayer(); + return new NoopAnimationPlayer(); case 1: return players[0]; default: diff --git a/modules/@angular/platform-browser/animations/test/engine/dom_animation_engine_spec.ts b/modules/@angular/platform-browser/animations/test/engine/dom_animation_engine_spec.ts index 4f3e012c1f..900347484c 100644 --- a/modules/@angular/platform-browser/animations/test/engine/dom_animation_engine_spec.ts +++ b/modules/@angular/platform-browser/animations/test/engine/dom_animation_engine_spec.ts @@ -5,13 +5,12 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {AnimationEvent, NoOpAnimationPlayer, animate, keyframes, state, style, transition, trigger} from '@angular/animations'; -import {fakeAsync, flushMicrotasks} from '@angular/core/testing'; +import {AnimationEvent, NoopAnimationPlayer, animate, keyframes, state, style, transition, trigger} from '@angular/animations'; import {el} from '@angular/platform-browser/testing/browser_util'; import {buildAnimationKeyframes} from '../../src/dsl/animation_timeline_visitor'; import {buildTrigger} from '../../src/dsl/animation_trigger'; -import {AnimationStyleNormalizer, NoOpAnimationStyleNormalizer} from '../../src/dsl/style_normalization/animation_style_normalizer'; +import {AnimationStyleNormalizer, NoopAnimationStyleNormalizer} from '../../src/dsl/style_normalization/animation_style_normalizer'; import {DomAnimationEngine} from '../../src/render/dom_animation_engine'; import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/mock_animation_driver'; @@ -36,7 +35,7 @@ export function main() { }); function makeEngine(normalizer: AnimationStyleNormalizer = null) { - return new DomAnimationEngine(driver, normalizer || new NoOpAnimationStyleNormalizer()); + return new DomAnimationEngine(driver, normalizer || new NoopAnimationStyleNormalizer()); } describe('trigger registration', () => { @@ -82,12 +81,12 @@ export function main() { engine.setProperty(element, 'myTrigger', 'no'); expect(engine.queuedPlayers.length).toEqual(1); - expect(engine.queuedPlayers.pop() instanceof NoOpAnimationPlayer).toBe(true); + expect(engine.queuedPlayers.pop() instanceof NoopAnimationPlayer).toBe(true); engine.flush(); engine.setProperty(element, 'myTrigger', 'yes'); expect(engine.queuedPlayers.length).toEqual(1); - expect(engine.queuedPlayers.pop() instanceof NoOpAnimationPlayer).toBe(true); + expect(engine.queuedPlayers.pop() instanceof NoopAnimationPlayer).toBe(true); }); it('should not queue an animation if the property value has not changed at all', () => { diff --git a/modules/@angular/platform-browser/animations/testing/mock_animation_driver.ts b/modules/@angular/platform-browser/animations/testing/mock_animation_driver.ts index 4b6b792306..cec7c66476 100644 --- a/modules/@angular/platform-browser/animations/testing/mock_animation_driver.ts +++ b/modules/@angular/platform-browser/animations/testing/mock_animation_driver.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {AUTO_STYLE, AnimationPlayer, NoOpAnimationPlayer, ɵStyleData} from '@angular/animations'; +import {AUTO_STYLE, AnimationPlayer, NoopAnimationPlayer, ɵStyleData} from '@angular/animations'; import {AnimationDriver} from '../src/render/animation_driver'; @@ -28,7 +28,7 @@ export class MockAnimationDriver implements AnimationDriver { /** * @experimental Animation support is experimental. */ -export class MockAnimationPlayer extends NoOpAnimationPlayer { +export class MockAnimationPlayer extends NoopAnimationPlayer { private __finished = false; public previousStyles: {[key: string]: string | number} = {}; diff --git a/tools/public_api_guard/animations/typings/animations.d.ts b/tools/public_api_guard/animations/typings/animations.d.ts index 077ff5fb99..16286467c8 100644 --- a/tools/public_api_guard/animations/typings/animations.d.ts +++ b/tools/public_api_guard/animations/typings/animations.d.ts @@ -109,7 +109,7 @@ export declare function group(steps: AnimationMetadata[]): AnimationGroupMetadat export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata; /** @experimental */ -export declare class NoOpAnimationPlayer implements AnimationPlayer { +export declare class NoopAnimationPlayer implements AnimationPlayer { parentPlayer: AnimationPlayer; constructor(); destroy(): void; diff --git a/tools/public_api_guard/platform-browser/typings/animations/testing/index.d.ts b/tools/public_api_guard/platform-browser/typings/animations/testing/index.d.ts index 21d567f2ec..8452f075a0 100644 --- a/tools/public_api_guard/platform-browser/typings/animations/testing/index.d.ts +++ b/tools/public_api_guard/platform-browser/typings/animations/testing/index.d.ts @@ -7,7 +7,7 @@ export declare class MockAnimationDriver implements AnimationDriver { } /** @experimental */ -export declare class MockAnimationPlayer extends NoOpAnimationPlayer { +export declare class MockAnimationPlayer extends NoopAnimationPlayer { delay: number; duration: number; easing: string;