mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 05:50:43 -07:00
fix: math filters coerce invalid string to 0, #813
This commit is contained in:
@@ -56,8 +56,9 @@ describe('filters/math', function () {
|
||||
it('should return "20" for 16,4', () => test('{{ 16 | plus: 4 }}', '20'))
|
||||
it('should return "195.357" for 183.357,12',
|
||||
() => test('{{ 183.357 | plus: 12 }}', '195.357'))
|
||||
it('should convert first arg as number', () => test('{{ "4" | plus: 2 }}', '6'))
|
||||
it('should convert both args as number', () => test('{{ "4" | plus: "2" }}', '6'))
|
||||
it('should convert first arg to number', () => test('{{ "4" | plus: 2 }}', '6'))
|
||||
it('should convert both args to numbers', () => test('{{ "4" | plus: "2" }}', '6'))
|
||||
it('should convert invalid string to 0', () => test('{{ "abc" | plus: "2" }}', '2'))
|
||||
it('should support variable', () => test('{{ 4 | plus: b }}', { b: 2 }, '6'))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user