@ -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 {AnimationPlayer, AUTO_STYLE, NoopAnimationPlayer, ɵStyleData} from '@angular/animations';
|
||||
import {AnimationDriver, ɵallowPreviousPlayerStylesMerge as allowPreviousPlayerStylesMerge, ɵcontainsElement as containsElement, ɵinvokeQuery as invokeQuery, ɵmatchesElement as matchesElement, ɵvalidateStyleProperty as validateStyleProperty} from '@angular/animations/browser';
|
||||
|
||||
|
||||
@ -15,13 +15,17 @@ import {AnimationDriver, ɵallowPreviousPlayerStylesMerge as allowPreviousPlayer
|
||||
export class MockAnimationDriver implements AnimationDriver {
|
||||
static log: AnimationPlayer[] = [];
|
||||
|
||||
validateStyleProperty(prop: string): boolean { return validateStyleProperty(prop); }
|
||||
validateStyleProperty(prop: string): boolean {
|
||||
return validateStyleProperty(prop);
|
||||
}
|
||||
|
||||
matchesElement(element: any, selector: string): boolean {
|
||||
return matchesElement(element, selector);
|
||||
}
|
||||
|
||||
containsElement(elm1: any, elm2: any): boolean { return containsElement(elm1, elm2); }
|
||||
containsElement(elm1: any, elm2: any): boolean {
|
||||
return containsElement(elm1, elm2);
|
||||
}
|
||||
|
||||
query(element: any, selector: string, multi: boolean): any[] {
|
||||
return invokeQuery(element, selector, multi);
|
||||
@ -32,7 +36,7 @@ export class MockAnimationDriver implements AnimationDriver {
|
||||
}
|
||||
|
||||
animate(
|
||||
element: any, keyframes: {[key: string]: string | number}[], duration: number, delay: number,
|
||||
element: any, keyframes: {[key: string]: string|number}[], duration: number, delay: number,
|
||||
easing: string, previousPlayers: any[] = []): MockAnimationPlayer {
|
||||
const player =
|
||||
new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
|
||||
@ -47,12 +51,12 @@ export class MockAnimationDriver implements AnimationDriver {
|
||||
export class MockAnimationPlayer extends NoopAnimationPlayer {
|
||||
private __finished = false;
|
||||
private __started = false;
|
||||
public previousStyles: {[key: string]: string | number} = {};
|
||||
public previousStyles: {[key: string]: string|number} = {};
|
||||
private _onInitFns: (() => any)[] = [];
|
||||
public currentSnapshot: ɵStyleData = {};
|
||||
|
||||
constructor(
|
||||
public element: any, public keyframes: {[key: string]: string | number}[],
|
||||
public element: any, public keyframes: {[key: string]: string|number}[],
|
||||
public duration: number, public delay: number, public easing: string,
|
||||
public previousPlayers: any[]) {
|
||||
super(duration, delay);
|
||||
@ -68,7 +72,9 @@ export class MockAnimationPlayer extends NoopAnimationPlayer {
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
onInit(fn: () => any) { this._onInitFns.push(fn); }
|
||||
onInit(fn: () => any) {
|
||||
this._onInitFns.push(fn);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
init() {
|
||||
@ -95,7 +101,9 @@ export class MockAnimationPlayer extends NoopAnimationPlayer {
|
||||
this.__started = true;
|
||||
}
|
||||
|
||||
hasStarted() { return this.__started; }
|
||||
hasStarted() {
|
||||
return this.__started;
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
const captures: ɵStyleData = {};
|
||||
|
Reference in New Issue
Block a user