aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-01 01:05:02 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-01 01:05:02 +0200
commit43218b75f3df450b97992815322c2d668ba2bab7 (patch)
tree02fc13cdff611e4a076f5c65316f4d8be6367ff5 /tests
parent4ccc9580eed8269e376eaa671e42590ff095c890 (diff)
downloadbugzilla-triage-43218b75f3df450b97992815322c2d668ba2bab7.tar.gz
Adding unit tests for Color object
Diffstat (limited to 'tests')
-rw-r--r--tests/test-color.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test-color.js b/tests/test-color.js
new file mode 100644
index 0000000..7394057
--- /dev/null
+++ b/tests/test-color.js
@@ -0,0 +1,31 @@
+/*global exports: false, require: false */
+// TODO: add some failing tests as well
+"use strict";
+var util = require("color");
+
+// testing Color object
+exports.ensureColorNew = function (test) {
+ var col = new util.Color(255, 255, 166);
+ test.assertEqual(col.toString(), "#ffffa6",
+ "creation of new RGB Color object");
+};
+
+exports.ensureColorUpdate = function (test) {
+ var col = new util.Color(255, 255, 166);
+ col.update(255, 224, 176);
+ test.assertEqual(col.toString(), "#ffe0b0",
+ "updating Color object");
+};
+
+exports.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");
+};
+
+exports.ensureColorLight = function (test) {
+ var col = new util.Color(255, 224, 176);
+ test.assertEqual(col.lightColor().toString(), "#e8dcc9",
+ "getting a light color");
+};