1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { __values, __decorate } from 'tslib';
|
8 | import { ɵglobal, NgZone, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, NgModule, APP_ID } from '@angular/core';
|
9 | import { ɵBrowserDomAdapter, BrowserModule, ɵELEMENT_PROBE_PROVIDERS } from '@angular/platform-browser';
|
10 | import { ɵgetDOM } from '@angular/common';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | var BrowserDetection = (function () {
|
20 | function BrowserDetection(ua) {
|
21 | this._overrideUa = ua;
|
22 | }
|
23 | Object.defineProperty(BrowserDetection.prototype, "_ua", {
|
24 | get: function () {
|
25 | if (typeof this._overrideUa === 'string') {
|
26 | return this._overrideUa;
|
27 | }
|
28 | return ɵgetDOM() ? ɵgetDOM().getUserAgent() : '';
|
29 | },
|
30 | enumerable: true,
|
31 | configurable: true
|
32 | });
|
33 | BrowserDetection.setup = function () {
|
34 | return new BrowserDetection(null);
|
35 | };
|
36 | Object.defineProperty(BrowserDetection.prototype, "isFirefox", {
|
37 | get: function () {
|
38 | return this._ua.indexOf('Firefox') > -1;
|
39 | },
|
40 | enumerable: true,
|
41 | configurable: true
|
42 | });
|
43 | Object.defineProperty(BrowserDetection.prototype, "isAndroid", {
|
44 | get: function () {
|
45 | return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 &&
|
46 | this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 &&
|
47 | this._ua.indexOf('IEMobile') == -1;
|
48 | },
|
49 | enumerable: true,
|
50 | configurable: true
|
51 | });
|
52 | Object.defineProperty(BrowserDetection.prototype, "isEdge", {
|
53 | get: function () {
|
54 | return this._ua.indexOf('Edge') > -1;
|
55 | },
|
56 | enumerable: true,
|
57 | configurable: true
|
58 | });
|
59 | Object.defineProperty(BrowserDetection.prototype, "isIE", {
|
60 | get: function () {
|
61 | return this._ua.indexOf('Trident') > -1;
|
62 | },
|
63 | enumerable: true,
|
64 | configurable: true
|
65 | });
|
66 | Object.defineProperty(BrowserDetection.prototype, "isWebkit", {
|
67 | get: function () {
|
68 | return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 &&
|
69 | this._ua.indexOf('IEMobile') == -1;
|
70 | },
|
71 | enumerable: true,
|
72 | configurable: true
|
73 | });
|
74 | Object.defineProperty(BrowserDetection.prototype, "isIOS7", {
|
75 | get: function () {
|
76 | return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) &&
|
77 | this._ua.indexOf('IEMobile') == -1;
|
78 | },
|
79 | enumerable: true,
|
80 | configurable: true
|
81 | });
|
82 | Object.defineProperty(BrowserDetection.prototype, "isSlow", {
|
83 | get: function () {
|
84 | return this.isAndroid || this.isIE || this.isIOS7;
|
85 | },
|
86 | enumerable: true,
|
87 | configurable: true
|
88 | });
|
89 | Object.defineProperty(BrowserDetection.prototype, "supportsNativeIntlApi", {
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | get: function () {
|
95 | return !!ɵglobal.Intl && ɵglobal.Intl !== ɵglobal.IntlPolyfill;
|
96 | },
|
97 | enumerable: true,
|
98 | configurable: true
|
99 | });
|
100 | Object.defineProperty(BrowserDetection.prototype, "isChromeDesktop", {
|
101 | get: function () {
|
102 | return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 &&
|
103 | this._ua.indexOf('Edge') == -1;
|
104 | },
|
105 | enumerable: true,
|
106 | configurable: true
|
107 | });
|
108 | Object.defineProperty(BrowserDetection.prototype, "isOldChrome", {
|
109 |
|
110 |
|
111 | get: function () {
|
112 | return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Chrome/3') > -1 &&
|
113 | this._ua.indexOf('Edge') == -1;
|
114 | },
|
115 | enumerable: true,
|
116 | configurable: true
|
117 | });
|
118 | Object.defineProperty(BrowserDetection.prototype, "supportsCustomElements", {
|
119 | get: function () {
|
120 | return (typeof ɵglobal.customElements !== 'undefined');
|
121 | },
|
122 | enumerable: true,
|
123 | configurable: true
|
124 | });
|
125 | Object.defineProperty(BrowserDetection.prototype, "supportsDeprecatedCustomCustomElementsV0", {
|
126 | get: function () {
|
127 | return (typeof document.registerElement !== 'undefined');
|
128 | },
|
129 | enumerable: true,
|
130 | configurable: true
|
131 | });
|
132 | Object.defineProperty(BrowserDetection.prototype, "supportsRegExUnicodeFlag", {
|
133 | get: function () {
|
134 | return RegExp.prototype.hasOwnProperty('unicode');
|
135 | },
|
136 | enumerable: true,
|
137 | configurable: true
|
138 | });
|
139 | Object.defineProperty(BrowserDetection.prototype, "supportsShadowDom", {
|
140 | get: function () {
|
141 | var testEl = document.createElement('div');
|
142 | return (typeof testEl.attachShadow !== 'undefined');
|
143 | },
|
144 | enumerable: true,
|
145 | configurable: true
|
146 | });
|
147 | Object.defineProperty(BrowserDetection.prototype, "supportsDeprecatedShadowDomV0", {
|
148 | get: function () {
|
149 | var testEl = document.createElement('div');
|
150 | return (typeof testEl.createShadowRoot !== 'undefined');
|
151 | },
|
152 | enumerable: true,
|
153 | configurable: true
|
154 | });
|
155 | return BrowserDetection;
|
156 | }());
|
157 | var browserDetection = BrowserDetection.setup();
|
158 | function dispatchEvent(element, eventType) {
|
159 | var evt = ɵgetDOM().getDefaultDocument().createEvent('Event');
|
160 | evt.initEvent(eventType, true, true);
|
161 | ɵgetDOM().dispatchEvent(element, evt);
|
162 | }
|
163 | function createMouseEvent(eventType) {
|
164 | var evt = ɵgetDOM().getDefaultDocument().createEvent('MouseEvent');
|
165 | evt.initEvent(eventType, true, true);
|
166 | return evt;
|
167 | }
|
168 | function el(html) {
|
169 | return getContent(createTemplate(html)).firstChild;
|
170 | }
|
171 | function normalizeCSS(css) {
|
172 | return css.replace(/\s+/g, ' ')
|
173 | .replace(/:\s/g, ':')
|
174 | .replace(/'/g, '"')
|
175 | .replace(/ }/g, '}')
|
176 | .replace(/url\((\"|\s)(.+)(\"|\s)\)(\s*)/g, function () {
|
177 | var match = [];
|
178 | for (var _i = 0; _i < arguments.length; _i++) {
|
179 | match[_i] = arguments[_i];
|
180 | }
|
181 | return "url(\"" + match[2] + "\")";
|
182 | })
|
183 | .replace(/\[(.+)=([^"\]]+)\]/g, function () {
|
184 | var match = [];
|
185 | for (var _i = 0; _i < arguments.length; _i++) {
|
186 | match[_i] = arguments[_i];
|
187 | }
|
188 | return "[" + match[1] + "=\"" + match[2] + "\"]";
|
189 | });
|
190 | }
|
191 | function getAttributeMap(element) {
|
192 | var res = new Map();
|
193 | var elAttrs = element.attributes;
|
194 | for (var i = 0; i < elAttrs.length; i++) {
|
195 | var attrib = elAttrs.item(i);
|
196 | res.set(attrib.name, attrib.value);
|
197 | }
|
198 | return res;
|
199 | }
|
200 | var _selfClosingTags = ['br', 'hr', 'input'];
|
201 | function stringifyElement(el /** TODO #9100 */) {
|
202 | var e_1, _a;
|
203 | var result = '';
|
204 | if (ɵgetDOM().isElementNode(el)) {
|
205 | var tagName = el.tagName.toLowerCase();
|
206 |
|
207 | result += "<" + tagName;
|
208 |
|
209 | var attributeMap = getAttributeMap(el);
|
210 | var sortedKeys = Array.from(attributeMap.keys()).sort();
|
211 | try {
|
212 | for (var sortedKeys_1 = __values(sortedKeys), sortedKeys_1_1 = sortedKeys_1.next(); !sortedKeys_1_1.done; sortedKeys_1_1 = sortedKeys_1.next()) {
|
213 | var key = sortedKeys_1_1.value;
|
214 | var lowerCaseKey = key.toLowerCase();
|
215 | var attValue = attributeMap.get(key);
|
216 | if (typeof attValue !== 'string') {
|
217 | result += " " + lowerCaseKey;
|
218 | }
|
219 | else {
|
220 |
|
221 | if (lowerCaseKey === 'style') {
|
222 | attValue = attValue.split(/; ?/).filter(function (s) { return !!s; }).sort().map(function (s) { return s + ";"; }).join(' ');
|
223 | }
|
224 | result += " " + lowerCaseKey + "=\"" + attValue + "\"";
|
225 | }
|
226 | }
|
227 | }
|
228 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
229 | finally {
|
230 | try {
|
231 | if (sortedKeys_1_1 && !sortedKeys_1_1.done && (_a = sortedKeys_1.return)) _a.call(sortedKeys_1);
|
232 | }
|
233 | finally { if (e_1) throw e_1.error; }
|
234 | }
|
235 | result += '>';
|
236 |
|
237 | var childrenRoot = templateAwareRoot(el);
|
238 | var children = childrenRoot ? childrenRoot.childNodes : [];
|
239 | for (var j = 0; j < children.length; j++) {
|
240 | result += stringifyElement(children[j]);
|
241 | }
|
242 |
|
243 | if (_selfClosingTags.indexOf(tagName) == -1) {
|
244 | result += "</" + tagName + ">";
|
245 | }
|
246 | }
|
247 | else if (isCommentNode(el)) {
|
248 | result += "<!--" + el.nodeValue + "-->";
|
249 | }
|
250 | else {
|
251 | result += el.textContent;
|
252 | }
|
253 | return result;
|
254 | }
|
255 | function createNgZone() {
|
256 | return new NgZone({ enableLongStackTrace: true, shouldCoalesceEventChangeDetection: false });
|
257 | }
|
258 | function isCommentNode(node) {
|
259 | return node.nodeType === Node.COMMENT_NODE;
|
260 | }
|
261 | function isTextNode(node) {
|
262 | return node.nodeType === Node.TEXT_NODE;
|
263 | }
|
264 | function getContent(node) {
|
265 | if ('content' in node) {
|
266 | return node.content;
|
267 | }
|
268 | else {
|
269 | return node;
|
270 | }
|
271 | }
|
272 | function templateAwareRoot(el) {
|
273 | return ɵgetDOM().isElementNode(el) && el.nodeName === 'TEMPLATE' ? getContent(el) : el;
|
274 | }
|
275 | function setCookie(name, value) {
|
276 |
|
277 |
|
278 | document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
|
279 | }
|
280 | function supportsWebAnimation() {
|
281 | return typeof Element.prototype['animate'] === 'function';
|
282 | }
|
283 | function hasStyle(element, styleName, styleValue) {
|
284 | var value = element.style[styleName] || '';
|
285 | return styleValue ? value == styleValue : value.length > 0;
|
286 | }
|
287 | function hasClass(element, className) {
|
288 | return element.classList.contains(className);
|
289 | }
|
290 | function sortedClassList(element) {
|
291 | return Array.prototype.slice.call(element.classList, 0).sort();
|
292 | }
|
293 | function createTemplate(html) {
|
294 | var t = ɵgetDOM().getDefaultDocument().createElement('template');
|
295 | t.innerHTML = html;
|
296 | return t;
|
297 | }
|
298 | function childNodesAsList(el) {
|
299 | var childNodes = el.childNodes;
|
300 | var res = [];
|
301 | for (var i = 0; i < childNodes.length; i++) {
|
302 | res[i] = childNodes[i];
|
303 | }
|
304 | return res;
|
305 | }
|
306 |
|
307 | function initBrowserTests() {
|
308 | ɵBrowserDomAdapter.makeCurrent();
|
309 | BrowserDetection.setup();
|
310 | }
|
311 | var _TEST_BROWSER_PLATFORM_PROVIDERS = [{ provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true }];
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 | var platformBrowserTesting = createPlatformFactory(platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
|
318 | var ɵ0 = createNgZone;
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | var BrowserTestingModule = (function () {
|
325 | function BrowserTestingModule() {
|
326 | }
|
327 | BrowserTestingModule = __decorate([
|
328 | NgModule({
|
329 | exports: [BrowserModule],
|
330 | providers: [
|
331 | { provide: APP_ID, useValue: 'a' },
|
332 | ɵELEMENT_PROBE_PROVIDERS,
|
333 | { provide: NgZone, useFactory: ɵ0 },
|
334 | ]
|
335 | })
|
336 | ], BrowserTestingModule);
|
337 | return BrowserTestingModule;
|
338 | }());
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 | export { BrowserTestingModule, platformBrowserTesting, ɵ0, createNgZone as ɵangular_packages_platform_browser_testing_testing_a };
|
369 |
|