| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- /**
- * @license Angular v8.1.0
- * (c) 2010-2019 Google LLC. https://angular.io/
- * License: MIT
- */
- import { NoopAnimationPlayer, AUTO_STYLE } from '@angular/animations';
- import { ɵvalidateStyleProperty, ɵmatchesElement, ɵcontainsElement, ɵinvokeQuery, ɵallowPreviousPlayerStylesMerge } from '@angular/animations/browser';
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * \@publicApi
- */
- class MockAnimationDriver {
- /**
- * @param {?} prop
- * @return {?}
- */
- validateStyleProperty(prop) { return ɵvalidateStyleProperty(prop); }
- /**
- * @param {?} element
- * @param {?} selector
- * @return {?}
- */
- matchesElement(element, selector) {
- return ɵmatchesElement(element, selector);
- }
- /**
- * @param {?} elm1
- * @param {?} elm2
- * @return {?}
- */
- containsElement(elm1, elm2) { return ɵcontainsElement(elm1, elm2); }
- /**
- * @param {?} element
- * @param {?} selector
- * @param {?} multi
- * @return {?}
- */
- query(element, selector, multi) {
- return ɵinvokeQuery(element, selector, multi);
- }
- /**
- * @param {?} element
- * @param {?} prop
- * @param {?=} defaultValue
- * @return {?}
- */
- computeStyle(element, prop, defaultValue) {
- return defaultValue || '';
- }
- /**
- * @param {?} element
- * @param {?} keyframes
- * @param {?} duration
- * @param {?} delay
- * @param {?} easing
- * @param {?=} previousPlayers
- * @return {?}
- */
- animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
- /** @type {?} */
- const player = new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
- MockAnimationDriver.log.push((/** @type {?} */ (player)));
- return player;
- }
- }
- MockAnimationDriver.log = [];
- /**
- * \@publicApi
- */
- class MockAnimationPlayer extends NoopAnimationPlayer {
- /**
- * @param {?} element
- * @param {?} keyframes
- * @param {?} duration
- * @param {?} delay
- * @param {?} easing
- * @param {?} previousPlayers
- */
- 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 = {};
- this._onInitFns = [];
- this.currentSnapshot = {};
- if (ɵallowPreviousPlayerStylesMerge(duration, delay)) {
- previousPlayers.forEach((/**
- * @param {?} player
- * @return {?}
- */
- player => {
- if (player instanceof MockAnimationPlayer) {
- /** @type {?} */
- const styles = player.currentSnapshot;
- Object.keys(styles).forEach((/**
- * @param {?} prop
- * @return {?}
- */
- prop => this.previousStyles[prop] = styles[prop]));
- }
- }));
- }
- }
- /* @internal */
- /**
- * @param {?} fn
- * @return {?}
- */
- onInit(fn) { this._onInitFns.push(fn); }
- /* @internal */
- /**
- * @return {?}
- */
- init() {
- super.init();
- this._onInitFns.forEach((/**
- * @param {?} fn
- * @return {?}
- */
- fn => fn()));
- this._onInitFns = [];
- }
- /**
- * @return {?}
- */
- finish() {
- super.finish();
- this.__finished = true;
- }
- /**
- * @return {?}
- */
- destroy() {
- super.destroy();
- this.__finished = true;
- }
- /* @internal */
- /**
- * @return {?}
- */
- triggerMicrotask() { }
- /**
- * @return {?}
- */
- play() {
- super.play();
- this.__started = true;
- }
- /**
- * @return {?}
- */
- hasStarted() { return this.__started; }
- /**
- * @return {?}
- */
- beforeDestroy() {
- /** @type {?} */
- const captures = {};
- Object.keys(this.previousStyles).forEach((/**
- * @param {?} prop
- * @return {?}
- */
- prop => {
- captures[prop] = this.previousStyles[prop];
- }));
- 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((/**
- * @param {?} kf
- * @return {?}
- */
- kf => {
- Object.keys(kf).forEach((/**
- * @param {?} prop
- * @return {?}
- */
- prop => {
- if (prop != 'offset') {
- captures[prop] = this.__finished ? kf[prop] : AUTO_STYLE;
- }
- }));
- }));
- }
- this.currentSnapshot = captures;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * Generated bundle index. Do not edit.
- */
- export { MockAnimationDriver, MockAnimationPlayer };
- //# sourceMappingURL=testing.js.map
|