2016-04-28 20:50:03 -04:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import { Animation } from '../src/animate/animation';
|
|
|
|
import { CssAnimationOptions } from '../src/animate/css_animation_options';
|
|
|
|
import { BrowserDetails } from '../src/animate/browser_details';
|
|
|
|
import { AnimationBuilder } from '../src/animate/animation_builder';
|
|
|
|
import { CssAnimationBuilder } from '../src/animate/css_animation_builder';
|
2015-08-28 17:39:34 -04:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class MockAnimationBuilder extends AnimationBuilder {
|
|
|
|
constructor() { super(null); }
|
2015-11-10 13:59:51 -05:00
|
|
|
css(): CssAnimationBuilder { return new MockCssAnimationBuilder(); }
|
2015-08-28 17:39:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|