File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export function template(templateSpec, env) {
116116 // Just add water
117117 let container = {
118118 strict : function ( obj , name , loc ) {
119- if ( ! obj || ! ( name in obj ) ) {
119+ if ( ! obj || ( typeof obj === 'object' && ! ( name in obj ) ) ) {
120120 throw new Exception ( '"' + name + '" not defined in ' + obj , {
121121 loc : loc ,
122122 } ) ;
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ describe('strict', function () {
4848 } ) ;
4949
5050 xt . toThrow ( Error ) ;
51-
5251 xt . withRuntimeOptions ( { data : { hello : 'foo' } } ) . toCompileTo ( 'foo' ) ;
5352 } ) ;
5453
@@ -87,9 +86,7 @@ describe('strict', function () {
8786
8887 it ( 'should allow undefined hash when passed to helpers' , function ( ) {
8988 expectTemplate ( '{{helper value=@foo}}' )
90- . withCompileOptions ( {
91- strict : true ,
92- } )
89+ . withCompileOptions ( { strict : true } )
9390 . withHelpers ( {
9491 helper : function ( options ) {
9592 equals ( 'value' in options . hash , true ) ;
@@ -100,6 +97,13 @@ describe('strict', function () {
10097 . toCompileTo ( 'success' ) ;
10198 } ) ;
10299
100+ it ( 'should allow compat-mode combined with strict-mode' , function ( ) {
101+ expectTemplate ( 'Foo {{bar}}' )
102+ . withCompileOptions ( { compat : true , strict : true } )
103+ . withInput ( { bar : 'baz' } )
104+ . toCompileTo ( 'Foo baz' ) ;
105+ } ) ;
106+
103107 it ( 'should show error location on missing property lookup' , function ( ) {
104108 expectTemplate ( '\n\n\n {{hello}}' )
105109 . withCompileOptions ( { strict : true } )
You can’t perform that action at this time.
0 commit comments