angular-cn/modules/@angular/platform-browser/testing/mock_dom_animate_player.ts
Matias Niemelä 4d51158b1a fix(animations): ensure the web-animations driver converts style props to camel-case
The web animations API now requires that all styles are converted to
camel case. Chrome has already made this breaking change and hyphenated
styles are not functional anymore.

Closes #9111
Closes #9112
2016-06-10 22:54:10 -07:00

36 lines
1.0 KiB
TypeScript

import {DomAnimatePlayer} from '../src/dom/dom_animate_player';
import {isPresent} from '../src/facade/lang';
export class MockDomAnimatePlayer implements DomAnimatePlayer {
public captures: {[key: string]: any[]} = {};
private _position: number = 0;
private _onfinish: Function = () => {};
public currentTime: number;
/** @internal */
_capture(method: string, data: any): void {
if (!isPresent(this.captures[method])) {
this.captures[method] = [];
}
this.captures[method].push(data);
}
cancel(): void { this._capture('cancel', null); }
play(): void { this._capture('play', null); }
pause(): void { this._capture('pause', null); }
finish(): void {
this._capture('finish', null);
this._onfinish();
}
set onfinish(fn: Function) {
this._capture('onfinish', fn);
this._onfinish = fn;
}
get onfinish(): Function { return this._onfinish; }
set position(val: number) {
this._capture('position', val);
this._position = val;
}
get position(): number { return this._position; }
}