refactor(animations): change NoOp -> Noop (#14690)

This commit is contained in:
Matias Niemelä 2017-02-24 00:32:19 -08:00 committed by Igor Minar
parent 1f3198cb50
commit 32c2fd5c9f
11 changed files with 22 additions and 23 deletions

View File

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

View File

@ -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[] = [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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