blowfish/node_modules/khroma/test/methods/saturation.js

28 lines
475 B
JavaScript
Raw Normal View History

2023-01-29 22:30:24 +00:00
/* IMPORT */
import {describe} from 'fava';
import {saturation} from '../../dist/index.js';
/* MAIN */
describe ( 'saturation', it => {
it ( 'gets the saturation channel of the color', t => {
const tests = [
['hsl(10, 20%, 30%)', 20],
['rgb(10, 20, 30)', 50],
['rgb(0, 0, 0)', 0],
['#102030', 50],
['#ff0000', 100]
];
tests.forEach ( ([ color, output ]) => {
t.is ( saturation ( color ), output );
});
});
});