mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 19:02:08 +08:00
add() now can add multiple layers or nodes
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user