fix: support integer arithmetic for divided_by, closes #465

This commit is contained in:
Harttle
2022-04-22 02:19:36 +08:00
parent ace5309c08
commit e69a51025e
5 changed files with 44 additions and 3 deletions
+2
View File
@@ -25,6 +25,8 @@ describe('filters/math', function () {
it('should return 2 for 4,2', () => test('{{4 | divided_by: 2}}', '2'))
it('should return 4 for 16,4', () => test('{{16 | divided_by: 4}}', '4'))
it('should return 1 for 5,3', () => test('{{5 | divided_by: 3}}', (5 / 3).toString()))
it('should support integer arithmetic', () => test('{{5 | divided_by: 3, true}}', '1'))
it('should floor the result in integer arithmetic', () => test('{{ -5 | divided_by: 3, true}}', '-2'))
it('should convert string to number', () => test('{{"6" | divided_by: "3"}}', '2'))
})
describe('floor', function () {