-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
64 lines (59 loc) Β· 1.32 KB
/
Copy pathtest.js
File metadata and controls
64 lines (59 loc) Β· 1.32 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const test = require('ava');
const {getHarmonographSettings, getColor} = require('.');
test('getHarmonographSettings: no settings returns defaults', t => {
t.deepEqual(getHarmonographSettings({
strokeColor: '',
backgroundColor: '',
strokeWidth: '',
size: '',
animationDuration: ''
}), {
animatePath: {
duration: '60s'
}
});
t.deepEqual(getHarmonographSettings({}), {
animatePath: {
duration: '60s'
}
});
});
test('getHarmonographSettings: values get formatted correctly', t => {
t.deepEqual(getHarmonographSettings({
strokeColor: '000',
backgroundColor: 'fff',
strokeWidth: '0.1',
size: '100',
animationDuration: '0'
}), {
backgroundColor: '#FFFFFF',
size: '100',
strokeColor: '#000000',
strokeWidth: '0.1',
animatePath: {
duration: '0s'
}
});
t.deepEqual(getHarmonographSettings({
strokeColor: '000',
backgroundColor: 'fff',
strokeWidth: '0.1',
size: '100',
animationDuration: '1'
}), {
backgroundColor: '#FFFFFF',
size: '100',
strokeColor: '#000000',
strokeWidth: '0.1',
animatePath: {
duration: '1s'
}
});
});
test('getColor: returns valid colors', t => {
t.is(getColor('transparent'), '#000000');
t.is(getColor('red'), '#FF0000');
t.is(getColor('rebeccapurple'), '#663399');
t.is(getColor('fff'), '#FFFFFF');
t.is(getColor('omadisnjoijaso'), null);
});