mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -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
|
// There should be two layers now in project.layers
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return project.layers.length;
|
return project.layers.length;
|
||||||
}, 1);
|
}, 2);
|
||||||
firstLayer.appendTop(secondLayer);
|
firstLayer.appendTop(secondLayer);
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return secondLayer.parent == firstLayer;
|
return secondLayer.parent == firstLayer;
|
||||||
}, true);
|
}, true);
|
||||||
equals(function() {
|
// There should only be the firsLayer now in project.layers
|
||||||
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:
|
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return project.layers.length;
|
return project.layers.length;
|
||||||
}, 1);
|
}, 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