File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,36 @@ describe('ssr: slot', () => {
49
49
) . toBe ( `<div><!--[--><!--]--></div>` )
50
50
} )
51
51
52
+ test ( 'empty slot (manual comments)' , async ( ) => {
53
+ expect (
54
+ await renderToString (
55
+ createApp ( {
56
+ components : {
57
+ one : {
58
+ template : `<div><slot/></div>`
59
+ }
60
+ } ,
61
+ template : `<one><!--hello--></one>`
62
+ } )
63
+ )
64
+ ) . toBe ( `<div><!--[--><!--]--></div>` )
65
+ } )
66
+
67
+ test ( 'empty slot (multi-line comments)' , async ( ) => {
68
+ expect (
69
+ await renderToString (
70
+ createApp ( {
71
+ components : {
72
+ one : {
73
+ template : `<div><slot/></div>`
74
+ }
75
+ } ,
76
+ template : `<one><!--he\nllo--></one>`
77
+ } )
78
+ )
79
+ ) . toBe ( `<div><!--[--><!--]--></div>` )
80
+ } )
81
+
52
82
test ( 'multiple elements' , async ( ) => {
53
83
expect (
54
84
await renderToString (
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ export function ssrRenderSlotInner(
82
82
}
83
83
}
84
84
85
- const commentRE = / < ! - - . * ?- - > / g
85
+ const commentRE = / < ! - - [ ^ ] * ?- - > / gm
86
86
function isComment ( item : SSRBufferItem ) {
87
87
return (
88
88
typeof item === 'string' &&
You can’t perform that action at this time.
0 commit comments