File tree Expand file tree Collapse file tree 6 files changed +75
-0
lines changed
Expand file tree Collapse file tree 6 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 100100 "template" : " \" {{&power}} jiggawatts!\" " ,
101101 "expected" : " \" 1.21 jiggawatts!\" "
102102 },
103+ {
104+ "name" : " Basic Null Interpolation" ,
105+ "desc" : " Nulls should interpolate as the empty string." ,
106+ "data" : {
107+ "cannot" : null
108+ },
109+ "template" : " I ({{cannot}}) be seen!" ,
110+ "expected" : " I () be seen!"
111+ },
112+ {
113+ "name" : " Triple Mustache Null Interpolation" ,
114+ "desc" : " Nulls should interpolate as the empty string." ,
115+ "data" : {
116+ "cannot" : null
117+ },
118+ "template" : " I ({{{cannot}}}) be seen!" ,
119+ "expected" : " I () be seen!"
120+ },
121+ {
122+ "name" : " Ampersand Null Interpolation" ,
123+ "desc" : " Nulls should interpolate as the empty string." ,
124+ "data" : {
125+ "cannot" : null
126+ },
127+ "template" : " I ({{&cannot}}) be seen!" ,
128+ "expected" : " I () be seen!"
129+ },
103130 {
104131 "name" : " Basic Context Miss Interpolation" ,
105132 "desc" : " Failed context lookups should default to empty strings." ,
Original file line number Diff line number Diff line change @@ -101,6 +101,24 @@ tests:
101101 template : ' "{{&power}} jiggawatts!"'
102102 expected : ' "1.21 jiggawatts!"'
103103
104+ - name : Basic Null Interpolation
105+ desc : Nulls should interpolate as the empty string.
106+ data : { cannot: null }
107+ template : " I ({{cannot}}) be seen!"
108+ expected : " I () be seen!"
109+
110+ - name : Triple Mustache Null Interpolation
111+ desc : Nulls should interpolate as the empty string.
112+ data : { cannot: null }
113+ template : " I ({{{cannot}}}) be seen!"
114+ expected : " I () be seen!"
115+
116+ - name : Ampersand Null Interpolation
117+ desc : Nulls should interpolate as the empty string.
118+ data : { cannot: null }
119+ template : " I ({{&cannot}}) be seen!"
120+ expected : " I () be seen!"
121+
104122 # Context Misses
105123
106124 - name : Basic Context Miss Interpolation
Original file line number Diff line number Diff line change 2020 "template" : " \" {{^boolean}}This should not be rendered.{{/boolean}}\" " ,
2121 "expected" : " \"\" "
2222 },
23+ {
24+ "name" : " Null is falsey" ,
25+ "desc" : " Null is falsey." ,
26+ "data" : {
27+ "null" : null
28+ },
29+ "template" : " \" {{^null}}This should be rendered.{{/null}}\" " ,
30+ "expected" : " \" This should be rendered.\" "
31+ },
2332 {
2433 "name" : " Context" ,
2534 "desc" : " Objects and hashes should behave like truthy values." ,
Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ tests:
4646 template : ' "{{^boolean}}This should not be rendered.{{/boolean}}"'
4747 expected : ' ""'
4848
49+ - name : Null is falsey
50+ desc : Null is falsey.
51+ data : { "null": null }
52+ template : ' "{{^null}}This should be rendered.{{/null}}"'
53+ expected : ' "This should be rendered."'
54+
4955 - name : Context
5056 desc : Objects and hashes should behave like truthy values.
5157 data : { context: { name: 'Joe' } }
Original file line number Diff line number Diff line change 2020 "template" : " \" {{#boolean}}This should not be rendered.{{/boolean}}\" " ,
2121 "expected" : " \"\" "
2222 },
23+ {
24+ "name" : " Null is falsey" ,
25+ "desc" : " Null is falsey." ,
26+ "data" : {
27+ "null" : null
28+ },
29+ "template" : " \" {{#null}}This should not be rendered.{{/null}}\" " ,
30+ "expected" : " \"\" "
31+ },
2332 {
2433 "name" : " Context" ,
2534 "desc" : " Objects and hashes should be pushed onto the context stack." ,
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ tests:
4747 template : ' "{{#boolean}}This should not be rendered.{{/boolean}}"'
4848 expected : ' ""'
4949
50+ - name : Null is falsey
51+ desc : Null is falsey.
52+ data : { "null": null }
53+ template : ' "{{#null}}This should not be rendered.{{/null}}"'
54+ expected : ' ""'
55+
5056 - name : Context
5157 desc : Objects and hashes should be pushed onto the context stack.
5258 data : { context: { name: 'Joe' } }
You can’t perform that action at this time.
0 commit comments