| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-01 10:28:52 -08:00
										 |  |  | import {EventEmitter} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  | import {Injectable} from '@angular/core/src/di'; | 
					
						
							|  |  |  | import {Testability} from '@angular/core/src/testability/testability'; | 
					
						
							|  |  |  | import {NgZone} from '@angular/core/src/zone/ng_zone'; | 
					
						
							| 
									
										
										
										
											2017-03-02 12:12:46 -08:00
										 |  |  | import {AsyncTestCompleter, SpyObject, beforeEach, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal'; | 
					
						
							| 
									
										
										
										
											2016-08-02 15:53:34 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-01 15:18:10 -08:00
										 |  |  | import {scheduleMicroTask} from '../../src/util'; | 
					
						
							| 
									
										
										
										
											2016-08-02 15:53:34 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-01 10:28:52 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | // Schedules a microtasks (using a resolved promise .then())
 | 
					
						
							|  |  |  | function microTask(fn: Function): void { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |   scheduleMicroTask(() => { | 
					
						
							| 
									
										
										
										
											2016-07-21 17:12:00 -07:00
										 |  |  |     // We do double dispatch so that we  can wait for scheduleMicrotask in the Testability when
 | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |     // NgZone becomes stable.
 | 
					
						
							|  |  |  |     scheduleMicroTask(fn); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 09:06:42 -08:00
										 |  |  | @Injectable() | 
					
						
							| 
									
										
										
										
											2015-10-08 13:33:22 -07:00
										 |  |  | class MockNgZone extends NgZone { | 
					
						
							| 
									
										
										
										
											2016-07-21 17:12:00 -07:00
										 |  |  |   /** @internal */ | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |   _onUnstableStream: EventEmitter<any>; | 
					
						
							|  |  |  |   get onUnstable() { return this._onUnstableStream; } | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-21 17:12:00 -07:00
										 |  |  |   /** @internal */ | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |   _onStableStream: EventEmitter<any>; | 
					
						
							|  |  |  |   get onStable() { return this._onStableStream; } | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-03 18:45:55 -08:00
										 |  |  |   constructor() { | 
					
						
							|  |  |  |     super({enableLongStackTrace: false}); | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |     this._onUnstableStream = new EventEmitter(false); | 
					
						
							|  |  |  |     this._onStableStream = new EventEmitter(false); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-02 15:53:34 -07:00
										 |  |  |   unstable(): void { this._onUnstableStream.emit(null); } | 
					
						
							| 
									
										
										
										
											2015-11-03 18:45:55 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-02 15:53:34 -07:00
										 |  |  |   stable(): void { this._onStableStream.emit(null); } | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function main() { | 
					
						
							|  |  |  |   describe('Testability', () => { | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |     let testability: Testability; | 
					
						
							|  |  |  |     let execute: any; | 
					
						
							|  |  |  |     let execute2: any; | 
					
						
							|  |  |  |     let ngZone: MockNgZone; | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     beforeEach(() => { | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |       ngZone = new MockNgZone(); | 
					
						
							|  |  |  |       testability = new Testability(ngZone); | 
					
						
							|  |  |  |       execute = new SpyObject().spy('execute'); | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  |       execute2 = new SpyObject().spy('execute'); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |     describe('Pending count logic', () => { | 
					
						
							|  |  |  |       it('should start with a pending count of 0', | 
					
						
							|  |  |  |          () => { expect(testability.getPendingRequestCount()).toEqual(0); }); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |       it('should fire whenstable callbacks if pending count is 0', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).toHaveBeenCalled(); | 
					
						
							|  |  |  |              async.done(); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should not fire whenstable callbacks synchronously if pending count is 0', () => { | 
					
						
							|  |  |  |         testability.whenStable(execute); | 
					
						
							|  |  |  |         expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should not call whenstable callbacks when there are pending counts', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |              testability.decreasePendingRequestCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should fire whenstable callbacks when pending drops to 0', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |              testability.decreasePendingRequestCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).toHaveBeenCalled(); | 
					
						
							|  |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |       it('should not fire whenstable callbacks synchronously when pending drops to 0', () => { | 
					
						
							|  |  |  |         testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |         testability.whenStable(execute); | 
					
						
							|  |  |  |         testability.decreasePendingRequestCount(); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |         expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       it('should fire whenstable callbacks with didWork if pending count is 0', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).toHaveBeenCalledWith(false); | 
					
						
							|  |  |  |              async.done(); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should fire whenstable callbacks with didWork when pending drops to 0', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              testability.decreasePendingRequestCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).toHaveBeenCalledWith(true); | 
					
						
							|  |  |  |                testability.whenStable(execute2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                microTask(() => { | 
					
						
							|  |  |  |                  expect(execute2).toHaveBeenCalledWith(false); | 
					
						
							|  |  |  |                  async.done(); | 
					
						
							|  |  |  |                }); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |     describe('NgZone callback logic', () => { | 
					
						
							|  |  |  |       it('should fire whenstable callback if event is already finished', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |            ngZone.unstable(); | 
					
						
							|  |  |  |            ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).toHaveBeenCalled(); | 
					
						
							|  |  |  |              async.done(); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should not fire whenstable callbacks synchronously if event is already finished', () => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |         ngZone.unstable(); | 
					
						
							|  |  |  |         ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |         testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should fire whenstable callback when event finishes', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |            ngZone.unstable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).not.toHaveBeenCalled(); | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |              ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).toHaveBeenCalled(); | 
					
						
							|  |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should not fire whenstable callbacks synchronously when event finishes', () => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |         ngZone.unstable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |         testability.whenStable(execute); | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |         ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |         expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should not fire whenstable callback when event did not finish', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |            ngZone.unstable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |              testability.decreasePendingRequestCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).not.toHaveBeenCalled(); | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |                ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |                microTask(() => { | 
					
						
							|  |  |  |                  expect(execute).toHaveBeenCalled(); | 
					
						
							|  |  |  |                  async.done(); | 
					
						
							|  |  |  |                }); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should not fire whenstable callback when there are pending counts', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |            ngZone.unstable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.increasePendingRequestCount(); | 
					
						
							|  |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).not.toHaveBeenCalled(); | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |              ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |                testability.decreasePendingRequestCount(); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |                microTask(() => { | 
					
						
							|  |  |  |                  expect(execute).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |                  testability.decreasePendingRequestCount(); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 12:46:12 -07:00
										 |  |  |                  microTask(() => { | 
					
						
							|  |  |  |                    expect(execute).toHaveBeenCalled(); | 
					
						
							|  |  |  |                    async.done(); | 
					
						
							|  |  |  |                  }); | 
					
						
							|  |  |  |                }); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       it('should fire whenstable callback with didWork if event is already finished', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |            ngZone.unstable(); | 
					
						
							|  |  |  |            ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							|  |  |  |              expect(execute).toHaveBeenCalledWith(true); | 
					
						
							|  |  |  |              testability.whenStable(execute2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute2).toHaveBeenCalledWith(false); | 
					
						
							|  |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should fire whenstable callback with didwork when event finishes', | 
					
						
							| 
									
										
										
										
											2016-06-09 11:04:15 -07:00
										 |  |  |          inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |            ngZone.unstable(); | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  |            testability.whenStable(execute); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            microTask(() => { | 
					
						
							| 
									
										
										
										
											2016-02-25 14:24:17 -08:00
										 |  |  |              ngZone.stable(); | 
					
						
							| 
									
										
										
										
											2016-01-05 12:56:24 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |              microTask(() => { | 
					
						
							|  |  |  |                expect(execute).toHaveBeenCalledWith(true); | 
					
						
							|  |  |  |                testability.whenStable(execute2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                microTask(() => { | 
					
						
							|  |  |  |                  expect(execute2).toHaveBeenCalledWith(false); | 
					
						
							|  |  |  |                  async.done(); | 
					
						
							|  |  |  |                }); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |            }); | 
					
						
							|  |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-03-23 16:46:18 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } |