diff --git a/src/item/Group.js b/src/item/Group.js
index 029a34bd..b87c4d0a 100644
--- a/src/item/Group.js
+++ b/src/item/Group.js
@@ -1,12 +1,18 @@
-GroupItem = Item.extend({
- initialize: function() {
+Group = Item.extend({
+ initialize: function(items) {
+ this.base();
this.children = [];
+ if(items) {
+ for(var i = 0, l = items.length; i < l; i++) {
+ this.appendTop(items[i]);
+ }
+ }
this.clipped = false;
},
- draw: function() {
+ draw: function(ctx) {
for(var i = 0, l = this.children.length; i < l; i++) {
- this.children[i].draw();
+ this.children[i].draw(ctx);
}
},
diff --git a/test/index.html b/test/index.html
index 9fbb0834..aeec2083 100644
--- a/test/index.html
+++ b/test/index.html
@@ -28,6 +28,7 @@
+
diff --git a/test/tests/Group.js b/test/tests/Group.js
new file mode 100644
index 00000000..f5511b67
--- /dev/null
+++ b/test/tests/Group.js
@@ -0,0 +1,15 @@
+module('Group');
+
+test('new Group()', function() {
+ var doc = new Doc();
+ var group = new Group();
+ equals(doc.activeLayer.children[0] == group, true);
+});
+
+test('new Group([item])', function() {
+ var doc = new Doc();
+ var path = new Path();
+ var group = new Group([path]);
+ equals(doc.activeLayer.children.length == 1, true);
+ equals(group.children[0] == path, true);
+});
\ No newline at end of file