piskel/test/js/utils/ColorUtilsTest.js

29 lines
838 B
JavaScript
Raw Normal View History

2015-04-13 11:02:12 +00:00
describe("Color utils", function() {
beforeEach(function() {});
afterEach(function() {});
it("returns a color when provided with array of colors", function() {
// when/then
2015-04-27 20:23:35 +00:00
var unusedColor = pskl.utils.ColorUtils.getUnusedColor(['#ffff00', '#feff00', '#fdff00']);
2015-04-13 11:02:12 +00:00
// verify
2015-04-27 20:23:35 +00:00
expect(unusedColor).toBe('#FCFF00');
2015-04-13 11:02:12 +00:00
// when/then
2015-04-27 20:23:35 +00:00
unusedColor = pskl.utils.ColorUtils.getUnusedColor(['#fcff00', '#feff00', '#fdff00']);
2015-04-13 11:02:12 +00:00
// verify
2015-04-27 20:23:35 +00:00
expect(unusedColor).toBe('#FFFF00');
2015-04-13 11:02:12 +00:00
});
it("returns a color for an empty array", function() {
// when/then
var unusedColor = pskl.utils.ColorUtils.getUnusedColor([]);
// verify
2015-04-27 20:23:35 +00:00
expect(unusedColor).toBe('#FFFF00');
2015-04-13 11:02:12 +00:00
// when/then
unusedColor = pskl.utils.ColorUtils.getUnusedColor();
// verify
2015-04-27 20:23:35 +00:00
expect(unusedColor).toBe('#FFFF00');
2015-04-13 11:02:12 +00:00
});
});