fix(compiler): fix Elements not making a new ParseSourceSpan (#31190)
Change the Element constructor in r3_ast to create a new ParseSourceSpan when regenerating it rather than extending an object, which does not contain the overloaded toString(). PR Close #31190
This commit is contained in:

committed by
Kara Erickson

parent
9c06af2dfc
commit
7035f225ad
@ -95,7 +95,17 @@ function expectFromR3Nodes(nodes: t.Node[]) {
|
||||
return expect(humanizer.result);
|
||||
}
|
||||
|
||||
function expectSpanFromHtml(html: string) {
|
||||
const {nodes} = parse(html);
|
||||
return expect(nodes[0] !.sourceSpan.toString());
|
||||
}
|
||||
|
||||
describe('R3 template transform', () => {
|
||||
describe('ParseSpan on nodes toString', () => {
|
||||
it('should create valid text span on Element with adjacent start and end tags',
|
||||
() => { expectSpanFromHtml('<div></div>').toBe('<div></div>'); });
|
||||
});
|
||||
|
||||
describe('Nodes without binding', () => {
|
||||
it('should parse text nodes', () => {
|
||||
expectFromHtml('a').toEqual([
|
||||
|
Reference in New Issue
Block a user