File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,13 @@ h1 { color: red }
111
111
)
112
112
} )
113
113
114
- test ( 'should ignore nodes with no content' , ( ) => {
115
- expect ( parse ( `<template/>` ) . descriptor . template ) . toBe ( null )
114
+ test ( 'should keep template nodes with no content' , ( ) => {
115
+ const { descriptor } = parse ( `<template/>` )
116
+ expect ( descriptor . template ) . toBeTruthy ( )
117
+ expect ( descriptor . template ! . content ) . toBeFalsy ( )
118
+ } )
119
+
120
+ test ( 'should ignore other nodes with no content' , ( ) => {
116
121
expect ( parse ( `<script/>` ) . descriptor . script ) . toBe ( null )
117
122
expect ( parse ( `<style/>` ) . descriptor . styles . length ) . toBe ( 0 )
118
123
expect ( parse ( `<custom/>` ) . descriptor . customBlocks . length ) . toBe ( 0 )
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ export function parse(
138
138
if ( node . type !== NodeTypes . ELEMENT ) {
139
139
return
140
140
}
141
- if ( ! node . children . length && ! hasSrc ( node ) ) {
141
+ if ( ! node . children . length && ! hasSrc ( node ) && node . tag !== 'template' ) {
142
142
return
143
143
}
144
144
switch ( node . tag ) {
You can’t perform that action at this time.
0 commit comments