Front end of the Slack clone application.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. import { DirectiveResolver, NgModuleResolver, PipeResolver, ResourceLoader, core } from '@angular/compiler';
  7. /**
  8. * @fileoverview added by tsickle
  9. * @suppress {checkTypes} checked by tsc
  10. */
  11. /**
  12. * @license
  13. * Copyright Google Inc. 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. /**
  19. * A mock implementation of {\@link ResourceLoader} that allows outgoing requests to be mocked
  20. * and responded to within a single test, without going to the network.
  21. */
  22. class MockResourceLoader extends ResourceLoader {
  23. constructor() {
  24. super(...arguments);
  25. this._expectations = [];
  26. this._definitions = new Map();
  27. this._requests = [];
  28. }
  29. /**
  30. * @param {?} url
  31. * @return {?}
  32. */
  33. get(url) {
  34. const /** @type {?} */ request = new _PendingRequest(url);
  35. this._requests.push(request);
  36. return request.getPromise();
  37. }
  38. /**
  39. * @return {?}
  40. */
  41. hasPendingRequests() { return !!this._requests.length; }
  42. /**
  43. * Add an expectation for the given URL. Incoming requests will be checked against
  44. * the next expectation (in FIFO order). The `verifyNoOutstandingExpectations` method
  45. * can be used to check if any expectations have not yet been met.
  46. *
  47. * The response given will be returned if the expectation matches.
  48. * @param {?} url
  49. * @param {?} response
  50. * @return {?}
  51. */
  52. expect(url, response) {
  53. const /** @type {?} */ expectation = new _Expectation(url, response);
  54. this._expectations.push(expectation);
  55. }
  56. /**
  57. * Add a definition for the given URL to return the given response. Unlike expectations,
  58. * definitions have no order and will satisfy any matching request at any time. Also
  59. * unlike expectations, unused definitions do not cause `verifyNoOutstandingExpectations`
  60. * to return an error.
  61. * @param {?} url
  62. * @param {?} response
  63. * @return {?}
  64. */
  65. when(url, response) { this._definitions.set(url, response); }
  66. /**
  67. * Process pending requests and verify there are no outstanding expectations. Also fails
  68. * if no requests are pending.
  69. * @return {?}
  70. */
  71. flush() {
  72. if (this._requests.length === 0) {
  73. throw new Error('No pending requests to flush');
  74. }
  75. do {
  76. this._processRequest(/** @type {?} */ ((this._requests.shift())));
  77. } while (this._requests.length > 0);
  78. this.verifyNoOutstandingExpectations();
  79. }
  80. /**
  81. * Throw an exception if any expectations have not been satisfied.
  82. * @return {?}
  83. */
  84. verifyNoOutstandingExpectations() {
  85. if (this._expectations.length === 0)
  86. return;
  87. const /** @type {?} */ urls = [];
  88. for (let /** @type {?} */ i = 0; i < this._expectations.length; i++) {
  89. const /** @type {?} */ expectation = this._expectations[i];
  90. urls.push(expectation.url);
  91. }
  92. throw new Error(`Unsatisfied requests: ${urls.join(', ')}`);
  93. }
  94. /**
  95. * @param {?} request
  96. * @return {?}
  97. */
  98. _processRequest(request) {
  99. const /** @type {?} */ url = request.url;
  100. if (this._expectations.length > 0) {
  101. const /** @type {?} */ expectation = this._expectations[0];
  102. if (expectation.url == url) {
  103. remove(this._expectations, expectation);
  104. request.complete(expectation.response);
  105. return;
  106. }
  107. }
  108. if (this._definitions.has(url)) {
  109. const /** @type {?} */ response = this._definitions.get(url);
  110. request.complete(response == null ? null : response);
  111. return;
  112. }
  113. throw new Error(`Unexpected request ${url}`);
  114. }
  115. }
  116. class _PendingRequest {
  117. /**
  118. * @param {?} url
  119. */
  120. constructor(url) {
  121. this.url = url;
  122. this.promise = new Promise((res, rej) => {
  123. this.resolve = res;
  124. this.reject = rej;
  125. });
  126. }
  127. /**
  128. * @param {?} response
  129. * @return {?}
  130. */
  131. complete(response) {
  132. if (response == null) {
  133. this.reject(`Failed to load ${this.url}`);
  134. }
  135. else {
  136. this.resolve(response);
  137. }
  138. }
  139. /**
  140. * @return {?}
  141. */
  142. getPromise() { return this.promise; }
  143. }
  144. class _Expectation {
  145. /**
  146. * @param {?} url
  147. * @param {?} response
  148. */
  149. constructor(url, response) {
  150. this.url = url;
  151. this.response = response;
  152. }
  153. }
  154. /**
  155. * @template T
  156. * @param {?} list
  157. * @param {?} el
  158. * @return {?}
  159. */
  160. function remove(list, el) {
  161. const /** @type {?} */ index = list.indexOf(el);
  162. if (index > -1) {
  163. list.splice(index, 1);
  164. }
  165. }
  166. /**
  167. * @fileoverview added by tsickle
  168. * @suppress {checkTypes} checked by tsc
  169. */
  170. /**
  171. * @license
  172. * Copyright Google Inc. All Rights Reserved.
  173. *
  174. * Use of this source code is governed by an MIT-style license that can be
  175. * found in the LICENSE file at https://angular.io/license
  176. */
  177. class MockSchemaRegistry {
  178. /**
  179. * @param {?} existingProperties
  180. * @param {?} attrPropMapping
  181. * @param {?} existingElements
  182. * @param {?} invalidProperties
  183. * @param {?} invalidAttributes
  184. */
  185. constructor(existingProperties, attrPropMapping, existingElements, invalidProperties, invalidAttributes) {
  186. this.existingProperties = existingProperties;
  187. this.attrPropMapping = attrPropMapping;
  188. this.existingElements = existingElements;
  189. this.invalidProperties = invalidProperties;
  190. this.invalidAttributes = invalidAttributes;
  191. }
  192. /**
  193. * @param {?} tagName
  194. * @param {?} property
  195. * @param {?} schemas
  196. * @return {?}
  197. */
  198. hasProperty(tagName, property, schemas) {
  199. const /** @type {?} */ value = this.existingProperties[property];
  200. return value === void 0 ? true : value;
  201. }
  202. /**
  203. * @param {?} tagName
  204. * @param {?} schemaMetas
  205. * @return {?}
  206. */
  207. hasElement(tagName, schemaMetas) {
  208. const /** @type {?} */ value = this.existingElements[tagName.toLowerCase()];
  209. return value === void 0 ? true : value;
  210. }
  211. /**
  212. * @return {?}
  213. */
  214. allKnownElementNames() { return Object.keys(this.existingElements); }
  215. /**
  216. * @param {?} selector
  217. * @param {?} property
  218. * @param {?} isAttribute
  219. * @return {?}
  220. */
  221. securityContext(selector, property, isAttribute) {
  222. return core.SecurityContext.NONE;
  223. }
  224. /**
  225. * @param {?} attrName
  226. * @return {?}
  227. */
  228. getMappedPropName(attrName) { return this.attrPropMapping[attrName] || attrName; }
  229. /**
  230. * @return {?}
  231. */
  232. getDefaultComponentElementName() { return 'ng-component'; }
  233. /**
  234. * @param {?} name
  235. * @return {?}
  236. */
  237. validateProperty(name) {
  238. if (this.invalidProperties.indexOf(name) > -1) {
  239. return { error: true, msg: `Binding to property '${name}' is disallowed for security reasons` };
  240. }
  241. else {
  242. return { error: false };
  243. }
  244. }
  245. /**
  246. * @param {?} name
  247. * @return {?}
  248. */
  249. validateAttribute(name) {
  250. if (this.invalidAttributes.indexOf(name) > -1) {
  251. return {
  252. error: true,
  253. msg: `Binding to attribute '${name}' is disallowed for security reasons`
  254. };
  255. }
  256. else {
  257. return { error: false };
  258. }
  259. }
  260. /**
  261. * @param {?} propName
  262. * @return {?}
  263. */
  264. normalizeAnimationStyleProperty(propName) { return propName; }
  265. /**
  266. * @param {?} camelCaseProp
  267. * @param {?} userProvidedProp
  268. * @param {?} val
  269. * @return {?}
  270. */
  271. normalizeAnimationStyleValue(camelCaseProp, userProvidedProp, val) {
  272. return { error: /** @type {?} */ ((null)), value: val.toString() };
  273. }
  274. }
  275. /**
  276. * @fileoverview added by tsickle
  277. * @suppress {checkTypes} checked by tsc
  278. */
  279. /**
  280. * An implementation of {\@link DirectiveResolver} that allows overriding
  281. * various properties of directives.
  282. */
  283. class MockDirectiveResolver extends DirectiveResolver {
  284. /**
  285. * @param {?} reflector
  286. */
  287. constructor(reflector) {
  288. super(reflector);
  289. this._directives = new Map();
  290. }
  291. /**
  292. * @param {?} type
  293. * @param {?=} throwIfNotFound
  294. * @return {?}
  295. */
  296. resolve(type, throwIfNotFound = true) {
  297. return this._directives.get(type) || super.resolve(type, throwIfNotFound);
  298. }
  299. /**
  300. * Overrides the {\@link core.Directive} for a directive.
  301. * @param {?} type
  302. * @param {?} metadata
  303. * @return {?}
  304. */
  305. setDirective(type, metadata) {
  306. this._directives.set(type, metadata);
  307. }
  308. }
  309. /**
  310. * @fileoverview added by tsickle
  311. * @suppress {checkTypes} checked by tsc
  312. */
  313. /**
  314. * @license
  315. * Copyright Google Inc. All Rights Reserved.
  316. *
  317. * Use of this source code is governed by an MIT-style license that can be
  318. * found in the LICENSE file at https://angular.io/license
  319. */
  320. class MockNgModuleResolver extends NgModuleResolver {
  321. /**
  322. * @param {?} reflector
  323. */
  324. constructor(reflector) {
  325. super(reflector);
  326. this._ngModules = new Map();
  327. }
  328. /**
  329. * Overrides the {\@link NgModule} for a module.
  330. * @param {?} type
  331. * @param {?} metadata
  332. * @return {?}
  333. */
  334. setNgModule(type, metadata) {
  335. this._ngModules.set(type, metadata);
  336. }
  337. /**
  338. * Returns the {\@link NgModule} for a module:
  339. * - Set the {\@link NgModule} to the overridden view when it exists or fallback to the
  340. * default
  341. * `NgModuleResolver`, see `setNgModule`.
  342. * @param {?} type
  343. * @param {?=} throwIfNotFound
  344. * @return {?}
  345. */
  346. resolve(type, throwIfNotFound = true) {
  347. return this._ngModules.get(type) || /** @type {?} */ ((super.resolve(type, throwIfNotFound)));
  348. }
  349. }
  350. /**
  351. * @fileoverview added by tsickle
  352. * @suppress {checkTypes} checked by tsc
  353. */
  354. /**
  355. * @license
  356. * Copyright Google Inc. All Rights Reserved.
  357. *
  358. * Use of this source code is governed by an MIT-style license that can be
  359. * found in the LICENSE file at https://angular.io/license
  360. */
  361. class MockPipeResolver extends PipeResolver {
  362. /**
  363. * @param {?} refector
  364. */
  365. constructor(refector) {
  366. super(refector);
  367. this._pipes = new Map();
  368. }
  369. /**
  370. * Overrides the {\@link Pipe} for a pipe.
  371. * @param {?} type
  372. * @param {?} metadata
  373. * @return {?}
  374. */
  375. setPipe(type, metadata) { this._pipes.set(type, metadata); }
  376. /**
  377. * Returns the {\@link Pipe} for a pipe:
  378. * - Set the {\@link Pipe} to the overridden view when it exists or fallback to the
  379. * default
  380. * `PipeResolver`, see `setPipe`.
  381. * @param {?} type
  382. * @param {?=} throwIfNotFound
  383. * @return {?}
  384. */
  385. resolve(type, throwIfNotFound = true) {
  386. let /** @type {?} */ metadata = this._pipes.get(type);
  387. if (!metadata) {
  388. metadata = /** @type {?} */ ((super.resolve(type, throwIfNotFound)));
  389. }
  390. return metadata;
  391. }
  392. }
  393. /**
  394. * @fileoverview added by tsickle
  395. * @suppress {checkTypes} checked by tsc
  396. */
  397. /**
  398. * @license
  399. * Copyright Google Inc. All Rights Reserved.
  400. *
  401. * Use of this source code is governed by an MIT-style license that can be
  402. * found in the LICENSE file at https://angular.io/license
  403. */
  404. /**
  405. * @module
  406. * @description
  407. * Entry point for all APIs of the compiler package.
  408. *
  409. * <div class="callout is-critical">
  410. * <header>Unstable APIs</header>
  411. * <p>
  412. * All compiler apis are currently considered experimental and private!
  413. * </p>
  414. * <p>
  415. * We expect the APIs in this package to keep on changing. Do not rely on them.
  416. * </p>
  417. * </div>
  418. */
  419. /**
  420. * @fileoverview added by tsickle
  421. * @suppress {checkTypes} checked by tsc
  422. */
  423. /**
  424. * @license
  425. * Copyright Google Inc. All Rights Reserved.
  426. *
  427. * Use of this source code is governed by an MIT-style license that can be
  428. * found in the LICENSE file at https://angular.io/license
  429. */
  430. /**
  431. * @module
  432. * @description
  433. * Entry point for all public APIs of this package.
  434. */
  435. // This file only reexports content of the `src` folder. Keep it that way.
  436. /**
  437. * @fileoverview added by tsickle
  438. * @suppress {checkTypes} checked by tsc
  439. */
  440. /**
  441. * @license
  442. * Copyright Google Inc. All Rights Reserved.
  443. *
  444. * Use of this source code is governed by an MIT-style license that can be
  445. * found in the LICENSE file at https://angular.io/license
  446. */
  447. // This file is not used to build this module. It is only used during editing
  448. // by the TypeScript language service and during build for verification. `ngc`
  449. // replaces this file with production index.ts when it rewrites private symbol
  450. // names.
  451. export { MockResourceLoader, MockSchemaRegistry, MockDirectiveResolver, MockNgModuleResolver, MockPipeResolver };
  452. //# sourceMappingURL=testing.js.map