| 
									
										
										
										
											2015-06-18 14:47:38 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							|  |  |  |   afterEach, | 
					
						
							|  |  |  |   SpyProtoChangeDetector | 
					
						
							|  |  |  | } from 'angular2/test_lib'; | 
					
						
							| 
									
										
										
										
											2015-01-21 12:05:52 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-26 17:12:38 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   PreGeneratedChangeDetection, | 
					
						
							|  |  |  |   ChangeDetectorDefinition, | 
					
						
							|  |  |  |   DynamicProtoChangeDetector | 
					
						
							| 
									
										
										
										
											2015-07-11 17:26:48 +02:00
										 |  |  | } from 'angular2/src/change_detection/change_detection'; | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-14 13:51:16 -08:00
										 |  |  | export function main() { | 
					
						
							| 
									
										
										
										
											2015-05-13 13:01:31 -07:00
										 |  |  |   describe("PreGeneratedChangeDetection", () => { | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  |     var proto; | 
					
						
							|  |  |  |     var def; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     beforeEach(() => { | 
					
						
							| 
									
										
										
										
											2015-06-18 14:47:38 -07:00
										 |  |  |       proto = new SpyProtoChangeDetector(); | 
					
						
							| 
									
										
										
										
											2015-07-27 13:16:20 -07:00
										 |  |  |       def = new ChangeDetectorDefinition('id', null, [], [], [], true); | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2015-05-13 13:01:31 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  |     it("should return a proto change detector when one is available", () => { | 
					
						
							| 
									
										
										
										
											2015-07-08 10:28:47 -07:00
										 |  |  |       var map = {'id': (def) => proto}; | 
					
						
							|  |  |  |       var cd = new PreGeneratedChangeDetection(map); | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       expect(cd.createProtoChangeDetector(def)).toBe(proto) | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2015-05-13 13:01:31 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  |     it("should delegate to dynamic change detection otherwise", () => { | 
					
						
							| 
									
										
										
										
											2015-07-08 10:28:47 -07:00
										 |  |  |       var cd = new PreGeneratedChangeDetection({}); | 
					
						
							| 
									
										
										
										
											2015-05-13 13:25:18 -07:00
										 |  |  |       expect(cd.createProtoChangeDetector(def)).toBeAnInstanceOf(DynamicProtoChangeDetector); | 
					
						
							| 
									
										
										
										
											2015-05-13 13:01:31 -07:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2015-01-14 13:51:16 -08:00
										 |  |  |   }); | 
					
						
							|  |  |  | } |