blob: aab480091455b306e865e3eadee302a5f9d06ba2 [file] [log] [blame]
/**
* @license Angular v11.2.14
* (c) 2010-2021 Google LLC. https://angular.io/
* License: MIT
*/
import { ɵglobal, NgZone, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, NgModule, APP_ID } from '@angular/core';
import { ɵBrowserDomAdapter, BrowserModule, ɵELEMENT_PROBE_PROVIDERS } from '@angular/platform-browser';
import { ɵgetDOM } from '@angular/common';
/**
* @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
*/
class BrowserDetection {
constructor(ua) {
this._overrideUa = ua;
}
get _ua() {
if (typeof this._overrideUa === 'string') {
return this._overrideUa;
}
return ɵgetDOM() ? ɵgetDOM().getUserAgent() : '';
}
static setup() {
return new BrowserDetection(null);
}
get isFirefox() {
return this._ua.indexOf('Firefox') > -1;
}
get isAndroid() {
return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 &&
this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 &&
this._ua.indexOf('IEMobile') == -1;
}
get isEdge() {
return this._ua.indexOf('Edge') > -1;
}
get isIE() {
return this._ua.indexOf('Trident') > -1;
}
get isWebkit() {
return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 &&
this._ua.indexOf('IEMobile') == -1;
}
get isIOS7() {
return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) &&
this._ua.indexOf('IEMobile') == -1;
}
get isSlow() {
return this.isAndroid || this.isIE || this.isIOS7;
}
get isChromeDesktop() {
return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 &&
this._ua.indexOf('Edge') == -1;
}
// "Old Chrome" means Chrome 3X, where there are some discrepancies in the Intl API.
// Android 4.4 and 5.X have such browsers by default (respectively 30 and 39).
get isOldChrome() {
return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Chrome/3') > -1 &&
this._ua.indexOf('Edge') == -1;
}
get supportsCustomElements() {
return (typeof ɵglobal.customElements !== 'undefined');
}
get supportsDeprecatedCustomCustomElementsV0() {
return (typeof document.registerElement !== 'undefined');
}
get supportsRegExUnicodeFlag() {
return RegExp.prototype.hasOwnProperty('unicode');
}
get supportsShadowDom() {
const testEl = document.createElement('div');
return (typeof testEl.attachShadow !== 'undefined');
}
get supportsDeprecatedShadowDomV0() {
const testEl = document.createElement('div');
return (typeof testEl.createShadowRoot !== 'undefined');
}
}
const browserDetection = BrowserDetection.setup();
function dispatchEvent(element, eventType) {
const evt = ɵgetDOM().getDefaultDocument().createEvent('Event');
evt.initEvent(eventType, true, true);
ɵgetDOM().dispatchEvent(element, evt);
}
function createMouseEvent(eventType) {
const evt = ɵgetDOM().getDefaultDocument().createEvent('MouseEvent');
evt.initEvent(eventType, true, true);
return evt;
}
function el(html) {
return getContent(createTemplate(html)).firstChild;
}
function normalizeCSS(css) {
return css.replace(/\s+/g, ' ')
.replace(/:\s/g, ':')
.replace(/'/g, '"')
.replace(/ }/g, '}')
.replace(/url\((\"|\s)(.+)(\"|\s)\)(\s*)/g, (...match) => `url("${match[2]}")`)
.replace(/\[(.+)=([^"\]]+)\]/g, (...match) => `[${match[1]}="${match[2]}"]`);
}
function getAttributeMap(element) {
const res = new Map();
const elAttrs = element.attributes;
for (let i = 0; i < elAttrs.length; i++) {
const attrib = elAttrs.item(i);
res.set(attrib.name, attrib.value);
}
return res;
}
const _selfClosingTags = ['br', 'hr', 'input'];
function stringifyElement(el /** TODO #9100 */) {
let result = '';
if getDOM().isElementNode(el)) {
const tagName = el.tagName.toLowerCase();
// Opening tag
result += `<${tagName}`;
// Attributes in an ordered way
const attributeMap = getAttributeMap(el);
const sortedKeys = Array.from(attributeMap.keys()).sort();
for (const key of sortedKeys) {
const lowerCaseKey = key.toLowerCase();
let attValue = attributeMap.get(key);
if (typeof attValue !== 'string') {
result += ` ${lowerCaseKey}`;
}
else {
// Browsers order style rules differently. Order them alphabetically for consistency.
if (lowerCaseKey === 'style') {
attValue = attValue.split(/; ?/).filter(s => !!s).sort().map(s => `${s};`).join(' ');
}
result += ` ${lowerCaseKey}="${attValue}"`;
}
}
result += '>';
// Children
const childrenRoot = templateAwareRoot(el);
const children = childrenRoot ? childrenRoot.childNodes : [];
for (let j = 0; j < children.length; j++) {
result += stringifyElement(children[j]);
}
// Closing tag
if (_selfClosingTags.indexOf(tagName) == -1) {
result += `</${tagName}>`;
}
}
else if (isCommentNode(el)) {
result += `<!--${el.nodeValue}-->`;
}
else {
result += el.textContent;
}
return result;
}
function createNgZone() {
return new NgZone({ enableLongStackTrace: true, shouldCoalesceEventChangeDetection: false });
}
function isCommentNode(node) {
return node.nodeType === Node.COMMENT_NODE;
}
function isTextNode(node) {
return node.nodeType === Node.TEXT_NODE;
}
function getContent(node) {
if ('content' in node) {
return node.content;
}
else {
return node;
}
}
function templateAwareRoot(el) {
return ɵgetDOM().isElementNode(el) && el.nodeName === 'TEMPLATE' ? getContent(el) : el;
}
function setCookie(name, value) {
// document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
// not clear other cookies.
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
}
function supportsWebAnimation() {
return typeof Element.prototype['animate'] === 'function';
}
function hasStyle(element, styleName, styleValue) {
const value = element.style[styleName] || '';
return styleValue ? value == styleValue : value.length > 0;
}
function hasClass(element, className) {
return element.classList.contains(className);
}
function sortedClassList(element) {
return Array.prototype.slice.call(element.classList, 0).sort();
}
function createTemplate(html) {
const t = ɵgetDOM().getDefaultDocument().createElement('template');
t.innerHTML = html;
return t;
}
function childNodesAsList(el) {
const childNodes = el.childNodes;
const res = [];
for (let i = 0; i < childNodes.length; i++) {
res[i] = childNodes[i];
}
return res;
}
/**
* @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
*/
function initBrowserTests() {
ɵBrowserDomAdapter.makeCurrent();
BrowserDetection.setup();
}
const _TEST_BROWSER_PLATFORM_PROVIDERS = [{ provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true }];
/**
* Platform for testing
*
* @publicApi
*/
const platformBrowserTesting = createPlatformFactory(platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
const ɵ0 = createNgZone;
/**
* NgModule for testing.
*
* @publicApi
*/
class BrowserTestingModule {
}
BrowserTestingModule.decorators = [
{ type: NgModule, args: [{
exports: [BrowserModule],
providers: [
{ provide: APP_ID, useValue: 'a' },
ɵELEMENT_PROBE_PROVIDERS,
{ provide: NgZone, useFactory: ɵ0 },
]
},] }
];
/**
* @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
*/
/**
* @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
*/
/**
* @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
*/
/**
* Generated bundle index. Do not edit.
*/
export { BrowserTestingModule, platformBrowserTesting, ɵ0, createNgZone as ɵangular_packages_platform_browser_testing_testing_a };
//# sourceMappingURL=testing.js.map