blob: 654d4b027d83f7ce6a2bf7a334967928734ca060 [file] [log] [blame]
{"version":3,"file":"testing.js","sources":["../../../packages/platform-browser/testing/src/browser_util.js","../../../packages/platform-browser/testing/src/browser.js","../../../packages/platform-browser/testing/src/testing.js","../../../packages/platform-browser/testing/public_api.js","../../../packages/platform-browser/testing/testing.js"],"sourcesContent":["/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { NgZone, ɵglobal as global } from '@angular/core';\nimport { ɵgetDOM as getDOM } from '@angular/platform-browser';\nexport let /** @type {?} */ browserDetection;\nexport class BrowserDetection {\n /**\n * @return {?}\n */\n get _ua() {\n if (typeof this._overrideUa === 'string') {\n return this._overrideUa;\n }\n return getDOM() ? getDOM().getUserAgent() : '';\n }\n /**\n * @return {?}\n */\n static setup() { browserDetection = new BrowserDetection(null); }\n /**\n * @param {?} ua\n */\n constructor(ua) { this._overrideUa = ua; }\n /**\n * @return {?}\n */\n get isFirefox() { return this._ua.indexOf('Firefox') > -1; }\n /**\n * @return {?}\n */\n get isAndroid() {\n return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 &&\n this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 &&\n this._ua.indexOf('IEMobile') == -1;\n }\n /**\n * @return {?}\n */\n get isEdge() { return this._ua.indexOf('Edge') > -1; }\n /**\n * @return {?}\n */\n get isIE() { return this._ua.indexOf('Trident') > -1; }\n /**\n * @return {?}\n */\n get isWebkit() {\n return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 &&\n this._ua.indexOf('IEMobile') == -1;\n }\n /**\n * @return {?}\n */\n get isIOS7() {\n return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) &&\n this._ua.indexOf('IEMobile') == -1;\n }\n /**\n * @return {?}\n */\n get isSlow() { return this.isAndroid || this.isIE || this.isIOS7; }\n /**\n * @return {?}\n */\n get supportsNativeIntlApi() {\n return !!(/** @type {?} */ (global)).Intl && (/** @type {?} */ (global)).Intl !== (/** @type {?} */ (global)).IntlPolyfill;\n }\n /**\n * @return {?}\n */\n get isChromeDesktop() {\n return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 &&\n this._ua.indexOf('Edge') == -1;\n }\n /**\n * @return {?}\n */\n get isOldChrome() {\n return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Chrome/3') > -1 &&\n this._ua.indexOf('Edge') == -1;\n }\n}\nfunction BrowserDetection_tsickle_Closure_declarations() {\n /** @type {?} */\n BrowserDetection.prototype._overrideUa;\n}\nBrowserDetection.setup();\n/**\n * @param {?} element\n * @param {?} eventType\n * @return {?}\n */\nexport function dispatchEvent(element, eventType) {\n getDOM().dispatchEvent(element, getDOM().createEvent(eventType));\n}\n/**\n * @param {?} html\n * @return {?}\n */\nexport function el(html) {\n return /** @type {?} */ (getDOM().firstChild(getDOM().content(getDOM().createTemplate(html))));\n}\n/**\n * @param {?} css\n * @return {?}\n */\nexport function normalizeCSS(css) {\n return css.replace(/\\s+/g, ' ')\n .replace(/:\\s/g, ':')\n .replace(/'/g, '\"')\n .replace(/ }/g, '}')\n .replace(/url\\((\\\"|\\s)(.+)(\\\"|\\s)\\)(\\s*)/g, (...match) => `url(\"${match[2]}\")`)\n .replace(/\\[(.+)=([^\"\\]]+)\\]/g, (...match) => `[${match[1]}=\"${match[2]}\"]`);\n}\nconst /** @type {?} */ _singleTagWhitelist = ['br', 'hr', 'input'];\n/**\n * @param {?} el\n * @return {?}\n */\nexport function stringifyElement(el /** TODO #9100 */) {\n let /** @type {?} */ result = '';\n if (getDOM().isElementNode(el)) {\n const /** @type {?} */ tagName = getDOM().tagName(el).toLowerCase();\n // Opening tag\n result += `<${tagName}`;\n // Attributes in an ordered way\n const /** @type {?} */ attributeMap = getDOM().attributeMap(el);\n const /** @type {?} */ keys = Array.from(attributeMap.keys()).sort();\n for (let /** @type {?} */ i = 0; i < keys.length; i++) {\n const /** @type {?} */ key = keys[i];\n const /** @type {?} */ attValue = attributeMap.get(key);\n const /** @type {?} */ lowerCaseKey = key.toLowerCase();\n if (typeof attValue !== 'string') {\n result += ` ${lowerCaseKey}`;\n }\n else {\n result += ` ${lowerCaseKey}=\"${attValue}\"`;\n }\n }\n result += '>';\n // Children\n const /** @type {?} */ childrenRoot = getDOM().templateAwareRoot(el);\n const /** @type {?} */ children = childrenRoot ? getDOM().childNodes(childrenRoot) : [];\n for (let /** @type {?} */ j = 0; j < children.length; j++) {\n result += stringifyElement(children[j]);\n }\n // Closing tag\n if (_singleTagWhitelist.indexOf(tagName) == -1) {\n result += `</${tagName}>`;\n }\n }\n else if (getDOM().isCommentNode(el)) {\n result += `<!--${getDOM().nodeValue(el)}-->`;\n }\n else {\n result += getDOM().getText(el);\n }\n return result;\n}\n/**\n * @return {?}\n */\nexport function createNgZone() {\n return new NgZone({ enableLongStackTrace: true });\n}\n//# sourceMappingURL=browser_util.js.map","/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\nimport { APP_ID, NgModule, NgZone, PLATFORM_INITIALIZER, createPlatformFactory, platformCore } from '@angular/core';\nimport { BrowserModule, ɵBrowserDomAdapter as BrowserDomAdapter, ɵELEMENT_PROBE_PROVIDERS as ELEMENT_PROBE_PROVIDERS } from '@angular/platform-browser';\nimport { BrowserDetection, createNgZone } from './browser_util';\n/**\n * @return {?}\n */\nfunction initBrowserTests() {\n BrowserDomAdapter.makeCurrent();\n BrowserDetection.setup();\n}\nconst /** @type {?} */ _TEST_BROWSER_PLATFORM_PROVIDERS = [{ provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true }];\n/**\n * Platform for testing\n *\n * \\@stable\n */\nexport const /** @type {?} */ platformBrowserTesting = createPlatformFactory(platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);\nconst ɵ0 = createNgZone;\n/**\n * NgModule for testing.\n *\n * \\@stable\n */\nexport class BrowserTestingModule {\n}\nBrowserTestingModule.decorators = [\n { type: NgModule, args: [{\n exports: [BrowserModule],\n providers: [\n { provide: APP_ID, useValue: 'a' },\n ELEMENT_PROBE_PROVIDERS,\n { provide: NgZone, useFactory: ɵ0 },\n ]\n },] },\n];\n/** @nocollapse */\nBrowserTestingModule.ctorParameters = () => [];\nfunction BrowserTestingModule_tsickle_Closure_declarations() {\n /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */\n BrowserTestingModule.decorators;\n /**\n * @nocollapse\n * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}\n */\n BrowserTestingModule.ctorParameters;\n}\nexport { ɵ0 };\n//# sourceMappingURL=browser.js.map","/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @module\n * @description\n * Entry point for all public APIs of the platform-browser/testing package.\n */\nexport { platformBrowserTesting, BrowserTestingModule } from './browser';\n//# sourceMappingURL=testing.js.map","/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport { platformBrowserTesting, BrowserTestingModule } from './src/testing';\n//# sourceMappingURL=public_api.js.map","/**\n * @fileoverview added by tsickle\n * @suppress {checkTypes} checked by tsc\n */\n/**\n * Generated bundle index. Do not edit.\n */\nexport { platformBrowserTesting, BrowserTestingModule } from './public_api';\nexport { createNgZone as ɵa } from './src/browser_util';\n//# sourceMappingURL=testing.js.map"],"names":["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