Skip to content

Commit 3b3e019

Browse files
committed
test: add test cases for Color.contrast
1 parent e2db213 commit 3b3e019

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/jasmine/tests/color_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,25 @@ describe('Test color:', function() {
175175
});
176176

177177
});
178+
179+
describe('contrast', function() {
180+
181+
it('should darken light colors', function() {
182+
var out = Color.contrast('#eee', 10, 20);
183+
184+
expect(out).toEqual('#bbbbbb');
185+
});
186+
187+
it('should darken light colors (2)', function() {
188+
var out = Color.contrast('#fdae61', 10, 20);
189+
190+
expect(out).toEqual('#f57a03');
191+
});
192+
193+
it('should lighten dark colors', function() {
194+
var out = Color.contrast('#2b83ba', 10, 20);
195+
196+
expect(out).toEqual('#449dd4');
197+
});
198+
});
178199
});

0 commit comments

Comments
 (0)