Skip to content

Commit

Permalink
fix(ssr): fix adjacent text node concatenation (#4974)
Browse files Browse the repository at this point in the history
Co-authored-by: Will Harney <[email protected]>
Co-authored-by: John Hefferman <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent 358d89b commit 19b11e4
Show file tree
Hide file tree
Showing 137 changed files with 380 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span>{foo}{bar}{baz}{foo}{bar}{baz}{foo}{bar}{baz}<!--lala--><!--hahaha--><!--yolo--></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
<div>
</div>
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span>{foo}{bar}{baz}<!--a--><!--b--><!--c--><div></div></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<div>
abc
</div>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<div>
a
<template if:true={isTrue}>
b
</template>
c
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
isTrue = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<x-comments-text>
<template shadowrootmode="open">
ab
<div>
c
</div>
de
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
a
<template if:true={isTrue}>
b
<div>c</div>
d
</template>
e
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
isTrue = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span>{foo}{bar}{baz}{foo}{bar}{baz}{foo}{bar}{baz}</span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
&amp;minus;
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span>{foo}</span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '&minus;';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
&amp;minus;
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '&';
bar = 'minus';
baz = ';';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span><!--a--><!--b--><!--c--></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span>{foo}{bar}{baz}</span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
totoyolototoyolo
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span>toto{foo}yolo{bar}toto{baz}yolo</span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<span><!--a-->{foo}<!--b-->{bar}<!--c-->{baz}<!--d-->{foo}<!--e--></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
<!--a-->
<!--b-->
<!--c-->
<div>
</div>
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:preserve-comments>
<span>{foo}{bar}{baz}<!--a--><!--b--><!--c--><div></div></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
<!--a-->
<!--b-->
<!--c-->
<!--d-->
<!--e-->
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:preserve-comments>
<span><!--a-->{foo}<!--b-->{bar}<!--c-->{baz}<!--d-->{foo}<!--e--></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
<!--lala-->
<!--hahaha-->
<!--yolo-->
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:preserve-comments>
<span>{foo}{bar}{baz}{foo}{bar}{baz}{foo}{bar}{baz}<!--lala--><!--hahaha--><!--yolo--></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
foo = '';
bar = undefined;
baz = null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<x-comments-text>
<template shadowrootmode="open">
<span>
<!--a-->
<!--b-->
<!--c-->
</span>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template lwc:preserve-comments>
<span><!--a--><!--b--><!--c--></span>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
// We should slowly drive down these test failures or at least document where we expect the failures
// TODO [#4815]: enable all SSR v2 tests
export const expectedFailures = new Set([
'adjacent-text-nodes/empty/index.js',
'adjacent-text-nodes/with-comments/empty1/index.js',
'adjacent-text-nodes/with-comments/empty2/index.js',
'adjacent-text-nodes/with-comments/empty3/index.js',
'adjacent-text-nodes/with-comments/preserve-comments2/index.js',
'adjacent-text-nodes/preserve-comments-off/deep2/index.js',
'attribute-aria/dynamic/index.js',
'attribute-class/with-scoped-styles-only-in-child/dynamic/index.js',
'attribute-class/with-scoped-styles/dynamic/index.js',
Expand All @@ -34,6 +30,7 @@ export const expectedFailures = new Set([
'scoped-slots/mixed-with-light-dom-slots-inside/index.js',
'scoped-slots/mixed-with-light-dom-slots-outside/index.js',
'slot-forwarding/scoped-slots/index.js',
'slot-not-at-top-level/advanced/ifTrue/light/index.js',
'slot-not-at-top-level/advanced/ifTrue/shadow/index.js',
'slot-not-at-top-level/advanced/lwcIf/light/index.js',
'slot-not-at-top-level/advanced/lwcIf/shadow/index.js',
Expand Down
Loading

0 comments on commit 19b11e4

Please sign in to comment.