[6a3a178] | 1 | /**
|
---|
[e29cc2e] | 2 | * @license Angular v12.2.13
|
---|
[6a3a178] | 3 | * (c) 2010-2021 Google LLC. https://angular.io/
|
---|
| 4 | * License: MIT
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | import { ɵglobal, NgZone, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, NgModule, APP_ID } from '@angular/core';
|
---|
| 8 | import { ɵBrowserDomAdapter, BrowserModule, ɵELEMENT_PROBE_PROVIDERS } from '@angular/platform-browser';
|
---|
| 9 | import { ɵgetDOM } from '@angular/common';
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * @license
|
---|
| 13 | * Copyright Google LLC All Rights Reserved.
|
---|
| 14 | *
|
---|
| 15 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 16 | * found in the LICENSE file at https://angular.io/license
|
---|
| 17 | */
|
---|
| 18 | class BrowserDetection {
|
---|
| 19 | constructor(ua) {
|
---|
| 20 | this._overrideUa = ua;
|
---|
| 21 | }
|
---|
| 22 | get _ua() {
|
---|
| 23 | if (typeof this._overrideUa === 'string') {
|
---|
| 24 | return this._overrideUa;
|
---|
| 25 | }
|
---|
| 26 | return ɵgetDOM() ? ɵgetDOM().getUserAgent() : '';
|
---|
| 27 | }
|
---|
| 28 | static setup() {
|
---|
| 29 | return new BrowserDetection(null);
|
---|
| 30 | }
|
---|
| 31 | get isFirefox() {
|
---|
| 32 | return this._ua.indexOf('Firefox') > -1;
|
---|
| 33 | }
|
---|
| 34 | get isAndroid() {
|
---|
| 35 | return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 &&
|
---|
| 36 | this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 &&
|
---|
| 37 | this._ua.indexOf('IEMobile') == -1;
|
---|
| 38 | }
|
---|
| 39 | get isEdge() {
|
---|
| 40 | return this._ua.indexOf('Edge') > -1;
|
---|
| 41 | }
|
---|
| 42 | get isIE() {
|
---|
| 43 | return this._ua.indexOf('Trident') > -1;
|
---|
| 44 | }
|
---|
| 45 | get isWebkit() {
|
---|
| 46 | return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 &&
|
---|
| 47 | this._ua.indexOf('IEMobile') == -1;
|
---|
| 48 | }
|
---|
| 49 | get isIOS7() {
|
---|
| 50 | return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) &&
|
---|
| 51 | this._ua.indexOf('IEMobile') == -1;
|
---|
| 52 | }
|
---|
| 53 | get isSlow() {
|
---|
| 54 | return this.isAndroid || this.isIE || this.isIOS7;
|
---|
| 55 | }
|
---|
| 56 | get isChromeDesktop() {
|
---|
| 57 | return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 &&
|
---|
| 58 | this._ua.indexOf('Edge') == -1;
|
---|
| 59 | }
|
---|
| 60 | // "Old Chrome" means Chrome 3X, where there are some discrepancies in the Intl API.
|
---|
| 61 | // Android 4.4 and 5.X have such browsers by default (respectively 30 and 39).
|
---|
| 62 | get isOldChrome() {
|
---|
| 63 | return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Chrome/3') > -1 &&
|
---|
| 64 | this._ua.indexOf('Edge') == -1;
|
---|
| 65 | }
|
---|
| 66 | get supportsCustomElements() {
|
---|
| 67 | return (typeof ɵglobal.customElements !== 'undefined');
|
---|
| 68 | }
|
---|
| 69 | get supportsDeprecatedCustomCustomElementsV0() {
|
---|
| 70 | return (typeof document.registerElement !== 'undefined');
|
---|
| 71 | }
|
---|
| 72 | get supportsRegExUnicodeFlag() {
|
---|
| 73 | return RegExp.prototype.hasOwnProperty('unicode');
|
---|
| 74 | }
|
---|
| 75 | get supportsShadowDom() {
|
---|
| 76 | const testEl = document.createElement('div');
|
---|
| 77 | return (typeof testEl.attachShadow !== 'undefined');
|
---|
| 78 | }
|
---|
| 79 | get supportsDeprecatedShadowDomV0() {
|
---|
| 80 | const testEl = document.createElement('div');
|
---|
| 81 | return (typeof testEl.createShadowRoot !== 'undefined');
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 | const browserDetection = BrowserDetection.setup();
|
---|
| 85 | function dispatchEvent(element, eventType) {
|
---|
| 86 | const evt = ɵgetDOM().getDefaultDocument().createEvent('Event');
|
---|
| 87 | evt.initEvent(eventType, true, true);
|
---|
| 88 | ɵgetDOM().dispatchEvent(element, evt);
|
---|
| 89 | }
|
---|
| 90 | function createMouseEvent(eventType) {
|
---|
| 91 | const evt = ɵgetDOM().getDefaultDocument().createEvent('MouseEvent');
|
---|
| 92 | evt.initEvent(eventType, true, true);
|
---|
| 93 | return evt;
|
---|
| 94 | }
|
---|
| 95 | function el(html) {
|
---|
| 96 | return getContent(createTemplate(html)).firstChild;
|
---|
| 97 | }
|
---|
| 98 | function normalizeCSS(css) {
|
---|
| 99 | return css.replace(/\s+/g, ' ')
|
---|
| 100 | .replace(/:\s/g, ':')
|
---|
| 101 | .replace(/'/g, '"')
|
---|
| 102 | .replace(/ }/g, '}')
|
---|
| 103 | .replace(/url\((\"|\s)(.+)(\"|\s)\)(\s*)/g, (...match) => `url("${match[2]}")`)
|
---|
| 104 | .replace(/\[(.+)=([^"\]]+)\]/g, (...match) => `[${match[1]}="${match[2]}"]`);
|
---|
| 105 | }
|
---|
| 106 | function getAttributeMap(element) {
|
---|
| 107 | const res = new Map();
|
---|
| 108 | const elAttrs = element.attributes;
|
---|
| 109 | for (let i = 0; i < elAttrs.length; i++) {
|
---|
| 110 | const attrib = elAttrs.item(i);
|
---|
| 111 | res.set(attrib.name, attrib.value);
|
---|
| 112 | }
|
---|
| 113 | return res;
|
---|
| 114 | }
|
---|
| 115 | const _selfClosingTags = ['br', 'hr', 'input'];
|
---|
| 116 | function stringifyElement(el /** TODO #9100 */) {
|
---|
| 117 | let result = '';
|
---|
| 118 | if (ɵgetDOM().isElementNode(el)) {
|
---|
| 119 | const tagName = el.tagName.toLowerCase();
|
---|
| 120 | // Opening tag
|
---|
| 121 | result += `<${tagName}`;
|
---|
| 122 | // Attributes in an ordered way
|
---|
| 123 | const attributeMap = getAttributeMap(el);
|
---|
| 124 | const sortedKeys = Array.from(attributeMap.keys()).sort();
|
---|
| 125 | for (const key of sortedKeys) {
|
---|
| 126 | const lowerCaseKey = key.toLowerCase();
|
---|
| 127 | let attValue = attributeMap.get(key);
|
---|
| 128 | if (typeof attValue !== 'string') {
|
---|
| 129 | result += ` ${lowerCaseKey}`;
|
---|
| 130 | }
|
---|
| 131 | else {
|
---|
| 132 | // Browsers order style rules differently. Order them alphabetically for consistency.
|
---|
| 133 | if (lowerCaseKey === 'style') {
|
---|
| 134 | attValue = attValue.split(/; ?/).filter(s => !!s).sort().map(s => `${s};`).join(' ');
|
---|
| 135 | }
|
---|
| 136 | result += ` ${lowerCaseKey}="${attValue}"`;
|
---|
| 137 | }
|
---|
| 138 | }
|
---|
| 139 | result += '>';
|
---|
| 140 | // Children
|
---|
| 141 | const childrenRoot = templateAwareRoot(el);
|
---|
| 142 | const children = childrenRoot ? childrenRoot.childNodes : [];
|
---|
| 143 | for (let j = 0; j < children.length; j++) {
|
---|
| 144 | result += stringifyElement(children[j]);
|
---|
| 145 | }
|
---|
| 146 | // Closing tag
|
---|
| 147 | if (_selfClosingTags.indexOf(tagName) == -1) {
|
---|
| 148 | result += `</${tagName}>`;
|
---|
| 149 | }
|
---|
| 150 | }
|
---|
| 151 | else if (isCommentNode(el)) {
|
---|
| 152 | result += `<!--${el.nodeValue}-->`;
|
---|
| 153 | }
|
---|
| 154 | else {
|
---|
| 155 | result += el.textContent;
|
---|
| 156 | }
|
---|
| 157 | return result;
|
---|
| 158 | }
|
---|
| 159 | function createNgZone() {
|
---|
| 160 | return new NgZone({ enableLongStackTrace: true, shouldCoalesceEventChangeDetection: false });
|
---|
| 161 | }
|
---|
| 162 | function isCommentNode(node) {
|
---|
| 163 | return node.nodeType === Node.COMMENT_NODE;
|
---|
| 164 | }
|
---|
| 165 | function isTextNode(node) {
|
---|
| 166 | return node.nodeType === Node.TEXT_NODE;
|
---|
| 167 | }
|
---|
| 168 | function getContent(node) {
|
---|
| 169 | if ('content' in node) {
|
---|
| 170 | return node.content;
|
---|
| 171 | }
|
---|
| 172 | else {
|
---|
| 173 | return node;
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 | function templateAwareRoot(el) {
|
---|
| 177 | return ɵgetDOM().isElementNode(el) && el.nodeName === 'TEMPLATE' ? getContent(el) : el;
|
---|
| 178 | }
|
---|
| 179 | function setCookie(name, value) {
|
---|
| 180 | // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
|
---|
| 181 | // not clear other cookies.
|
---|
| 182 | document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
|
---|
| 183 | }
|
---|
| 184 | function supportsWebAnimation() {
|
---|
| 185 | return typeof Element.prototype['animate'] === 'function';
|
---|
| 186 | }
|
---|
| 187 | function hasStyle(element, styleName, styleValue) {
|
---|
| 188 | const value = element.style[styleName] || '';
|
---|
| 189 | return styleValue ? value == styleValue : value.length > 0;
|
---|
| 190 | }
|
---|
| 191 | function hasClass(element, className) {
|
---|
| 192 | return element.classList.contains(className);
|
---|
| 193 | }
|
---|
| 194 | function sortedClassList(element) {
|
---|
| 195 | return Array.prototype.slice.call(element.classList, 0).sort();
|
---|
| 196 | }
|
---|
| 197 | function createTemplate(html) {
|
---|
| 198 | const t = ɵgetDOM().getDefaultDocument().createElement('template');
|
---|
| 199 | t.innerHTML = html;
|
---|
| 200 | return t;
|
---|
| 201 | }
|
---|
| 202 | function childNodesAsList(el) {
|
---|
| 203 | const childNodes = el.childNodes;
|
---|
| 204 | const res = [];
|
---|
| 205 | for (let i = 0; i < childNodes.length; i++) {
|
---|
| 206 | res[i] = childNodes[i];
|
---|
| 207 | }
|
---|
| 208 | return res;
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | /**
|
---|
| 212 | * @license
|
---|
| 213 | * Copyright Google LLC All Rights Reserved.
|
---|
| 214 | *
|
---|
| 215 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 216 | * found in the LICENSE file at https://angular.io/license
|
---|
| 217 | */
|
---|
| 218 | function initBrowserTests() {
|
---|
| 219 | ɵBrowserDomAdapter.makeCurrent();
|
---|
| 220 | BrowserDetection.setup();
|
---|
| 221 | }
|
---|
| 222 | const _TEST_BROWSER_PLATFORM_PROVIDERS = [{ provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true }];
|
---|
| 223 | /**
|
---|
| 224 | * Platform for testing
|
---|
| 225 | *
|
---|
| 226 | * @publicApi
|
---|
| 227 | */
|
---|
| 228 | const platformBrowserTesting = createPlatformFactory(platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
|
---|
| 229 | const ɵ0 = createNgZone;
|
---|
| 230 | /**
|
---|
| 231 | * NgModule for testing.
|
---|
| 232 | *
|
---|
| 233 | * @publicApi
|
---|
| 234 | */
|
---|
| 235 | class BrowserTestingModule {
|
---|
| 236 | }
|
---|
| 237 | BrowserTestingModule.decorators = [
|
---|
| 238 | { type: NgModule, args: [{
|
---|
| 239 | exports: [BrowserModule],
|
---|
| 240 | providers: [
|
---|
| 241 | { provide: APP_ID, useValue: 'a' },
|
---|
| 242 | ɵELEMENT_PROBE_PROVIDERS,
|
---|
| 243 | { provide: NgZone, useFactory: ɵ0 },
|
---|
| 244 | ]
|
---|
| 245 | },] }
|
---|
| 246 | ];
|
---|
| 247 |
|
---|
| 248 | /**
|
---|
| 249 | * @license
|
---|
| 250 | * Copyright Google LLC All Rights Reserved.
|
---|
| 251 | *
|
---|
| 252 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 253 | * found in the LICENSE file at https://angular.io/license
|
---|
| 254 | */
|
---|
| 255 |
|
---|
| 256 | /**
|
---|
| 257 | * @license
|
---|
| 258 | * Copyright Google LLC All Rights Reserved.
|
---|
| 259 | *
|
---|
| 260 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 261 | * found in the LICENSE file at https://angular.io/license
|
---|
| 262 | */
|
---|
| 263 |
|
---|
| 264 | /**
|
---|
| 265 | * @license
|
---|
| 266 | * Copyright Google LLC All Rights Reserved.
|
---|
| 267 | *
|
---|
| 268 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 269 | * found in the LICENSE file at https://angular.io/license
|
---|
| 270 | */
|
---|
| 271 |
|
---|
| 272 | /**
|
---|
| 273 | * Generated bundle index. Do not edit.
|
---|
| 274 | */
|
---|
| 275 |
|
---|
| 276 | export { BrowserTestingModule, platformBrowserTesting, ɵ0, createNgZone as ɵangular_packages_platform_browser_testing_testing_a };
|
---|
| 277 | //# sourceMappingURL=testing.js.map
|
---|