mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix problem when calling new Group([]).
This commit is contained in:
parent
33c13b36a3
commit
bda7c71fcb
2 changed files with 11 additions and 1 deletions
|
@ -74,7 +74,7 @@ var Group = this.Group = Item.extend(/** @lends Group# */{
|
||||||
this._children = [];
|
this._children = [];
|
||||||
this._namedChildren = {};
|
this._namedChildren = {};
|
||||||
this.addChildren(!items || !Array.isArray(items)
|
this.addChildren(!items || !Array.isArray(items)
|
||||||
|| typeof items[0] !== 'object' ? arguments : items);
|
|| items.length && typeof items[0] !== 'object' ? arguments : items);
|
||||||
},
|
},
|
||||||
|
|
||||||
_changed: function(flags) {
|
_changed: function(flags) {
|
||||||
|
|
|
@ -23,6 +23,16 @@ test('new Group()', function() {
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('new Group([])', function() {
|
||||||
|
var group = new Group([]);
|
||||||
|
equals(function() {
|
||||||
|
return paper.project.activeLayer.children[0] == group;
|
||||||
|
}, true);
|
||||||
|
equals(function() {
|
||||||
|
return group.children.length;
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
test('new Group([item])', function() {
|
test('new Group([item])', function() {
|
||||||
var path = new Path();
|
var path = new Path();
|
||||||
var group = new Group([path]);
|
var group = new Group([path]);
|
||||||
|
|
Loading…
Reference in a new issue