| /** |
| * @license Angular v5.2.0 |
| * (c) 2010-2018 Google, Inc. https://angular.io/ |
| * License: MIT |
| */ |
| import { AUTO_STYLE, NoopAnimationPlayer } from '@angular/animations'; |
| |
| /** |
| * @fileoverview added by tsickle |
| * @suppress {checkTypes} checked by tsc |
| */ |
| /** |
| * @param {?} players |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} driver |
| * @param {?} normalizer |
| * @param {?} element |
| * @param {?} keyframes |
| * @param {?=} preStyles |
| * @param {?=} postStyles |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} player |
| * @param {?} eventName |
| * @param {?} event |
| * @param {?} callback |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} e |
| * @param {?=} phaseName |
| * @param {?=} totalTime |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} element |
| * @param {?} triggerName |
| * @param {?} fromState |
| * @param {?} toState |
| * @param {?=} phaseName |
| * @param {?=} totalTime |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} map |
| * @param {?} key |
| * @param {?} defaultValue |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} command |
| * @return {?} |
| */ |
| |
| let _contains = (elm1, elm2) => false; |
| let _matches = (element, selector) => false; |
| let _query = (element, selector, multi) => { |
| return []; |
| }; |
| if (typeof Element != 'undefined') { |
| // this is well supported in all browsers |
| _contains = (elm1, elm2) => { return /** @type {?} */ (elm1.contains(elm2)); }; |
| if (Element.prototype.matches) { |
| _matches = (element, selector) => element.matches(selector); |
| } |
| else { |
| const /** @type {?} */ proto = /** @type {?} */ (Element.prototype); |
| const /** @type {?} */ fn = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || |
| proto.oMatchesSelector || proto.webkitMatchesSelector; |
| if (fn) { |
| _matches = (element, selector) => fn.apply(element, [selector]); |
| } |
| } |
| _query = (element, selector, multi) => { |
| let /** @type {?} */ results = []; |
| if (multi) { |
| results.push(...element.querySelectorAll(selector)); |
| } |
| else { |
| const /** @type {?} */ elm = element.querySelector(selector); |
| if (elm) { |
| results.push(elm); |
| } |
| } |
| return results; |
| }; |
| } |
| /** |
| * @param {?} prop |
| * @return {?} |
| */ |
| function containsVendorPrefix(prop) { |
| // Webkit is the only real popular vendor prefix nowadays |
| // cc: http://shouldiprefix.com/ |
| return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit |
| } |
| let _CACHED_BODY = null; |
| let _IS_WEBKIT = false; |
| /** |
| * @param {?} prop |
| * @return {?} |
| */ |
| function validateStyleProperty(prop) { |
| if (!_CACHED_BODY) { |
| _CACHED_BODY = getBodyNode() || {}; |
| _IS_WEBKIT = /** @type {?} */ ((_CACHED_BODY)).style ? ('WebkitAppearance' in /** @type {?} */ ((_CACHED_BODY)).style) : false; |
| } |
| let /** @type {?} */ result = true; |
| if (/** @type {?} */ ((_CACHED_BODY)).style && !containsVendorPrefix(prop)) { |
| result = prop in /** @type {?} */ ((_CACHED_BODY)).style; |
| if (!result && _IS_WEBKIT) { |
| const /** @type {?} */ camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1); |
| result = camelProp in /** @type {?} */ ((_CACHED_BODY)).style; |
| } |
| } |
| return result; |
| } |
| /** |
| * @return {?} |
| */ |
| function getBodyNode() { |
| if (typeof document != 'undefined') { |
| return document.body; |
| } |
| return null; |
| } |
| const matchesElement = _matches; |
| const containsElement = _contains; |
| const invokeQuery = _query; |
| |
| /** |
| * @fileoverview added by tsickle |
| * @suppress {checkTypes} checked by tsc |
| */ |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| /** |
| * @param {?} value |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} timings |
| * @param {?} errors |
| * @param {?=} allowNegativeValues |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} obj |
| * @param {?=} destination |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} styles |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} styles |
| * @param {?} readPrototype |
| * @param {?=} destination |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} element |
| * @param {?} styles |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} element |
| * @param {?} styles |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} steps |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} value |
| * @param {?} options |
| * @param {?} errors |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} value |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} value |
| * @param {?} params |
| * @param {?} errors |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} iterator |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} source |
| * @param {?} destination |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} input |
| * @return {?} |
| */ |
| |
| /** |
| * @param {?} duration |
| * @param {?} delay |
| * @return {?} |
| */ |
| function allowPreviousPlayerStylesMerge(duration, delay) { |
| return duration === 0 || delay === 0; |
| } |
| /** |
| * @param {?} visitor |
| * @param {?} node |
| * @param {?} context |
| * @return {?} |
| */ |
| |
| /** |
| * @fileoverview added by tsickle |
| * @suppress {checkTypes} checked by tsc |
| */ |
| /** |
| * \@experimental Animation support is experimental. |
| */ |
| 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 = []) { |
| const /** @type {?} */ player = new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers); |
| MockAnimationDriver.log.push(/** @type {?} */ (player)); |
| return player; |
| } |
| } |
| MockAnimationDriver.log = []; |
| /** |
| * \@experimental Animation support is experimental. |
| */ |
| class MockAnimationPlayer extends NoopAnimationPlayer { |
| /** |
| * @param {?} element |
| * @param {?} keyframes |
| * @param {?} duration |
| * @param {?} delay |
| * @param {?} easing |
| * @param {?} previousPlayers |
| */ |
| constructor(element, keyframes, duration, delay, easing, previousPlayers) { |
| super(); |
| 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(player => { |
| if (player instanceof MockAnimationPlayer) { |
| const /** @type {?} */ styles = player.currentSnapshot; |
| Object.keys(styles).forEach(prop => this.previousStyles[prop] = styles[prop]); |
| } |
| }); |
| } |
| this.totalTime = delay + duration; |
| } |
| /** |
| * @param {?} fn |
| * @return {?} |
| */ |
| onInit(fn) { this._onInitFns.push(fn); } |
| /** |
| * @return {?} |
| */ |
| init() { |
| super.init(); |
| this._onInitFns.forEach(fn => fn()); |
| this._onInitFns = []; |
| } |
| /** |
| * @return {?} |
| */ |
| finish() { |
| super.finish(); |
| this.__finished = true; |
| } |
| /** |
| * @return {?} |
| */ |
| destroy() { |
| super.destroy(); |
| this.__finished = true; |
| } |
| /** |
| * @return {?} |
| */ |
| triggerMicrotask() { } |
| /** |
| * @return {?} |
| */ |
| play() { |
| super.play(); |
| this.__started = true; |
| } |
| /** |
| * @return {?} |
| */ |
| hasStarted() { return this.__started; } |
| /** |
| * @return {?} |
| */ |
| beforeDestroy() { |
| const /** @type {?} */ captures = {}; |
| Object.keys(this.previousStyles).forEach(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(kf => { |
| Object.keys(kf).forEach(prop => { |
| if (prop != 'offset') { |
| captures[prop] = this.__finished ? kf[prop] : AUTO_STYLE; |
| } |
| }); |
| }); |
| } |
| this.currentSnapshot = captures; |
| } |
| } |
| |
| /** |
| * @fileoverview added by tsickle |
| * @suppress {checkTypes} checked by tsc |
| */ |
| |
| /** |
| * @fileoverview added by tsickle |
| * @suppress {checkTypes} checked by tsc |
| */ |
| /** |
| * @license |
| * Copyright Google Inc. 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 |
| */ |
| /** |
| * @module |
| * @description |
| * Entry point for all public APIs of this package. |
| */ |
| |
| /** |
| * @fileoverview added by tsickle |
| * @suppress {checkTypes} checked by tsc |
| */ |
| /** |
| * Generated bundle index. Do not edit. |
| */ |
| |
| export { MockAnimationDriver, MockAnimationPlayer }; |
| //# sourceMappingURL=testing.js.map |