From 145f1cc0b1eb7793ae4830de716cc2a5700a64f7 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 3 Jul 2014 12:00:40 -0400 Subject: [PATCH] test color fns --- test/color.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/color.test.js b/test/color.test.js index ea5f8a9..a0f4c17 100644 --- a/test/color.test.js +++ b/test/color.test.js @@ -1,6 +1,8 @@ var assert = require('assert'); var tree = require('../lib/carto/tree.js'); +require('../lib/carto/functions'); require('../lib/carto/tree/color'); +require('../lib/carto/tree/dimension'); describe('Color', function() { describe('basic functionality', function() { @@ -10,4 +12,14 @@ describe('Color', function() { assert.ok(f); }); }); + describe('functions', function() { + it('should be constructed', function() { + assert.deepEqual(tree.functions.rgb(0, 0, 0), new tree.Color([0, 0, 0], 1)); + assert.deepEqual(tree.functions.hue(new tree.Color([0, 0, 0], 1)), new tree.Dimension(0)); + assert.deepEqual(tree.functions.saturation(new tree.Color([0, 0, 0], 1)), new tree.Dimension(0, '%')); + assert.deepEqual(tree.functions.lightness(new tree.Color([0, 0, 0], 1)), new tree.Dimension(0, '%')); + assert.deepEqual(tree.functions.alpha(new tree.Color([0, 0, 0], 1)), new tree.Dimension(1)); + assert.deepEqual(tree.functions.greyscale(new tree.Color([0, 0, 0], 1)), new tree.Color([0, 0, 0], 1)); + }); + }); });