mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Add more Layer tests.
This commit is contained in:
parent
f6e827cfd1
commit
f50e28cd4a
1 changed files with 17 additions and 18 deletions
|
@ -75,28 +75,27 @@ test('appendTop / appendBottom / nesting', function() {
|
|||
// There should be two layers now in project.layers
|
||||
equals(function() {
|
||||
return project.layers.length;
|
||||
}, 1);
|
||||
}, 2);
|
||||
firstLayer.appendTop(secondLayer);
|
||||
equals(function() {
|
||||
return secondLayer.parent == firstLayer;
|
||||
}, true);
|
||||
equals(function() {
|
||||
return secondLayer.nextSibling == firstLayer;
|
||||
}, true);
|
||||
|
||||
var path = new Path();
|
||||
firstLayer.appendTop(path);
|
||||
|
||||
// move the layer above the path, inside the firstLayer:
|
||||
secondLayer.moveAbove(path);
|
||||
equals(function() {
|
||||
return secondLayer.previousSibling == path;
|
||||
}, true);
|
||||
equals(function() {
|
||||
return secondLayer.parent == firstLayer;
|
||||
}, true);
|
||||
// There should now only be one layer left:
|
||||
// There should only be the firsLayer now in project.layers
|
||||
equals(function() {
|
||||
return project.layers.length;
|
||||
}, 1);
|
||||
});
|
||||
equals(function() {
|
||||
return project.layers[0] == firstLayer;
|
||||
}, true);
|
||||
// Now move secondLayer bellow the first again, in which case it should
|
||||
// reappear in project.layers
|
||||
secondLayer.moveBelow(firstLayer);
|
||||
// There should be two layers now in project.layers again now
|
||||
equals(function() {
|
||||
return project.layers.length;
|
||||
}, 2);
|
||||
equals(function() {
|
||||
return project.layers[0] == firstLayer
|
||||
&& project.layers[1] == secondLayer;
|
||||
}, true);
|
||||
);
|
Loading…
Reference in a new issue