Skip to content

Commit 2149183

Browse files
committed
test: if key not exists in locals, issue #102
1 parent d9dd85c commit 2149183

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

test/expect/conditional_if_key_not_exists.html

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<if condition="key_not_exists">
2+
it works!
3+
</if>

test/test-conditionals.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ function process (t, name, options, log = false) {
2727
})
2828
}
2929

30-
function error (name, cb) {
31-
return posthtml([expressions()])
30+
function error (name, cb, options) {
31+
return posthtml([expressions(options)])
3232
.process(fixture(name))
3333
.catch(cb)
3434
}
@@ -75,6 +75,10 @@ test('conditional - expression error', (t) => {
7575
})
7676
})
7777

78+
test('Conditionals - if key exists in locals', (t) => {
79+
return process(t, 'conditional_if_key_not_exists', { strictMode: false })
80+
})
81+
7882
test('Conditionals - custom tags', (t) => {
7983
return process(t, 'conditional_customtags', {
8084
conditionalTags: ['zif', 'zelseif', 'zelse'],

0 commit comments

Comments
 (0)