/** * @license Angular v17.1.3 * (c) 2010-2022 Google LLC. https://angular.io/ * License: MIT */ import { NoopAnimationPlayer, AUTO_STYLE } from '@angular/animations'; import { ɵvalidateStyleProperty, ɵcamelCaseToDashCase, ɵvalidateWebAnimatableStyleProperty, ɵcontainsElement, ɵgetParentElement, ɵinvokeQuery, ɵnormalizeKeyframes, ɵallowPreviousPlayerStylesMerge } from '@angular/animations/browser'; /** * @publicApi */ class MockAnimationDriver { static { this.log = []; } validateStyleProperty(prop) { return ɵvalidateStyleProperty(prop); } validateAnimatableStyleProperty(prop) { const cssProp = ɵcamelCaseToDashCase(prop); return ɵvalidateWebAnimatableStyleProperty(cssProp); } matchesElement(_element, _selector) { return false; } 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 */ 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; } } /** * @module * @description * Entry point for all public APIs of this package. */ // This file is not used to build this module. It is only used during editing /** * Generated bundle index. Do not edit. */ export { MockAnimationDriver, MockAnimationPlayer }; //# sourceMappingURL=testing.mjs.map