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) {
116
116
// Just add water
117
117
let container = {
118
118
strict : function ( obj , name , loc ) {
119
- if ( ! obj || ! ( name in obj ) ) {
119
+ if ( ! obj || ( typeof obj === 'object' && ! ( name in obj ) ) ) {
120
120
throw new Exception ( '"' + name + '" not defined in ' + obj , {
121
121
loc : loc ,
122
122
} ) ;
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ describe('strict', function () {
48
48
} ) ;
49
49
50
50
xt . toThrow ( Error ) ;
51
-
52
51
xt . withRuntimeOptions ( { data : { hello : 'foo' } } ) . toCompileTo ( 'foo' ) ;
53
52
} ) ;
54
53
@@ -87,9 +86,7 @@ describe('strict', function () {
87
86
88
87
it ( 'should allow undefined hash when passed to helpers' , function ( ) {
89
88
expectTemplate ( '{{helper value=@foo}}' )
90
- . withCompileOptions ( {
91
- strict : true ,
92
- } )
89
+ . withCompileOptions ( { strict : true } )
93
90
. withHelpers ( {
94
91
helper : function ( options ) {
95
92
equals ( 'value' in options . hash , true ) ;
@@ -100,6 +97,13 @@ describe('strict', function () {
100
97
. toCompileTo ( 'success' ) ;
101
98
} ) ;
102
99
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
+
103
107
it ( 'should show error location on missing property lookup' , function ( ) {
104
108
expectTemplate ( '\n\n\n {{hello}}' )
105
109
. withCompileOptions ( { strict : true } )
You can’t perform that action at this time.
0 commit comments