diff --git a/packages/compiler/test/ml_parser/ast_spec_utils.ts b/packages/compiler/test/ml_parser/ast_spec_utils.ts index ce8b6750fd..818ae726ce 100644 --- a/packages/compiler/test/ml_parser/ast_spec_utils.ts +++ b/packages/compiler/test/ml_parser/ast_spec_utils.ts @@ -87,10 +87,6 @@ class _Humanizer implements html.Visitor { private _appendContext(ast: html.Node, input: any[]): any[] { if (!this.includeSourceSpan) return input; input.push(ast.sourceSpan.toString()); - if (ast.sourceSpan.fullStart.offset !== ast.sourceSpan.start.offset) { - input.push(ast.sourceSpan.fullStart.file.content.substring( - ast.sourceSpan.fullStart.offset, ast.sourceSpan.end.offset)); - } return input; } } diff --git a/packages/compiler/test/ml_parser/html_parser_spec.ts b/packages/compiler/test/ml_parser/html_parser_spec.ts index 01562f53cf..57171d5f40 100644 --- a/packages/compiler/test/ml_parser/html_parser_spec.ts +++ b/packages/compiler/test/ml_parser/html_parser_spec.ts @@ -798,23 +798,22 @@ import {humanizeDom, humanizeDomSourceSpans, humanizeLineColumn, humanizeNodes} ]); }); - it('should not include leading trivia from the following node of an element in the end source', - () => { - expect(humanizeDomSourceSpans( - parser.parse('\n\n\n \n', 'TestComp', { - leadingTriviaChars: [' ', '\n', '\r', '\t'], - }))) - .toEqual([ - [ - html.Element, 'input', 0, '', '', - '' - ], - [html.Attribute, 'type', 'text', ['text'], 'type="text"'], - [html.Text, '\n\n\n ', 0, ['\n\n\n '], '', '\n\n\n '], - [html.Element, 'span', 0, '\n', '', ''], - [html.Text, '\n', 1, ['\n'], '', '\n'], - ]); - }); + it('should set the end source span excluding trailing whitespace whitespace', () => { + expect(humanizeDomSourceSpans( + parser.parse('\n\n\n \n', 'TestComp', { + leadingTriviaChars: [' ', '\n', '\r', '\t'], + }))) + .toEqual([ + [ + html.Element, 'input', 0, '', '', + '' + ], + [html.Attribute, 'type', 'text', ['text'], 'type="text"'], + [html.Text, '\n\n\n ', 0, ['\n\n\n '], ''], + [html.Element, 'span', 0, '\n', '', ''], + [html.Text, '\n', 1, ['\n'], ''], + ]); + }); it('should not set the end source span for elements that are implicitly closed', () => { expect(humanizeDomSourceSpans(parser.parse('

', 'TestComp'))).toEqual([