diff --git a/packages/compiler/test/ml_parser/html_parser_spec.ts b/packages/compiler/test/ml_parser/html_parser_spec.ts index a47d29ca3b..cbe283d056 100644 --- a/packages/compiler/test/ml_parser/html_parser_spec.ts +++ b/packages/compiler/test/ml_parser/html_parser_spec.ts @@ -274,6 +274,33 @@ import {humanizeDom, humanizeDomSourceSpans, humanizeLineColumn, humanizeNodes} ]); }); + it('should parse attributes containing unquoted interpolation', () => { + expect(humanizeDom(parser.parse('
', 'TestComp'))).toEqual([ + [html.Element, 'div', 0], + [html.Attribute, 'foo', '{{message}}', [''], ['{{', 'message', '}}'], ['']] + ]); + }); + + it('should parse bound inputs with expressions containing newlines', () => { + expect(humanizeDom(parser.parse( + ``, + 'TestComp'))) + .toEqual([ + [html.Element, 'app-component', 0], + [ + html.Attribute, '[attr]', `[ + {text: 'some text',url:'//www.google.com'}, + {text:'other text',url:'//www.google.com'}]`, + [`[ + {text: 'some text',url:'//www.google.com'}, + {text:'other text',url:'//www.google.com'}]`] + ], + ]); + }); + it('should parse attributes containing encoded entities', () => { expect(humanizeDom(parser.parse('
', 'TestComp'))).toEqual([ [html.Element, 'div', 0], diff --git a/packages/compiler/test/ml_parser/lexer_spec.ts b/packages/compiler/test/ml_parser/lexer_spec.ts index 5f6e7c317d..b0256a5816 100644 --- a/packages/compiler/test/ml_parser/lexer_spec.ts +++ b/packages/compiler/test/ml_parser/lexer_spec.ts @@ -407,6 +407,27 @@ import {ParseLocation, ParseSourceFile, ParseSourceSpan} from '../../src/parse_u ]); }); + it('should parse bound inputs with expressions containing newlines', () => { + expect(tokenizeAndHumanizeParts(``)) + .toEqual([ + [TokenType.TAG_OPEN_START, '', 'app-component'], + [TokenType.ATTR_NAME, '', '[attr]'], + [TokenType.ATTR_QUOTE, '"'], + [ + TokenType.ATTR_VALUE_TEXT, + '[\n' + + ' {text: \'some text\',url:\'//www.google.com\'},\n' + + ' {text:\'other text\',url:\'//www.google.com\'}]' + ], + [TokenType.ATTR_QUOTE, '"'], + [TokenType.TAG_OPEN_END], + [TokenType.EOF], + ]); + }); + it('should parse attributes with empty quoted value', () => { expect(tokenizeAndHumanizeParts('')).toEqual([ [TokenType.TAG_OPEN_START, '', 't'],