diff --git a/test/filters.js b/test/filters.js index 80adf457e..592988fbb 100644 --- a/test/filters.js +++ b/test/filters.js @@ -26,6 +26,7 @@ describe('filters', function() { describe('abs', function() { it('should return 3 for -3', () => test('{{ -3 | abs }}', '3')); it('should return 2 for arr[0]', () => test('{{ arr[0] | abs }}', '2')); + it('should return convert string', () => test('{{ "-3" | abs }}', '3')); }); describe('append', function() { @@ -65,6 +66,7 @@ describe('filters', 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}}', '1')); + it('should convert string to number', () => test('{{"5" | divided_by: "3"}}', '1')); }); describe('downcase', function() { @@ -133,7 +135,8 @@ describe('filters', function() { it('should return "12" for 16,4', () => test('{{ 16 | minus: 4 }}', '12')); it('should return "171.357" for 183.357,12', () => test('{{ 183.357 | minus: 12 }}', '171.357')); - it('should convert string to number', () => test('{{ "4" | minus: 1 }}', '3')); + it('should convert first arg as number', () => test('{{ "4" | minus: 1 }}', '3')); + it('should convert both args as number', () => test('{{ "4" | minus: "1" }}', '3')); }); describe('modulo', function() { @@ -141,6 +144,7 @@ describe('filters', function() { it('should return "3" for 24,7', () => test('{{ 24 | modulo: 7 }}', '3')); it('should return "3.357" for 183.357,12', () => test('{{ 183.357 | modulo: 12 }}', '3.357')); + it('should convert string', () => test('{{ "24" | modulo: "7" }}', '3')); }); it('should support string_with_newlines', function() { @@ -160,7 +164,8 @@ describe('filters', 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 string to number', () => test('{{ "4" | plus: 2 }}', '6')); + 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 support prepend', function() { @@ -200,6 +205,7 @@ describe('filters', function() { it('should return "3" for 2.7', () => test('{{2.7|round}}', '3')); it('should return "183.36" for 183.357,2', () => test('{{183.357|round: 2}}', '183.36')); + it('should convert string to number', () => test('{{"2.7"|round}}', '3')); }); it('should support rstrip', function() { @@ -266,6 +272,7 @@ describe('filters', function() { it('should return "168" for 24,7', () => test('{{ 24 | times: 7 }}', '168')); it('should return "2200.284" for 183.357,12', () => test('{{ 183.357 | times: 12 }}', '2200.284')); + it('should convert string to number', () => test('{{ "24" | times: "7" }}', '168')); }); describe('truncate', function() {