add() now can add multiple layers or nodes

This commit is contained in:
Victor Michnowicz
2014-03-13 23:30:46 -04:00
parent 347e4d697f
commit 0898c24b7a
4 changed files with 54 additions and 8 deletions

View File

@@ -1425,13 +1425,34 @@ suite('Container', function() {
assert.equal(testName.length, 1, 'group has one children with test name');
layer.add(group);
layer.draw();
});
test('add multiple nodes to container', function() {
var stage = addStage();
var layer = new Kinetic.Layer();
var circle1 = new Kinetic.Circle({
x: 0,
y: 0,
radius: 10,
fill: 'red'
});
var circle2 = new Kinetic.Circle({
x: 0,
y: 0,
radius: 10,
fill: 'white'
});
var circle3 = new Kinetic.Circle({
x: 0,
y: 0,
radius: 10,
fill: 'blue'
});
layer.add(circle1, circle2, circle3);
assert.equal(layer.getChildren().length, 3, 'layer has exactly three children');
});
});