Add failing test when inserting multiple children into the same parent.

This commit is contained in:
Jürg Lehni 2013-03-01 22:41:58 -08:00
parent 67b1a602c4
commit 881f624575

View file

@ -169,6 +169,36 @@ test('isDescendant(item) / isAncestor(item)', function() {
}, false);
});
test('addChildren(items)', function() {
var project = paper.project;
var path1 = new Path(),
path2 = new Path(),
path3 = new Path(),
group = new Group([path1, path2, path3]);
function check(i1, i2, i3) {
equals(function() {
return group.children.length;
}, 3);
equals(function() {
return path1.index;
}, i1);
equals(function() {
return path2.index;
}, i2);
equals(function() {
return path3.index;
}, i3);
}
check(0, 1, 2);
group.addChild(path1);
check(2, 0, 1);
group.addChild(path2);
check(1, 2, 0);
group.addChildren([path1, path2, path3]);
check(0, 1, 2);
});
test('isGroupedWith', function() {
var project = paper.project;
var path = new Path();