platform-browser-testing.umd.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /**
  2. * @license Angular v8.1.3
  3. * (c) 2010-2019 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser')) :
  8. typeof define === 'function' && define.amd ? define('@angular/platform-browser/testing', ['exports', '@angular/core', '@angular/platform-browser'], factory) :
  9. (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.testing = {}), global.ng.core, global.ng.platformBrowser));
  10. }(this, function (exports, core, platformBrowser) { 'use strict';
  11. /*! *****************************************************************************
  12. Copyright (c) Microsoft Corporation. All rights reserved.
  13. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  14. this file except in compliance with the License. You may obtain a copy of the
  15. License at http://www.apache.org/licenses/LICENSE-2.0
  16. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  18. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  19. MERCHANTABLITY OR NON-INFRINGEMENT.
  20. See the Apache Version 2.0 License for specific language governing permissions
  21. and limitations under the License.
  22. ***************************************************************************** */
  23. function __decorate(decorators, target, key, desc) {
  24. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  25. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  26. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  27. return c > 3 && r && Object.defineProperty(target, key, r), r;
  28. }
  29. /**
  30. * @license
  31. * Copyright Google Inc. All Rights Reserved.
  32. *
  33. * Use of this source code is governed by an MIT-style license that can be
  34. * found in the LICENSE file at https://angular.io/license
  35. */
  36. var BrowserDetection = /** @class */ (function () {
  37. function BrowserDetection(ua) {
  38. this._overrideUa = ua;
  39. }
  40. Object.defineProperty(BrowserDetection.prototype, "_ua", {
  41. get: function () {
  42. if (typeof this._overrideUa === 'string') {
  43. return this._overrideUa;
  44. }
  45. return platformBrowser.ɵgetDOM() ? platformBrowser.ɵgetDOM().getUserAgent() : '';
  46. },
  47. enumerable: true,
  48. configurable: true
  49. });
  50. BrowserDetection.setup = function () { };
  51. Object.defineProperty(BrowserDetection.prototype, "isFirefox", {
  52. get: function () { return this._ua.indexOf('Firefox') > -1; },
  53. enumerable: true,
  54. configurable: true
  55. });
  56. Object.defineProperty(BrowserDetection.prototype, "isAndroid", {
  57. get: function () {
  58. return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 &&
  59. this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 &&
  60. this._ua.indexOf('IEMobile') == -1;
  61. },
  62. enumerable: true,
  63. configurable: true
  64. });
  65. Object.defineProperty(BrowserDetection.prototype, "isEdge", {
  66. get: function () { return this._ua.indexOf('Edge') > -1; },
  67. enumerable: true,
  68. configurable: true
  69. });
  70. Object.defineProperty(BrowserDetection.prototype, "isIE", {
  71. get: function () { return this._ua.indexOf('Trident') > -1; },
  72. enumerable: true,
  73. configurable: true
  74. });
  75. Object.defineProperty(BrowserDetection.prototype, "isWebkit", {
  76. get: function () {
  77. return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 &&
  78. this._ua.indexOf('IEMobile') == -1;
  79. },
  80. enumerable: true,
  81. configurable: true
  82. });
  83. Object.defineProperty(BrowserDetection.prototype, "isIOS7", {
  84. get: function () {
  85. return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) &&
  86. this._ua.indexOf('IEMobile') == -1;
  87. },
  88. enumerable: true,
  89. configurable: true
  90. });
  91. Object.defineProperty(BrowserDetection.prototype, "isSlow", {
  92. get: function () { return this.isAndroid || this.isIE || this.isIOS7; },
  93. enumerable: true,
  94. configurable: true
  95. });
  96. Object.defineProperty(BrowserDetection.prototype, "supportsNativeIntlApi", {
  97. // The Intl API is only natively supported in Chrome, Firefox, IE11 and Edge.
  98. // This detector is needed in tests to make the difference between:
  99. // 1) IE11/Edge: they have a native Intl API, but with some discrepancies
  100. // 2) IE9/IE10: they use the polyfill, and so no discrepancies
  101. get: function () {
  102. return !!core.ɵglobal.Intl && core.ɵglobal.Intl !== core.ɵglobal.IntlPolyfill;
  103. },
  104. enumerable: true,
  105. configurable: true
  106. });
  107. Object.defineProperty(BrowserDetection.prototype, "isChromeDesktop", {
  108. get: function () {
  109. return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Mobile Safari') == -1 &&
  110. this._ua.indexOf('Edge') == -1;
  111. },
  112. enumerable: true,
  113. configurable: true
  114. });
  115. Object.defineProperty(BrowserDetection.prototype, "isOldChrome", {
  116. // "Old Chrome" means Chrome 3X, where there are some discrepancies in the Intl API.
  117. // Android 4.4 and 5.X have such browsers by default (respectively 30 and 39).
  118. get: function () {
  119. return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Chrome/3') > -1 &&
  120. this._ua.indexOf('Edge') == -1;
  121. },
  122. enumerable: true,
  123. configurable: true
  124. });
  125. Object.defineProperty(BrowserDetection.prototype, "supportsCustomElements", {
  126. get: function () { return (typeof core.ɵglobal.customElements !== 'undefined'); },
  127. enumerable: true,
  128. configurable: true
  129. });
  130. Object.defineProperty(BrowserDetection.prototype, "supportsDeprecatedCustomCustomElementsV0", {
  131. get: function () {
  132. return (typeof document.registerElement !== 'undefined');
  133. },
  134. enumerable: true,
  135. configurable: true
  136. });
  137. Object.defineProperty(BrowserDetection.prototype, "supportsRegExUnicodeFlag", {
  138. get: function () { return RegExp.prototype.hasOwnProperty('unicode'); },
  139. enumerable: true,
  140. configurable: true
  141. });
  142. Object.defineProperty(BrowserDetection.prototype, "supportsShadowDom", {
  143. get: function () {
  144. var testEl = document.createElement('div');
  145. return (typeof testEl.attachShadow !== 'undefined');
  146. },
  147. enumerable: true,
  148. configurable: true
  149. });
  150. Object.defineProperty(BrowserDetection.prototype, "supportsDeprecatedShadowDomV0", {
  151. get: function () {
  152. var testEl = document.createElement('div');
  153. return (typeof testEl.createShadowRoot !== 'undefined');
  154. },
  155. enumerable: true,
  156. configurable: true
  157. });
  158. return BrowserDetection;
  159. }());
  160. BrowserDetection.setup();
  161. function createNgZone() {
  162. return new core.NgZone({ enableLongStackTrace: true });
  163. }
  164. function initBrowserTests() {
  165. platformBrowser.ɵBrowserDomAdapter.makeCurrent();
  166. BrowserDetection.setup();
  167. }
  168. var _TEST_BROWSER_PLATFORM_PROVIDERS = [{ provide: core.PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true }];
  169. /**
  170. * Platform for testing
  171. *
  172. * @publicApi
  173. */
  174. var platformBrowserTesting = core.createPlatformFactory(core.platformCore, 'browserTesting', _TEST_BROWSER_PLATFORM_PROVIDERS);
  175. var ɵ0 = createNgZone;
  176. /**
  177. * NgModule for testing.
  178. *
  179. * @publicApi
  180. */
  181. var BrowserTestingModule = /** @class */ (function () {
  182. function BrowserTestingModule() {
  183. }
  184. BrowserTestingModule = __decorate([
  185. core.NgModule({
  186. exports: [platformBrowser.BrowserModule],
  187. providers: [
  188. { provide: core.APP_ID, useValue: 'a' },
  189. platformBrowser.ɵELEMENT_PROBE_PROVIDERS,
  190. { provide: core.NgZone, useFactory: ɵ0 },
  191. ]
  192. })
  193. ], BrowserTestingModule);
  194. return BrowserTestingModule;
  195. }());
  196. /**
  197. * @license
  198. * Copyright Google Inc. All Rights Reserved.
  199. *
  200. * Use of this source code is governed by an MIT-style license that can be
  201. * found in the LICENSE file at https://angular.io/license
  202. */
  203. /**
  204. * @license
  205. * Copyright Google Inc. All Rights Reserved.
  206. *
  207. * Use of this source code is governed by an MIT-style license that can be
  208. * found in the LICENSE file at https://angular.io/license
  209. */
  210. /**
  211. * @license
  212. * Copyright Google Inc. All Rights Reserved.
  213. *
  214. * Use of this source code is governed by an MIT-style license that can be
  215. * found in the LICENSE file at https://angular.io/license
  216. */
  217. /**
  218. * Generated bundle index. Do not edit.
  219. */
  220. exports.ɵangular_packages_platform_browser_testing_testing_a = createNgZone;
  221. exports.platformBrowserTesting = platformBrowserTesting;
  222. exports.BrowserTestingModule = BrowserTestingModule;
  223. exports.ɵ0 = ɵ0;
  224. Object.defineProperty(exports, '__esModule', { value: true });
  225. }));
  226. //# sourceMappingURL=platform-browser-testing.umd.js.map