mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Implement more unit tests for PaperScope#settings.insertItems
This commit is contained in:
parent
55e7689186
commit
01fade8c08
2 changed files with 28 additions and 11 deletions
|
@ -759,13 +759,30 @@ test('Item#applyMatrix', function() {
|
|||
test('PaperScope#settings.insertItems', function() {
|
||||
var insertItems = paper.settings.insertItems;
|
||||
paper.settings.insertItems = true;
|
||||
|
||||
var path1, path2;
|
||||
|
||||
equals(function() {
|
||||
return new Path().parent === project.activeLayer;
|
||||
path1 = new Path();
|
||||
return path1.parent === project.activeLayer;
|
||||
}, true);
|
||||
paper.settings.insertItems = false;
|
||||
|
||||
equals(function() {
|
||||
return new Path().parent === null;
|
||||
path2 = new Path();
|
||||
return path2.parent === null;
|
||||
}, true);
|
||||
|
||||
equals(function() {
|
||||
return project.activeLayer.children.length;
|
||||
}, 1);
|
||||
|
||||
project.activeLayer.addChild(path2);
|
||||
|
||||
equals(function() {
|
||||
return project.activeLayer.children.length;
|
||||
}, 2);
|
||||
|
||||
paper.settings.insertItems = insertItems;
|
||||
});
|
||||
|
||||
|
|
|
@ -32,23 +32,23 @@ test('previousSibling / nextSibling', function() {
|
|||
return secondLayer.children.length;
|
||||
}, 2);
|
||||
equals(function() {
|
||||
return thirdLayer.nextSibling == path;
|
||||
return thirdLayer.nextSibling === path;
|
||||
}, true);
|
||||
secondLayer.addChild(thirdLayer);
|
||||
equals(function() {
|
||||
return thirdLayer.nextSibling == null;
|
||||
return thirdLayer.nextSibling;
|
||||
}, null);
|
||||
equals(function() {
|
||||
return thirdLayer.previousSibling === path;
|
||||
}, true);
|
||||
equals(function() {
|
||||
return thirdLayer.previousSibling == path;
|
||||
}, true);
|
||||
equals(function() {
|
||||
return project.layers.length == 2;
|
||||
}, true);
|
||||
return project.layers.length;
|
||||
}, 2);
|
||||
|
||||
firstLayer.addChild(secondLayer);
|
||||
equals(function() {
|
||||
return project.layers.length == 1;
|
||||
}, true);
|
||||
return project.layers.length;
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('insertAbove / insertBelow', function() {
|
||||
|
|
Loading…
Reference in a new issue