Fix SelectedColorsService tests

This commit is contained in:
grosbouddha 2015-09-16 23:36:55 +02:00
parent 8d618fc31c
commit 8faa6db4c0

View File

@ -3,10 +3,8 @@ describe("SelectedColorsService test suite", function() {
it("returns the default selected colors initially", function() { it("returns the default selected colors initially", function() {
var service = new pskl.service.SelectedColorsService(); var service = new pskl.service.SelectedColorsService();
var defaultSelectedColors = service.getColors(); expect(service.getPrimaryColor()).toBe(Constants.DEFAULT_PEN_COLOR);
expect(defaultSelectedColors.length).toBe(2); expect(service.getSecondaryColor()).toBe(Constants.TRANSPARENT_COLOR);
expect(defaultSelectedColors[0]).toBe(Constants.DEFAULT_PEN_COLOR);
expect(defaultSelectedColors[1]).toBe(Constants.TRANSPARENT_COLOR);
}); });
it("reacts to PRIMARY_COLOR_SELECTED event", function() { it("reacts to PRIMARY_COLOR_SELECTED event", function() {
@ -16,10 +14,8 @@ describe("SelectedColorsService test suite", function() {
var expectedColor = "#123456"; var expectedColor = "#123456";
$.publish(Events.PRIMARY_COLOR_SELECTED, [expectedColor]); $.publish(Events.PRIMARY_COLOR_SELECTED, [expectedColor]);
var defaultSelectedColors = service.getColors(); expect(service.getPrimaryColor()).toBe(expectedColor);
expect(defaultSelectedColors.length).toBe(2); expect(service.getSecondaryColor()).toBe(Constants.TRANSPARENT_COLOR);
expect(defaultSelectedColors[0]).toBe(expectedColor);
expect(defaultSelectedColors[1]).toBe(Constants.TRANSPARENT_COLOR);
}); });
it("reacts to SECONDARY_COLOR_SELECTED event", function() { it("reacts to SECONDARY_COLOR_SELECTED event", function() {
@ -29,9 +25,7 @@ describe("SelectedColorsService test suite", function() {
var expectedColor = "#123456"; var expectedColor = "#123456";
$.publish(Events.SECONDARY_COLOR_SELECTED, [expectedColor]); $.publish(Events.SECONDARY_COLOR_SELECTED, [expectedColor]);
var defaultSelectedColors = service.getColors(); expect(service.getPrimaryColor()).toBe(Constants.DEFAULT_PEN_COLOR);
expect(defaultSelectedColors.length).toBe(2); expect(service.getSecondaryColor()).toBe(expectedColor);
expect(defaultSelectedColors[0]).toBe(Constants.DEFAULT_PEN_COLOR);
expect(defaultSelectedColors[1]).toBe(expectedColor);
}); });
}); });