angular/modules/angular2/src/mock/animation_builder_mock.ts
Alex Eagle 7f6289c1bf fix(typings): two errors not reported by our build:
third_party/javascript/angular2/github/modules/angular2/src/core/platform_bindings.ts:5:14: Exported variable 'EXCEPTION_PROVIDER' has or is using name 'Provider' from external module third_party/javascript/angular2/github/modules/angular2/src/core/di/provider but cannot be named.
third_party/javascript/angular2/github/modules/angular2/src/core/platform_bindings.ts:8:14: Exported variable 'EXCEPTION_BINDING' has or is using name 'Provider' from external module third_party/javascript/angular2/github/modules/angular2/src/core/di/provider but cannot be named.
third_party/javascript/angular2/github/modules/angular2/src/mock/animation_builder_mock.ts:11:10: Return type of public method from exported class has or is using private name 'MockCssAnimationBuilder'.
2015-11-12 18:39:23 -08:00

34 lines
1.2 KiB
TypeScript

import {Injectable} from 'angular2/src/core/di';
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
import {CssAnimationBuilder} from 'angular2/src/animate/css_animation_builder';
import {CssAnimationOptions} from 'angular2/src/animate/css_animation_options';
import {Animation} from 'angular2/src/animate/animation';
import {BrowserDetails} from 'angular2/src/animate/browser_details';
@Injectable()
export class MockAnimationBuilder extends AnimationBuilder {
constructor() { super(null); }
css(): CssAnimationBuilder { return new MockCssAnimationBuilder(); }
}
class MockCssAnimationBuilder extends CssAnimationBuilder {
constructor() { super(null); }
start(element: HTMLElement): Animation { return new MockAnimation(element, this.data); }
}
class MockBrowserAbstraction extends BrowserDetails {
doesElapsedTimeIncludesDelay(): void { this.elapsedTimeIncludesDelay = false; }
}
class MockAnimation extends Animation {
private _callback: Function;
constructor(element: HTMLElement, data: CssAnimationOptions) {
super(element, data, new MockBrowserAbstraction());
}
wait(callback: Function) { this._callback = callback; }
flush() {
this._callback(0);
this._callback = null;
}
}