mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
39 lines
982 B
JavaScript
39 lines
982 B
JavaScript
describe("Layer model test", function() {
|
|
|
|
beforeEach(function() {});
|
|
afterEach(function() {});
|
|
|
|
it("has proper defaults", function() {
|
|
var layer = new pskl.model.Layer('layerName');
|
|
|
|
expect(layer.getOpacity()).toBe(1);
|
|
expect(layer.getFrames().length).toBe(0);
|
|
expect(layer.getName()).toBe('layerName');
|
|
});
|
|
|
|
it("can set opacity", function() {
|
|
var layer = new pskl.model.Layer('layerName');
|
|
|
|
layer.setOpacity(0.5);
|
|
expect(layer.getOpacity()).toBe(0.5);
|
|
});
|
|
|
|
it("ignores bad opacity", function() {
|
|
var layer = new pskl.model.Layer('layerName');
|
|
|
|
layer.setOpacity(0.3);
|
|
expect(layer.getOpacity()).toBe(0.3);
|
|
|
|
layer.setOpacity('Yep I\'m an opacity, let me in !');
|
|
expect(layer.getOpacity()).toBe(0.3);
|
|
|
|
layer.setOpacity(9000);
|
|
expect(layer.getOpacity()).toBe(0.3);
|
|
|
|
layer.setOpacity(-1);
|
|
expect(layer.getOpacity()).toBe(0.3);
|
|
|
|
layer.setOpacity(null);
|
|
expect(layer.getOpacity()).toBe(0.3);
|
|
});
|
|
}); |