test color fns

This commit is contained in:
Tom MacWright 2014-07-03 12:00:40 -04:00
parent 2273e0174f
commit 145f1cc0b1

View File

@ -1,6 +1,8 @@
var assert = require('assert'); var assert = require('assert');
var tree = require('../lib/carto/tree.js'); var tree = require('../lib/carto/tree.js');
require('../lib/carto/functions');
require('../lib/carto/tree/color'); require('../lib/carto/tree/color');
require('../lib/carto/tree/dimension');
describe('Color', function() { describe('Color', function() {
describe('basic functionality', function() { describe('basic functionality', function() {
@ -10,4 +12,14 @@ describe('Color', function() {
assert.ok(f); 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));
});
});
}); });