Skip to content

Commit

Permalink
refactor(animations): change NoOp -> Noop (angular#14690)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsko authored and IgorMinar committed Feb 24, 2017
1 parent 1f3198c commit 32c2fd5
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion modules/@angular/animations/src/animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -27,7 +27,7 @@ export function instantiateSupportedAnimationDriver() {
if (supportsWebAnimations()) {
return new WebAnimationsDriver();
}
return new NoOpAnimationDriver();
return new NoopAnimationDriver();
}

export function instantiateDefaultStyleNormalizer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
* 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();
}
}

/**
* @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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -406,7 +406,7 @@ function deleteFromArrayMap(map: Map<any, any[]>, 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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} = {};

Expand Down
2 changes: 1 addition & 1 deletion tools/public_api_guard/animations/typings/animations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 32c2fd5

Please sign in to comment.