File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ function isEmptyNode ( node ) {
2+ return (
3+ node . type === 'GlimmerMustacheCommentStatement' ||
4+ node . type === 'GlimmerCommentStatement' ||
5+ ( node . type === 'GlimmerTextNode' && ! node . chars . trim ( ) )
6+ ) ;
7+ }
8+
19function isYieldOnly ( node ) {
210 return (
311 node . type === 'GlimmerMustacheStatement' &&
@@ -44,7 +52,8 @@ module.exports = {
4452 ? node . body [ 0 ] . children
4553 : node . body ;
4654
47- if ( templateNodes . length === 1 && isYieldOnly ( templateNodes [ 0 ] ) ) {
55+ const nonEmptyNodes = templateNodes . filter ( ( n ) => ! isEmptyNode ( n ) ) ;
56+ if ( nonEmptyNodes . length === 1 && isYieldOnly ( nonEmptyNodes [ 0 ] ) ) {
4857 isOnlyYield = true ;
4958 }
5059 } ,
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ const invalidHbs = [
3030 output : null ,
3131 errors : [ { messageId : 'noYieldOnly' } ] ,
3232 } ,
33+ {
34+ code : '{{!-- long-form comment --}}{{yield}}' ,
35+ output : null ,
36+ errors : [ { messageId : 'noYieldOnly' } ] ,
37+ } ,
38+ {
39+ code : '<!-- html comment -->{{yield}}' ,
40+ output : null ,
41+ errors : [ { messageId : 'noYieldOnly' } ] ,
42+ } ,
3343] ;
3444
3545function wrapTemplate ( entry ) {
You can’t perform that action at this time.
0 commit comments