Implement more unit tests for PaperScope#settings.insertItems

This commit is contained in:
Jürg Lehni 2016-02-14 22:04:40 +01:00
parent 55e7689186
commit 01fade8c08
2 changed files with 28 additions and 11 deletions

View file

@ -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;
});

View file

@ -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() {