@@ -918,6 +918,25 @@ describe('R3 template transform', () => {
918918 ] ) ;
919919 } ) ;
920920
921+ it ( 'should parse a deferred block with comments between the connected blocks' , ( ) => {
922+ expectFromHtml (
923+ '@defer {<calendar-cmp [date]="current"/>}' +
924+ '<!-- Show this while loading --> @loading {Loading...}' +
925+ '<!-- Show this on the server --> @placeholder {Placeholder content!}' +
926+ '<!-- Show this on error --> @error {Loading failed :(}' ,
927+ ) . toEqual ( [
928+ [ 'DeferredBlock' ] ,
929+ [ 'Element' , 'calendar-cmp' ] ,
930+ [ 'BoundAttribute' , 0 , 'date' , 'current' ] ,
931+ [ 'DeferredBlockPlaceholder' ] ,
932+ [ 'Text' , 'Placeholder content!' ] ,
933+ [ 'DeferredBlockLoading' ] ,
934+ [ 'Text' , 'Loading...' ] ,
935+ [ 'DeferredBlockError' ] ,
936+ [ 'Text' , 'Loading failed :(' ] ,
937+ ] ) ;
938+ } ) ;
939+
921940 it (
922941 'should parse a deferred block with connected blocks that have an arbitrary ' +
923942 'amount of whitespace between them when preserveWhitespaces is enabled' ,
@@ -2070,6 +2089,31 @@ describe('R3 template transform', () => {
20702089 ] ) ;
20712090 } ) ;
20722091
2092+ it ( 'should parse an if block containing comments between the branches' , ( ) => {
2093+ expectFromHtml ( `
2094+ @if (cond.expr; as foo) {
2095+ Main case was true!
2096+ }
2097+ <!-- Extra case -->
2098+ @else if (other.expr) {
2099+ Extra case was true!
2100+ }
2101+ <!-- False case -->
2102+ @else {
2103+ False case!
2104+ }
2105+ ` ) . toEqual ( [
2106+ [ 'IfBlock' ] ,
2107+ [ 'IfBlockBranch' , 'cond.expr' ] ,
2108+ [ 'Variable' , 'foo' , 'foo' ] ,
2109+ [ 'Text' , ' Main case was true! ' ] ,
2110+ [ 'IfBlockBranch' , 'other.expr' ] ,
2111+ [ 'Text' , ' Extra case was true! ' ] ,
2112+ [ 'IfBlockBranch' , null ] ,
2113+ [ 'Text' , ' False case! ' ] ,
2114+ ] ) ;
2115+ } ) ;
2116+
20732117 describe ( 'validations' , ( ) => {
20742118 it ( 'should report an if block without a condition' , ( ) => {
20752119 expect ( ( ) =>
0 commit comments