mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix: default filter is not working with an empty string, #122
This commit is contained in:
@@ -2,7 +2,12 @@ import { test } from '../../../stub/render'
|
||||
|
||||
describe('filters/object', function () {
|
||||
describe('default', function () {
|
||||
it('should use default when falsy', () => test('{{false |default: "a"}}', 'a'))
|
||||
it('should not use default when truthy', () => test('{{true |default: "a"}}', 'true'))
|
||||
it('false should use default', () => test('{{false | default: "a"}}', 'a'))
|
||||
it('empty string should use default', () => test('{{"" | default: "a"}}', 'a'))
|
||||
it('non-empty string should not use default', () => test('{{" " | default: "a"}}', ' '))
|
||||
it('nil should use default', () => test('{{nil | default: "a"}}', 'a'))
|
||||
it('undefined should use default', () => test('{{not_defined | default: "a"}}', 'a'))
|
||||
it('true should not use default', () => test('{{true | default: "a"}}', 'true'))
|
||||
it('0 should not use default', () => test('{{0 | default: "a"}}', '0'))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user