This commit is contained in:
nik
2025-10-03 22:27:28 +03:00
parent 829fad0e17
commit 871cf7e792
16520 changed files with 2967597 additions and 3 deletions

41
node_modules/khroma/test/methods/hex.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
/* IMPORT */
import {describe} from 'fava';
import {hex} from '../../dist/index.js';
/* MAIN */
describe ( 'hex', it => {
it ( 'creates a new color given its rgba channels', t => {
const tests = [
[[0, 0, 0, 0], 'rgba(0, 0, 0, 0)'],
[[255, 255, 255, 0.5], 'rgba(255, 255, 255, 0.5)'],
[[0, 0, 0, 1], '#000000'],
[[128, 128, 128, 1], '#808080'],
[[-1, -1, -1, -1], 'rgba(0, 0, 0, 0)'],
[[1000, 1000, 1000, 1000], '#ffffff']
];
tests.forEach ( ([ args, output ]) => {
t.is ( hex ( ...args ), output );
});
});
it ( 'allows ommiting the alpha channel', t => {
const tests = [
[[0, 0, 0], '#000000'],
[[255, 255, 255], '#ffffff']
];
tests.forEach ( ([ args, output ]) => {
t.is ( hex ( ...args ), output );
});
});
});