mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix default filter
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ var filters = {
|
||||
if (v === 'now') v = new Date();
|
||||
return strftime(v, arg);
|
||||
},
|
||||
'default': (v, arg) => arg || v,
|
||||
'default': (v, arg) => v || arg,
|
||||
'divided_by': (v, arg) => Math.floor(v / arg),
|
||||
'downcase': v => v.toLowerCase(),
|
||||
'escape': escape,
|
||||
|
||||
+4
-1
@@ -53,7 +53,10 @@ describe('filters', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should support default', () => test('{{false |default: "a"}}', 'a'));
|
||||
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'));
|
||||
});
|
||||
|
||||
describe('divided_by', function() {
|
||||
it('should return 2 for 4,2', () => test('{{4 | divided_by: 2}}', '2'));
|
||||
|
||||
Reference in New Issue
Block a user