Revert "test(compiler): check `fullStart` source-span (#42062)" (#43033)

This reverts commit 973f9b8d19.

PR Close #43033
This commit is contained in:
atscott 2021-08-03 14:48:56 -07:00
parent dd82bbfa27
commit 6f05dd8062
2 changed files with 16 additions and 21 deletions

View File

@ -87,10 +87,6 @@ class _Humanizer implements html.Visitor {
private _appendContext(ast: html.Node, input: any[]): any[] { private _appendContext(ast: html.Node, input: any[]): any[] {
if (!this.includeSourceSpan) return input; if (!this.includeSourceSpan) return input;
input.push(ast.sourceSpan.toString()); 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; return input;
} }
} }

View File

@ -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', it('should set the end source span excluding trailing whitespace whitespace', () => {
() => { expect(humanizeDomSourceSpans(
expect(humanizeDomSourceSpans( parser.parse('<input type="text" />\n\n\n <span>\n</span>', 'TestComp', {
parser.parse('<input type="text" />\n\n\n <span>\n</span>', 'TestComp', { leadingTriviaChars: [' ', '\n', '\r', '\t'],
leadingTriviaChars: [' ', '\n', '\r', '\t'], })))
}))) .toEqual([
.toEqual([ [
[ html.Element, 'input', 0, '<input type="text" />', '<input type="text" />',
html.Element, 'input', 0, '<input type="text" />', '<input type="text" />', '<input type="text" />'
'<input type="text" />' ],
], [html.Attribute, 'type', 'text', ['text'], 'type="text"'],
[html.Attribute, 'type', 'text', ['text'], 'type="text"'], [html.Text, '\n\n\n ', 0, ['\n\n\n '], ''],
[html.Text, '\n\n\n ', 0, ['\n\n\n '], '', '\n\n\n '], [html.Element, 'span', 0, '<span>\n</span>', '<span>', '</span>'],
[html.Element, 'span', 0, '<span>\n</span>', '<span>', '</span>'], [html.Text, '\n', 1, ['\n'], ''],
[html.Text, '\n', 1, ['\n'], '', '\n'], ]);
]); });
});
it('should not set the end source span for elements that are implicitly closed', () => { it('should not set the end source span for elements that are implicitly closed', () => {
expect(humanizeDomSourceSpans(parser.parse('<div><p></div>', 'TestComp'))).toEqual([ expect(humanizeDomSourceSpans(parser.parse('<div><p></div>', 'TestComp'))).toEqual([