| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   xdescribe, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							|  |  |  |   afterEach, | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							|  |  |  |   inject, | 
					
						
							|  |  |  |   beforeEachBindings | 
					
						
							| 
									
										
										
										
											2015-10-13 00:29:13 -07:00
										 |  |  | } from 'angular2/testing_internal'; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-05 14:07:57 -08:00
										 |  |  | import {HtmlParser} from 'angular2/src/compiler/html_parser'; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   preparseElement, | 
					
						
							|  |  |  |   PreparsedElementType, | 
					
						
							|  |  |  |   PreparsedElement | 
					
						
							| 
									
										
										
										
											2015-11-05 14:07:57 -08:00
										 |  |  | } from 'angular2/src/compiler/template_preparser'; | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function main() { | 
					
						
							|  |  |  |   describe('preparseElement', () => { | 
					
						
							|  |  |  |     var htmlParser; | 
					
						
							|  |  |  |     beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => { htmlParser = _htmlParser; })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function preparse(html: string): PreparsedElement { | 
					
						
							| 
									
										
										
										
											2015-10-07 09:34:21 -07:00
										 |  |  |       return preparseElement(htmlParser.parse(html, '').rootNodes[0]); | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should detect script elements', inject([HtmlParser], (htmlParser: HtmlParser) => { | 
					
						
							|  |  |  |          expect(preparse('<script>').type).toBe(PreparsedElementType.SCRIPT); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should detect style elements', inject([HtmlParser], (htmlParser: HtmlParser) => { | 
					
						
							|  |  |  |          expect(preparse('<style>').type).toBe(PreparsedElementType.STYLE); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should detect stylesheet elements', inject([HtmlParser], (htmlParser: HtmlParser) => { | 
					
						
							|  |  |  |          expect(preparse('<link rel="stylesheet">').type).toBe(PreparsedElementType.STYLESHEET); | 
					
						
							|  |  |  |          expect(preparse('<link rel="stylesheet" href="someUrl">').hrefAttr).toEqual('someUrl'); | 
					
						
							|  |  |  |          expect(preparse('<link rel="someRel">').type).toBe(PreparsedElementType.OTHER); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should detect ng-content elements', inject([HtmlParser], (htmlParser: HtmlParser) => { | 
					
						
							|  |  |  |          expect(preparse('<ng-content>').type).toBe(PreparsedElementType.NG_CONTENT); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should normalize ng-content.select attribute', | 
					
						
							|  |  |  |        inject([HtmlParser], (htmlParser: HtmlParser) => { | 
					
						
							|  |  |  |          expect(preparse('<ng-content>').selectAttr).toEqual('*'); | 
					
						
							|  |  |  |          expect(preparse('<ng-content select>').selectAttr).toEqual('*'); | 
					
						
							|  |  |  |          expect(preparse('<ng-content select="*">').selectAttr).toEqual('*'); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-10-02 07:57:29 -07:00
										 |  |  | } |