mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Add failing test when inserting multiple children into the same parent.
This commit is contained in:
parent
67b1a602c4
commit
881f624575
1 changed files with 30 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue