| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   el, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   inject, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  |   TestComponentBuilder | 
					
						
							|  |  |  | } from 'angular2/test_lib'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | import {IS_DART} from '../platform'; | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  | import {escapeSingleQuoteString, escapeDoubleQuoteString} from 'angular2/src/compiler/util'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function main() { | 
					
						
							|  |  |  |   describe('util', () => { | 
					
						
							|  |  |  |     describe('escapeSingleQuoteString', () => { | 
					
						
							|  |  |  |       it('should escape single quotes', | 
					
						
							|  |  |  |          () => { expect(escapeSingleQuoteString(`'`)).toEqual(`'\\''`); }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should escape backslash', | 
					
						
							|  |  |  |          () => { expect(escapeSingleQuoteString('\\')).toEqual(`'\\\\'`); }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should escape newlines', | 
					
						
							|  |  |  |          () => { expect(escapeSingleQuoteString('\n')).toEqual(`'\\n'`); }); | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       if (IS_DART) { | 
					
						
							|  |  |  |         it('should escape $', () => { expect(escapeSingleQuoteString('$')).toEqual(`'\\$'`); }); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         it('should not escape $', () => { expect(escapeSingleQuoteString('$')).toEqual(`'$'`); }); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     describe('escapeDoubleQuoteString', () => { | 
					
						
							|  |  |  |       it('should escape double quotes', | 
					
						
							|  |  |  |          () => { expect(escapeDoubleQuoteString(`"`)).toEqual(`"\\""`); }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should escape backslash', | 
					
						
							|  |  |  |          () => { expect(escapeDoubleQuoteString('\\')).toEqual(`"\\\\"`); }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should escape newlines', | 
					
						
							|  |  |  |          () => { expect(escapeDoubleQuoteString('\n')).toEqual(`"\\n"`); }); | 
					
						
							| 
									
										
										
										
											2015-09-18 10:33:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       if (IS_DART) { | 
					
						
							|  |  |  |         it('should escape $', () => { expect(escapeDoubleQuoteString('$')).toEqual(`"\\$"`); }); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         it('should not escape $', () => { expect(escapeDoubleQuoteString('$')).toEqual(`"$"`); }); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2015-09-11 13:37:05 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } |