| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   el, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   inject, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  |   TestComponentBuilder | 
					
						
							| 
									
										
										
										
											2015-10-13 00:29:13 -07:00
										 |  |  | } from 'angular2/testing_internal'; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | import { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |   CompileDirectiveMetadata, | 
					
						
							|  |  |  |   CompileTypeMetadata, | 
					
						
							|  |  |  |   CompileTemplateMetadata | 
					
						
							| 
									
										
										
										
											2015-11-05 14:07:57 -08:00
										 |  |  | } from 'angular2/src/compiler/directive_metadata'; | 
					
						
							| 
									
										
										
										
											2015-10-05 10:10:07 -07:00
										 |  |  | import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  | import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection'; | 
					
						
							| 
									
										
										
										
											2015-10-02 07:37:23 -07:00
										 |  |  | import {LifecycleHooks} from 'angular2/src/core/linker/interfaces'; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function main() { | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |   describe('DirectiveMetadata', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     var fullTypeMeta: CompileTypeMetadata; | 
					
						
							|  |  |  |     var fullTemplateMeta: CompileTemplateMetadata; | 
					
						
							|  |  |  |     var fullDirectiveMeta: CompileDirectiveMetadata; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     beforeEach(() => { | 
					
						
							| 
									
										
										
										
											2015-10-01 10:07:49 -07:00
										 |  |  |       fullTypeMeta = | 
					
						
							|  |  |  |           new CompileTypeMetadata({name: 'SomeType', moduleUrl: 'someUrl', isHost: true}); | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |       fullTemplateMeta = new CompileTemplateMetadata({ | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |         encapsulation: ViewEncapsulation.Emulated, | 
					
						
							|  |  |  |         template: '<a></a>', | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         templateUrl: 'someTemplateUrl', | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |         styles: ['someStyle'], | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         styleUrls: ['someStyleUrl'], | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |         ngContentSelectors: ['*'] | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |       fullDirectiveMeta = CompileDirectiveMetadata.create({ | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |         selector: 'someSelector', | 
					
						
							|  |  |  |         isComponent: true, | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |         dynamicLoadable: true, | 
					
						
							| 
									
										
										
										
											2015-10-28 08:59:19 +01:00
										 |  |  |         type: fullTypeMeta, | 
					
						
							|  |  |  |         template: fullTemplateMeta, | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         changeDetection: ChangeDetectionStrategy.Default, | 
					
						
							| 
									
										
										
										
											2015-09-30 20:59:23 -07:00
										 |  |  |         inputs: ['someProp'], | 
					
						
							|  |  |  |         outputs: ['someEvent'], | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         host: {'(event1)': 'handler1', '[prop1]': 'expr1', 'attr1': 'attrValue2'}, | 
					
						
							|  |  |  |         lifecycleHooks: [LifecycleHooks.OnChanges] | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     describe('DirectiveMetadata', () => { | 
					
						
							|  |  |  |       it('should serialize with full data', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         expect(CompileDirectiveMetadata.fromJson(fullDirectiveMeta.toJson())) | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |             .toEqual(fullDirectiveMeta); | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should serialize with no data', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         var empty = CompileDirectiveMetadata.create(); | 
					
						
							|  |  |  |         expect(CompileDirectiveMetadata.fromJson(empty.toJson())).toEqual(empty); | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     describe('TypeMetadata', () => { | 
					
						
							|  |  |  |       it('should serialize with full data', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         expect(CompileTypeMetadata.fromJson(fullTypeMeta.toJson())).toEqual(fullTypeMeta); | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should serialize with no data', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         var empty = new CompileTypeMetadata(); | 
					
						
							|  |  |  |         expect(CompileTypeMetadata.fromJson(empty.toJson())).toEqual(empty); | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     describe('TemplateMetadata', () => { | 
					
						
							| 
									
										
										
										
											2015-10-05 09:49:05 -07:00
										 |  |  |       it('should use ViewEncapsulation.Emulated by default', () => { | 
					
						
							|  |  |  |         expect(new CompileTemplateMetadata({encapsulation: null}).encapsulation) | 
					
						
							|  |  |  |             .toBe(ViewEncapsulation.Emulated); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       it('should serialize with full data', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         expect(CompileTemplateMetadata.fromJson(fullTemplateMeta.toJson())) | 
					
						
							|  |  |  |             .toEqual(fullTemplateMeta); | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should serialize with no data', () => { | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |         var empty = new CompileTemplateMetadata(); | 
					
						
							|  |  |  |         expect(CompileTemplateMetadata.fromJson(empty.toJson())).toEqual(empty); | 
					
						
							| 
									
										
										
										
											2015-09-11 13:35:46 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-10-02 07:37:23 -07:00
										 |  |  | } |