From 5501c3b6fcbbe9b811e2cdf8aa6bf3d9d93d7020 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 9 Aug 2016 10:42:26 +0300 Subject: [PATCH] Add a test case for `calc` and `strictMath`. --- Gruntfile.js | 7 +++++++ test/expected/calc.css | 3 +++ test/fixtures/calc.less | 3 +++ test/less_test.js | 9 +++++++++ 4 files changed, 22 insertions(+) create mode 100644 test/expected/calc.css create mode 100644 test/fixtures/calc.less diff --git a/Gruntfile.js b/Gruntfile.js index cdabfe5..5bf6543 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -212,6 +212,13 @@ module.exports = function(grunt) { 'tmp/customFunctions.css': ['test/fixtures/customFunctions.less'] } }, + calc: { + options: { + strictMath: true + }, + src: 'test/fixtures/calc.less', + dest: 'tmp/calc.css' + }, modifyVars: { options: { modifyVars: { diff --git a/test/expected/calc.css b/test/expected/calc.css new file mode 100644 index 0000000..279142c --- /dev/null +++ b/test/expected/calc.css @@ -0,0 +1,3 @@ +.a { + padding-top: calc(var(--header-height) + 1rem); +} diff --git a/test/fixtures/calc.less b/test/fixtures/calc.less new file mode 100644 index 0000000..279142c --- /dev/null +++ b/test/fixtures/calc.less @@ -0,0 +1,3 @@ +.a { + padding-top: calc(var(--header-height) + 1rem); +} diff --git a/test/less_test.js b/test/less_test.js index 375684d..d598b8b 100644 --- a/test/less_test.js +++ b/test/less_test.js @@ -151,6 +151,15 @@ exports.less = { test.done(); }, + calc: function(test) { + test.expect(1); + + var actual = read('tmp/calc.css'); + var expected = read('test/expected/calc.css'); + test.equal(expected, actual, 'should process calc function with `strictMath`'); + + test.done(); + }, customFunctions: function(test) { test.expect(1);