piskel/test/js/service/SelectedColorsServiceTest.js

31 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-09-16 02:13:21 +03:00
describe("SelectedColorsService test suite", function() {
it("returns the default selected colors initially", function() {
var service = new pskl.service.SelectedColorsService();
2015-09-17 00:36:55 +03:00
expect(service.getPrimaryColor()).toBe(Constants.DEFAULT_PEN_COLOR);
expect(service.getSecondaryColor()).toBe(Constants.TRANSPARENT_COLOR);
2015-09-16 02:13:21 +03:00
});
it("reacts to PRIMARY_COLOR_SELECTED event", function() {
var service = new pskl.service.SelectedColorsService();
service.init();
var expectedColor = "#123456";
$.publish(Events.PRIMARY_COLOR_SELECTED, [expectedColor]);
2015-09-17 00:36:55 +03:00
expect(service.getPrimaryColor()).toBe(expectedColor);
expect(service.getSecondaryColor()).toBe(Constants.TRANSPARENT_COLOR);
2015-09-16 02:13:21 +03:00
});
it("reacts to SECONDARY_COLOR_SELECTED event", function() {
var service = new pskl.service.SelectedColorsService();
service.init();
var expectedColor = "#123456";
$.publish(Events.SECONDARY_COLOR_SELECTED, [expectedColor]);
2015-09-17 00:36:55 +03:00
expect(service.getPrimaryColor()).toBe(Constants.DEFAULT_PEN_COLOR);
expect(service.getSecondaryColor()).toBe(expectedColor);
2015-09-16 02:13:21 +03:00
});
});