forked from gka/chroma.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconverters.test.js
47 lines (43 loc) · 1.59 KB
/
converters.test.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require('es6-shim');
const vows = require('vows');
const assert = require('assert');
const chroma = require('../index');
const test = vows.describe('Testing color conversions');
for (let k in chroma.colors) {
test.addBatch({
k: {
topic: chroma.colors[k],
'to hsl and back': function (t) {
assert.equal(chroma.hsl(chroma(t).hsl()).hex(), t);
},
'to cmyk and back': function (t) {
assert.equal(chroma.cmyk(chroma(t).cmyk()).hex(), t);
},
'to css and back': function (t) {
assert.equal(chroma.css(chroma(t).css()).hex(), t);
},
'to hsi and back': function (t) {
assert.equal(chroma.hsi(chroma(t).hsi()).hex(), t);
},
'to hsv and back': function (t) {
assert.equal(chroma.hsv(chroma(t).hsv()).hex(), t);
},
'to lab and back': function (t) {
assert.equal(chroma.lab(chroma(t).lab()).hex(), t);
},
'to oklab and back': function (t) {
assert.equal(chroma.oklab(chroma(t).oklab()).hex(), t);
},
'to lch and back': function (t) {
assert.equal(chroma.lch(chroma(t).lch()).hex(), t);
},
'to oklch and back': function (t) {
assert.equal(chroma.oklch(chroma(t).oklch()).hex(), t);
},
'to num and back': function (t) {
assert.equal(chroma.num(chroma(t).num()).hex(), t);
}
}
});
}
test['export'](module);