package.esm2022.browser.testing.src.mock_animation_driver.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of animations Show documentation
Show all versions of animations Show documentation
Angular - animations integration with web-animations
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* 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, NoopAnimationPlayer } from '@angular/animations';
import { ɵallowPreviousPlayerStylesMerge as allowPreviousPlayerStylesMerge, ɵcamelCaseToDashCase, ɵcontainsElement as containsElement, ɵgetParentElement as getParentElement, ɵinvokeQuery as invokeQuery, ɵnormalizeKeyframes as normalizeKeyframes, ɵvalidateStyleProperty as validateStyleProperty, ɵvalidateWebAnimatableStyleProperty, } from '@angular/animations/browser';
/**
* @publicApi
*/
export class MockAnimationDriver {
static { this.log = []; }
validateStyleProperty(prop) {
return validateStyleProperty(prop);
}
validateAnimatableStyleProperty(prop) {
const cssProp = ɵcamelCaseToDashCase(prop);
return ɵvalidateWebAnimatableStyleProperty(cssProp);
}
containsElement(elm1, elm2) {
return containsElement(elm1, elm2);
}
getParentElement(element) {
return getParentElement(element);
}
query(element, selector, multi) {
return invokeQuery(element, selector, multi);
}
computeStyle(element, prop, defaultValue) {
return defaultValue || '';
}
animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
const player = new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
MockAnimationDriver.log.push(player);
return player;
}
}
/**
* @publicApi
*/
export class MockAnimationPlayer extends NoopAnimationPlayer {
constructor(element, keyframes, duration, delay, easing, previousPlayers) {
super(duration, delay);
this.element = element;
this.keyframes = keyframes;
this.duration = duration;
this.delay = delay;
this.easing = easing;
this.previousPlayers = previousPlayers;
this.__finished = false;
this.__started = false;
this.previousStyles = new Map();
this._onInitFns = [];
this.currentSnapshot = new Map();
this._keyframes = [];
this._keyframes = normalizeKeyframes(keyframes);
if (allowPreviousPlayerStylesMerge(duration, delay)) {
previousPlayers.forEach((player) => {
if (player instanceof MockAnimationPlayer) {
const styles = player.currentSnapshot;
styles.forEach((val, prop) => this.previousStyles.set(prop, val));
}
});
}
}
/** @internal */
onInit(fn) {
this._onInitFns.push(fn);
}
/** @internal */
init() {
super.init();
this._onInitFns.forEach((fn) => fn());
this._onInitFns = [];
}
reset() {
super.reset();
this.__started = false;
}
finish() {
super.finish();
this.__finished = true;
}
destroy() {
super.destroy();
this.__finished = true;
}
/** @internal */
triggerMicrotask() { }
play() {
super.play();
this.__started = true;
}
hasStarted() {
return this.__started;
}
beforeDestroy() {
const captures = new Map();
this.previousStyles.forEach((val, prop) => captures.set(prop, val));
if (this.hasStarted()) {
// when assembling the captured styles, it's important that
// we build the keyframe styles in the following order:
// {other styles within keyframes, ... previousStyles }
this._keyframes.forEach((kf) => {
for (let [prop, val] of kf) {
if (prop !== 'offset') {
captures.set(prop, this.__finished ? val : AUTO_STYLE);
}
}
});
}
this.currentSnapshot = captures;
}
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19hbmltYXRpb25fZHJpdmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvYW5pbWF0aW9ucy9icm93c2VyL3Rlc3Rpbmcvc3JjL21vY2tfYW5pbWF0aW9uX2RyaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFDSCxPQUFPLEVBQWtCLFVBQVUsRUFBRSxtQkFBbUIsRUFBZ0IsTUFBTSxxQkFBcUIsQ0FBQztBQUNwRyxPQUFPLEVBRUwsK0JBQStCLElBQUksOEJBQThCLEVBQ2pFLG9CQUFvQixFQUNwQixnQkFBZ0IsSUFBSSxlQUFlLEVBQ25DLGlCQUFpQixJQUFJLGdCQUFnQixFQUNyQyxZQUFZLElBQUksV0FBVyxFQUMzQixtQkFBbUIsSUFBSSxrQkFBa0IsR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