aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-color.js
blob: 2006fd913d967091975104d7c930ac2b32a94b89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*global exports: false, require: false */
// TODO: add some failing tests as well
"use strict";
//var util = require("color");

// testing Color object
var ensureColorNew = function (test) {
    var col = new util.Color(255, 255, 166);
    test.assertEqual(col.toString(), "#ffffa6",
        "creation of new RGB Color object");
};

var ensureColorUpdate = function (test) {
    var col = new util.Color(255, 255, 166);
    col.update(255, 224, 176);
    test.assertEqual(col.toString(), "#ffe0b0",
        "updating Color object");
};

var ensureColorHSL = function (test) {
    var col = new util.Color(255, 224, 176);
    test.assertEqual(col.hsl().toSource(),
        "[0.10126582278481013, 1, 0.8450980392156863]",
        "converting to HSL model");
};

var ensureColorLight = function (test) {
    var col = new util.Color(255, 224, 176);
    test.assertEqual(col.lightColor().toString(), "#e8dcc9",
        "getting a light color");
};