forked from adobe/leonardo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolorSetters.test.mjs
87 lines (72 loc) · 2.29 KB
/
colorSetters.test.mjs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
/* global test, expect */
import { Color } from "../index";
test('should set color name of Color class', () => {
const color = new Color({
name: 'colorName',
colorKeys: ['#2451FF', '#C9FEFE', '#012676'],
colorspace: 'CAM02',
ratios: [3, 4.5],
smooth: true
});
color.name = 'newColorName'
const colorName = color.name;
expect(colorName).toEqual('newColorName');
});
test('should set color keys of Color class', () => {
const color = new Color({
name: 'colorName',
colorKeys: ['#2451FF', '#C9FEFE', '#012676'],
colorspace: 'CAM02',
ratios: [3, 4.5],
smooth: true
});
color.colorKeys = ['#ff00ff', '#ff32ff', '#320077']
const colorKeys = color.colorKeys;
expect(colorKeys).toEqual(['#ff00ff', '#ff32ff', '#320077']);
});
test('should set colorspace of Color class', () => {
const color = new Color({
name: 'colorName',
colorKeys: ['#2451FF', '#C9FEFE', '#012676'],
colorspace: 'CAM02',
ratios: [3, 4.5],
smooth: true
});
color.colorspace = 'HSL'
const colorspace = color.colorspace;
expect(colorspace).toEqual('HSL');
});
test('should set ratios of Color class', () => {
const color = new Color({
name: 'colorName',
colorKeys: ['#2451FF', '#C9FEFE', '#012676'],
colorspace: 'CAM02',
ratios: [3, 4.5],
smooth: true
});
color.ratios = [5, 7, 12]
const ratios = color.ratios;
expect(ratios).toEqual([5, 7, 12]);
});
test('should set smooth of Color class', () => {
const color = new Color({
name: 'colorName',
colorKeys: ['#2451FF', '#C9FEFE', '#012676'],
colorspace: 'CAM02',
ratios: [3, 4.5],
smooth: true
});
color.smooth = false;
const smooth = color.smooth;
expect(smooth).toEqual(false);
});