Front end of the Slack clone application.

compiler-testing.umd.js 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/compiler')) :
  8. typeof define === 'function' && define.amd ? define('@angular/compiler/testing', ['exports', '@angular/compiler'], factory) :
  9. (factory((global.ng = global.ng || {}, global.ng.compiler = global.ng.compiler || {}, global.ng.compiler.testing = {}),global.ng.compiler));
  10. }(this, (function (exports,_angular_compiler) { '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. /* global Reflect, Promise */
  24. var extendStatics = Object.setPrototypeOf ||
  25. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  26. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  27. function __extends(d, b) {
  28. extendStatics(d, b);
  29. function __() { this.constructor = d; }
  30. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  31. }
  32. /**
  33. * @license Angular v5.2.11
  34. * (c) 2010-2018 Google, Inc. https://angular.io/
  35. * License: MIT
  36. */
  37. /**
  38. * @fileoverview added by tsickle
  39. * @suppress {checkTypes} checked by tsc
  40. */
  41. /**
  42. * @license
  43. * Copyright Google Inc. All Rights Reserved.
  44. *
  45. * Use of this source code is governed by an MIT-style license that can be
  46. * found in the LICENSE file at https://angular.io/license
  47. */
  48. /**
  49. * A mock implementation of {\@link ResourceLoader} that allows outgoing requests to be mocked
  50. * and responded to within a single test, without going to the network.
  51. */
  52. var MockResourceLoader = /** @class */ (function (_super) {
  53. __extends(MockResourceLoader, _super);
  54. function MockResourceLoader() {
  55. var _this = _super !== null && _super.apply(this, arguments) || this;
  56. _this._expectations = [];
  57. _this._definitions = new Map();
  58. _this._requests = [];
  59. return _this;
  60. }
  61. /**
  62. * @param {?} url
  63. * @return {?}
  64. */
  65. MockResourceLoader.prototype.get = /**
  66. * @param {?} url
  67. * @return {?}
  68. */
  69. function (url) {
  70. var /** @type {?} */ request = new _PendingRequest(url);
  71. this._requests.push(request);
  72. return request.getPromise();
  73. };
  74. /**
  75. * @return {?}
  76. */
  77. MockResourceLoader.prototype.hasPendingRequests = /**
  78. * @return {?}
  79. */
  80. function () { return !!this._requests.length; };
  81. /**
  82. * Add an expectation for the given URL. Incoming requests will be checked against
  83. * the next expectation (in FIFO order). The `verifyNoOutstandingExpectations` method
  84. * can be used to check if any expectations have not yet been met.
  85. *
  86. * The response given will be returned if the expectation matches.
  87. */
  88. /**
  89. * Add an expectation for the given URL. Incoming requests will be checked against
  90. * the next expectation (in FIFO order). The `verifyNoOutstandingExpectations` method
  91. * can be used to check if any expectations have not yet been met.
  92. *
  93. * The response given will be returned if the expectation matches.
  94. * @param {?} url
  95. * @param {?} response
  96. * @return {?}
  97. */
  98. MockResourceLoader.prototype.expect = /**
  99. * Add an expectation for the given URL. Incoming requests will be checked against
  100. * the next expectation (in FIFO order). The `verifyNoOutstandingExpectations` method
  101. * can be used to check if any expectations have not yet been met.
  102. *
  103. * The response given will be returned if the expectation matches.
  104. * @param {?} url
  105. * @param {?} response
  106. * @return {?}
  107. */
  108. function (url, response) {
  109. var /** @type {?} */ expectation = new _Expectation(url, response);
  110. this._expectations.push(expectation);
  111. };
  112. /**
  113. * Add a definition for the given URL to return the given response. Unlike expectations,
  114. * definitions have no order and will satisfy any matching request at any time. Also
  115. * unlike expectations, unused definitions do not cause `verifyNoOutstandingExpectations`
  116. * to return an error.
  117. */
  118. /**
  119. * Add a definition for the given URL to return the given response. Unlike expectations,
  120. * definitions have no order and will satisfy any matching request at any time. Also
  121. * unlike expectations, unused definitions do not cause `verifyNoOutstandingExpectations`
  122. * to return an error.
  123. * @param {?} url
  124. * @param {?} response
  125. * @return {?}
  126. */
  127. MockResourceLoader.prototype.when = /**
  128. * Add a definition for the given URL to return the given response. Unlike expectations,
  129. * definitions have no order and will satisfy any matching request at any time. Also
  130. * unlike expectations, unused definitions do not cause `verifyNoOutstandingExpectations`
  131. * to return an error.
  132. * @param {?} url
  133. * @param {?} response
  134. * @return {?}
  135. */
  136. function (url, response) { this._definitions.set(url, response); };
  137. /**
  138. * Process pending requests and verify there are no outstanding expectations. Also fails
  139. * if no requests are pending.
  140. */
  141. /**
  142. * Process pending requests and verify there are no outstanding expectations. Also fails
  143. * if no requests are pending.
  144. * @return {?}
  145. */
  146. MockResourceLoader.prototype.flush = /**
  147. * Process pending requests and verify there are no outstanding expectations. Also fails
  148. * if no requests are pending.
  149. * @return {?}
  150. */
  151. function () {
  152. if (this._requests.length === 0) {
  153. throw new Error('No pending requests to flush');
  154. }
  155. do {
  156. this._processRequest(/** @type {?} */ ((this._requests.shift())));
  157. } while (this._requests.length > 0);
  158. this.verifyNoOutstandingExpectations();
  159. };
  160. /**
  161. * Throw an exception if any expectations have not been satisfied.
  162. */
  163. /**
  164. * Throw an exception if any expectations have not been satisfied.
  165. * @return {?}
  166. */
  167. MockResourceLoader.prototype.verifyNoOutstandingExpectations = /**
  168. * Throw an exception if any expectations have not been satisfied.
  169. * @return {?}
  170. */
  171. function () {
  172. if (this._expectations.length === 0)
  173. return;
  174. var /** @type {?} */ urls = [];
  175. for (var /** @type {?} */ i = 0; i < this._expectations.length; i++) {
  176. var /** @type {?} */ expectation = this._expectations[i];
  177. urls.push(expectation.url);
  178. }
  179. throw new Error("Unsatisfied requests: " + urls.join(', '));
  180. };
  181. /**
  182. * @param {?} request
  183. * @return {?}
  184. */
  185. MockResourceLoader.prototype._processRequest = /**
  186. * @param {?} request
  187. * @return {?}
  188. */
  189. function (request) {
  190. var /** @type {?} */ url = request.url;
  191. if (this._expectations.length > 0) {
  192. var /** @type {?} */ expectation = this._expectations[0];
  193. if (expectation.url == url) {
  194. remove(this._expectations, expectation);
  195. request.complete(expectation.response);
  196. return;
  197. }
  198. }
  199. if (this._definitions.has(url)) {
  200. var /** @type {?} */ response = this._definitions.get(url);
  201. request.complete(response == null ? null : response);
  202. return;
  203. }
  204. throw new Error("Unexpected request " + url);
  205. };
  206. return MockResourceLoader;
  207. }(_angular_compiler.ResourceLoader));
  208. var _PendingRequest = /** @class */ (function () {
  209. function _PendingRequest(url) {
  210. var _this = this;
  211. this.url = url;
  212. this.promise = new Promise(function (res, rej) {
  213. _this.resolve = res;
  214. _this.reject = rej;
  215. });
  216. }
  217. /**
  218. * @param {?} response
  219. * @return {?}
  220. */
  221. _PendingRequest.prototype.complete = /**
  222. * @param {?} response
  223. * @return {?}
  224. */
  225. function (response) {
  226. if (response == null) {
  227. this.reject("Failed to load " + this.url);
  228. }
  229. else {
  230. this.resolve(response);
  231. }
  232. };
  233. /**
  234. * @return {?}
  235. */
  236. _PendingRequest.prototype.getPromise = /**
  237. * @return {?}
  238. */
  239. function () { return this.promise; };
  240. return _PendingRequest;
  241. }());
  242. var _Expectation = /** @class */ (function () {
  243. function _Expectation(url, response) {
  244. this.url = url;
  245. this.response = response;
  246. }
  247. return _Expectation;
  248. }());
  249. /**
  250. * @template T
  251. * @param {?} list
  252. * @param {?} el
  253. * @return {?}
  254. */
  255. function remove(list, el) {
  256. var /** @type {?} */ index = list.indexOf(el);
  257. if (index > -1) {
  258. list.splice(index, 1);
  259. }
  260. }
  261. /**
  262. * @fileoverview added by tsickle
  263. * @suppress {checkTypes} checked by tsc
  264. */
  265. /**
  266. * @license
  267. * Copyright Google Inc. All Rights Reserved.
  268. *
  269. * Use of this source code is governed by an MIT-style license that can be
  270. * found in the LICENSE file at https://angular.io/license
  271. */
  272. var MockSchemaRegistry = /** @class */ (function () {
  273. function MockSchemaRegistry(existingProperties, attrPropMapping, existingElements, invalidProperties, invalidAttributes) {
  274. this.existingProperties = existingProperties;
  275. this.attrPropMapping = attrPropMapping;
  276. this.existingElements = existingElements;
  277. this.invalidProperties = invalidProperties;
  278. this.invalidAttributes = invalidAttributes;
  279. }
  280. /**
  281. * @param {?} tagName
  282. * @param {?} property
  283. * @param {?} schemas
  284. * @return {?}
  285. */
  286. MockSchemaRegistry.prototype.hasProperty = /**
  287. * @param {?} tagName
  288. * @param {?} property
  289. * @param {?} schemas
  290. * @return {?}
  291. */
  292. function (tagName, property, schemas) {
  293. var /** @type {?} */ value = this.existingProperties[property];
  294. return value === void 0 ? true : value;
  295. };
  296. /**
  297. * @param {?} tagName
  298. * @param {?} schemaMetas
  299. * @return {?}
  300. */
  301. MockSchemaRegistry.prototype.hasElement = /**
  302. * @param {?} tagName
  303. * @param {?} schemaMetas
  304. * @return {?}
  305. */
  306. function (tagName, schemaMetas) {
  307. var /** @type {?} */ value = this.existingElements[tagName.toLowerCase()];
  308. return value === void 0 ? true : value;
  309. };
  310. /**
  311. * @return {?}
  312. */
  313. MockSchemaRegistry.prototype.allKnownElementNames = /**
  314. * @return {?}
  315. */
  316. function () { return Object.keys(this.existingElements); };
  317. /**
  318. * @param {?} selector
  319. * @param {?} property
  320. * @param {?} isAttribute
  321. * @return {?}
  322. */
  323. MockSchemaRegistry.prototype.securityContext = /**
  324. * @param {?} selector
  325. * @param {?} property
  326. * @param {?} isAttribute
  327. * @return {?}
  328. */
  329. function (selector, property, isAttribute) {
  330. return _angular_compiler.core.SecurityContext.NONE;
  331. };
  332. /**
  333. * @param {?} attrName
  334. * @return {?}
  335. */
  336. MockSchemaRegistry.prototype.getMappedPropName = /**
  337. * @param {?} attrName
  338. * @return {?}
  339. */
  340. function (attrName) { return this.attrPropMapping[attrName] || attrName; };
  341. /**
  342. * @return {?}
  343. */
  344. MockSchemaRegistry.prototype.getDefaultComponentElementName = /**
  345. * @return {?}
  346. */
  347. function () { return 'ng-component'; };
  348. /**
  349. * @param {?} name
  350. * @return {?}
  351. */
  352. MockSchemaRegistry.prototype.validateProperty = /**
  353. * @param {?} name
  354. * @return {?}
  355. */
  356. function (name) {
  357. if (this.invalidProperties.indexOf(name) > -1) {
  358. return { error: true, msg: "Binding to property '" + name + "' is disallowed for security reasons" };
  359. }
  360. else {
  361. return { error: false };
  362. }
  363. };
  364. /**
  365. * @param {?} name
  366. * @return {?}
  367. */
  368. MockSchemaRegistry.prototype.validateAttribute = /**
  369. * @param {?} name
  370. * @return {?}
  371. */
  372. function (name) {
  373. if (this.invalidAttributes.indexOf(name) > -1) {
  374. return {
  375. error: true,
  376. msg: "Binding to attribute '" + name + "' is disallowed for security reasons"
  377. };
  378. }
  379. else {
  380. return { error: false };
  381. }
  382. };
  383. /**
  384. * @param {?} propName
  385. * @return {?}
  386. */
  387. MockSchemaRegistry.prototype.normalizeAnimationStyleProperty = /**
  388. * @param {?} propName
  389. * @return {?}
  390. */
  391. function (propName) { return propName; };
  392. /**
  393. * @param {?} camelCaseProp
  394. * @param {?} userProvidedProp
  395. * @param {?} val
  396. * @return {?}
  397. */
  398. MockSchemaRegistry.prototype.normalizeAnimationStyleValue = /**
  399. * @param {?} camelCaseProp
  400. * @param {?} userProvidedProp
  401. * @param {?} val
  402. * @return {?}
  403. */
  404. function (camelCaseProp, userProvidedProp, val) {
  405. return { error: /** @type {?} */ ((null)), value: val.toString() };
  406. };
  407. return MockSchemaRegistry;
  408. }());
  409. /**
  410. * @fileoverview added by tsickle
  411. * @suppress {checkTypes} checked by tsc
  412. */
  413. /**
  414. * An implementation of {\@link DirectiveResolver} that allows overriding
  415. * various properties of directives.
  416. */
  417. var MockDirectiveResolver = /** @class */ (function (_super) {
  418. __extends(MockDirectiveResolver, _super);
  419. function MockDirectiveResolver(reflector) {
  420. var _this = _super.call(this, reflector) || this;
  421. _this._directives = new Map();
  422. return _this;
  423. }
  424. /**
  425. * @param {?} type
  426. * @param {?=} throwIfNotFound
  427. * @return {?}
  428. */
  429. MockDirectiveResolver.prototype.resolve = /**
  430. * @param {?} type
  431. * @param {?=} throwIfNotFound
  432. * @return {?}
  433. */
  434. function (type, throwIfNotFound) {
  435. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  436. return this._directives.get(type) || _super.prototype.resolve.call(this, type, throwIfNotFound);
  437. };
  438. /**
  439. * Overrides the {@link core.Directive} for a directive.
  440. */
  441. /**
  442. * Overrides the {\@link core.Directive} for a directive.
  443. * @param {?} type
  444. * @param {?} metadata
  445. * @return {?}
  446. */
  447. MockDirectiveResolver.prototype.setDirective = /**
  448. * Overrides the {\@link core.Directive} for a directive.
  449. * @param {?} type
  450. * @param {?} metadata
  451. * @return {?}
  452. */
  453. function (type, metadata) {
  454. this._directives.set(type, metadata);
  455. };
  456. return MockDirectiveResolver;
  457. }(_angular_compiler.DirectiveResolver));
  458. /**
  459. * @fileoverview added by tsickle
  460. * @suppress {checkTypes} checked by tsc
  461. */
  462. /**
  463. * @license
  464. * Copyright Google Inc. All Rights Reserved.
  465. *
  466. * Use of this source code is governed by an MIT-style license that can be
  467. * found in the LICENSE file at https://angular.io/license
  468. */
  469. var MockNgModuleResolver = /** @class */ (function (_super) {
  470. __extends(MockNgModuleResolver, _super);
  471. function MockNgModuleResolver(reflector) {
  472. var _this = _super.call(this, reflector) || this;
  473. _this._ngModules = new Map();
  474. return _this;
  475. }
  476. /**
  477. * Overrides the {@link NgModule} for a module.
  478. */
  479. /**
  480. * Overrides the {\@link NgModule} for a module.
  481. * @param {?} type
  482. * @param {?} metadata
  483. * @return {?}
  484. */
  485. MockNgModuleResolver.prototype.setNgModule = /**
  486. * Overrides the {\@link NgModule} for a module.
  487. * @param {?} type
  488. * @param {?} metadata
  489. * @return {?}
  490. */
  491. function (type, metadata) {
  492. this._ngModules.set(type, metadata);
  493. };
  494. /**
  495. * Returns the {@link NgModule} for a module:
  496. * - Set the {@link NgModule} to the overridden view when it exists or fallback to the
  497. * default
  498. * `NgModuleResolver`, see `setNgModule`.
  499. */
  500. /**
  501. * Returns the {\@link NgModule} for a module:
  502. * - Set the {\@link NgModule} to the overridden view when it exists or fallback to the
  503. * default
  504. * `NgModuleResolver`, see `setNgModule`.
  505. * @param {?} type
  506. * @param {?=} throwIfNotFound
  507. * @return {?}
  508. */
  509. MockNgModuleResolver.prototype.resolve = /**
  510. * Returns the {\@link NgModule} for a module:
  511. * - Set the {\@link NgModule} to the overridden view when it exists or fallback to the
  512. * default
  513. * `NgModuleResolver`, see `setNgModule`.
  514. * @param {?} type
  515. * @param {?=} throwIfNotFound
  516. * @return {?}
  517. */
  518. function (type, throwIfNotFound) {
  519. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  520. return this._ngModules.get(type) || /** @type {?} */ ((_super.prototype.resolve.call(this, type, throwIfNotFound)));
  521. };
  522. return MockNgModuleResolver;
  523. }(_angular_compiler.NgModuleResolver));
  524. /**
  525. * @fileoverview added by tsickle
  526. * @suppress {checkTypes} checked by tsc
  527. */
  528. /**
  529. * @license
  530. * Copyright Google Inc. All Rights Reserved.
  531. *
  532. * Use of this source code is governed by an MIT-style license that can be
  533. * found in the LICENSE file at https://angular.io/license
  534. */
  535. var MockPipeResolver = /** @class */ (function (_super) {
  536. __extends(MockPipeResolver, _super);
  537. function MockPipeResolver(refector) {
  538. var _this = _super.call(this, refector) || this;
  539. _this._pipes = new Map();
  540. return _this;
  541. }
  542. /**
  543. * Overrides the {@link Pipe} for a pipe.
  544. */
  545. /**
  546. * Overrides the {\@link Pipe} for a pipe.
  547. * @param {?} type
  548. * @param {?} metadata
  549. * @return {?}
  550. */
  551. MockPipeResolver.prototype.setPipe = /**
  552. * Overrides the {\@link Pipe} for a pipe.
  553. * @param {?} type
  554. * @param {?} metadata
  555. * @return {?}
  556. */
  557. function (type, metadata) { this._pipes.set(type, metadata); };
  558. /**
  559. * Returns the {@link Pipe} for a pipe:
  560. * - Set the {@link Pipe} to the overridden view when it exists or fallback to the
  561. * default
  562. * `PipeResolver`, see `setPipe`.
  563. */
  564. /**
  565. * Returns the {\@link Pipe} for a pipe:
  566. * - Set the {\@link Pipe} to the overridden view when it exists or fallback to the
  567. * default
  568. * `PipeResolver`, see `setPipe`.
  569. * @param {?} type
  570. * @param {?=} throwIfNotFound
  571. * @return {?}
  572. */
  573. MockPipeResolver.prototype.resolve = /**
  574. * Returns the {\@link Pipe} for a pipe:
  575. * - Set the {\@link Pipe} to the overridden view when it exists or fallback to the
  576. * default
  577. * `PipeResolver`, see `setPipe`.
  578. * @param {?} type
  579. * @param {?=} throwIfNotFound
  580. * @return {?}
  581. */
  582. function (type, throwIfNotFound) {
  583. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  584. var /** @type {?} */ metadata = this._pipes.get(type);
  585. if (!metadata) {
  586. metadata = /** @type {?} */ ((_super.prototype.resolve.call(this, type, throwIfNotFound)));
  587. }
  588. return metadata;
  589. };
  590. return MockPipeResolver;
  591. }(_angular_compiler.PipeResolver));
  592. exports.MockResourceLoader = MockResourceLoader;
  593. exports.MockSchemaRegistry = MockSchemaRegistry;
  594. exports.MockDirectiveResolver = MockDirectiveResolver;
  595. exports.MockNgModuleResolver = MockNgModuleResolver;
  596. exports.MockPipeResolver = MockPipeResolver;
  597. Object.defineProperty(exports, '__esModule', { value: true });
  598. })));
  599. //# sourceMappingURL=compiler-testing.umd.js.map