piskel/test/js/utils/ColorUtilsTest.js

29 lines
838 B
JavaScript
Raw Normal View History

2015-04-13 14:02:12 +03: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 23:23:35 +03:00
var unusedColor = pskl.utils.ColorUtils.getUnusedColor(['#ffff00', '#feff00', '#fdff00']);
2015-04-13 14:02:12 +03:00
// verify
2015-04-27 23:23:35 +03:00
expect(unusedColor).toBe('#FCFF00');
2015-04-13 14:02:12 +03:00
// when/then
2015-04-27 23:23:35 +03:00
unusedColor = pskl.utils.ColorUtils.getUnusedColor(['#fcff00', '#feff00', '#fdff00']);
2015-04-13 14:02:12 +03:00
// verify
2015-04-27 23:23:35 +03:00
expect(unusedColor).toBe('#FFFF00');
2015-04-13 14:02:12 +03:00
});
it("returns a color for an empty array", function() {
// when/then
var unusedColor = pskl.utils.ColorUtils.getUnusedColor([]);
// verify
2015-04-27 23:23:35 +03:00
expect(unusedColor).toBe('#FFFF00');
2015-04-13 14:02:12 +03:00
// when/then
unusedColor = pskl.utils.ColorUtils.getUnusedColor();
// verify
2015-04-27 23:23:35 +03:00
expect(unusedColor).toBe('#FFFF00');
2015-04-13 14:02:12 +03:00
});
});