@@ -121,6 +121,50 @@ describe('strict', function () {
121121 } ) ;
122122 } ) ;
123123
124+ describe ( 'strict and compat mode' , function ( ) {
125+ it ( 'GH-2149: should render correctly when block context is a boolean' , function ( ) {
126+ expectTemplate ( '{{#foo}}Hello {{bar}}{{/foo}}' )
127+ . withCompileOptions ( { strict : true , compat : true } )
128+ . withInput ( { foo : true , bar : 'World' } )
129+ . toCompileTo ( 'Hello World' ) ;
130+ } ) ;
131+
132+ it ( 'GH-2149: should render correctly when looking up a property on each item' , function ( ) {
133+ expectTemplate ( '{{#each items}}{{name}}{{/each}}' )
134+ . withCompileOptions ( { strict : true , compat : true } )
135+ . withInput ( { items : [ { name : 'Hello' } ] } )
136+ . toCompileTo ( 'Hello' ) ;
137+ } ) ;
138+
139+ it ( 'should still throw when a property is missing at all depths' , function ( ) {
140+ expectTemplate ( '{{#each items}}{{name}}{{/each}}' )
141+ . withCompileOptions ( { strict : true , compat : true } )
142+ . withInput ( { items : [ 1 , 2 ] } )
143+ . toThrow ( Exception , / " n a m e " n o t d e f i n e d i n / ) ;
144+ } ) ;
145+
146+ it ( 'should still perform recursive lookup when a property is not in the current context' , function ( ) {
147+ expectTemplate ( '{{#each items}}{{name}}{{/each}}' )
148+ . withCompileOptions ( { strict : true , compat : true } )
149+ . withInput ( { name : 'root' , items : [ { } ] } )
150+ . toCompileTo ( 'root' ) ;
151+ } ) ;
152+
153+ it ( 'should still perform recursive lookup with a multi-part path not in context' , function ( ) {
154+ expectTemplate ( '{{#with child}}{{name.first}}{{/with}}' )
155+ . withCompileOptions ( { strict : true , compat : true } )
156+ . withInput ( { name : { first : 'root' } , child : { name : null } } )
157+ . toCompileTo ( 'root' ) ;
158+ } ) ;
159+
160+ it ( 'should directly return an explicitly null property' , function ( ) {
161+ expectTemplate ( '{{#each items}}{{name}}{{/each}}' )
162+ . withCompileOptions ( { strict : true , compat : true } )
163+ . withInput ( { name : 'root' , items : [ { name : null } ] } )
164+ . toCompileTo ( '' ) ;
165+ } ) ;
166+ } ) ;
167+
124168 describe ( 'assume objects' , function ( ) {
125169 it ( 'should ignore missing property' , function ( ) {
126170 expectTemplate ( '{{hello}}' )
0 commit comments