From 6f05dd80624d91260f986462ac0240d3eb654047 Mon Sep 17 00:00:00 2001 From: atscott Date: Tue, 3 Aug 2021 14:48:56 -0700 Subject: [PATCH] Revert "test(compiler): check `fullStart` source-span (#42062)" (#43033) This reverts commit 973f9b8d1957d5479f5813664d35fd445f38e525. PR Close #43033 --- .../compiler/test/ml_parser/ast_spec_utils.ts | 4 --- .../test/ml_parser/html_parser_spec.ts | 33 +++++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) 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([