mirror of
https://github.com/konvajs/konva.git
synced 2026-01-18 19:51:21 +08:00
#291 added unit test for creating a blob via json who has the tension defined before the points array
This commit is contained in:
@@ -62,5 +62,48 @@ Test.Modules.BLOB = {
|
|||||||
//console.log(blob1.getPoints())
|
//console.log(blob1.getPoints())
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
'add blob and define tension first': function(containerId) {
|
||||||
|
var stage = new Kinetic.Stage({
|
||||||
|
container: containerId,
|
||||||
|
width: 578,
|
||||||
|
height: 200
|
||||||
|
});
|
||||||
|
var layer = new Kinetic.Layer();
|
||||||
|
|
||||||
|
/*
|
||||||
|
var blob = new Kinetic.Blob({
|
||||||
|
tension: 0.8,
|
||||||
|
points: [{
|
||||||
|
x: 73,
|
||||||
|
y: 140
|
||||||
|
}, {
|
||||||
|
x: 340,
|
||||||
|
y: 23
|
||||||
|
}, {
|
||||||
|
x: 500,
|
||||||
|
y: 109
|
||||||
|
}, {
|
||||||
|
x: 300,
|
||||||
|
y: 170
|
||||||
|
}],
|
||||||
|
stroke: 'blue',
|
||||||
|
strokeWidth: 10,
|
||||||
|
draggable: true,
|
||||||
|
fill: '#aaf'
|
||||||
|
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
var json = '{"attrs":{"tension":0.8,"points":[{"x":73,"y":140},{"x":340,"y":23},{"x":500,"y":109},{"x":300,"y":170}],"stroke":"blue","strokeWidth":10,"draggable":true,"fill":"#aaf"},"className":"Blob"}';
|
||||||
|
var blob = Kinetic.Node.create(json);
|
||||||
|
|
||||||
|
layer.add(blob);
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
//console.log(blob.toJSON());
|
||||||
|
|
||||||
|
test(stage.get('Blob')[0].getPoints().length === 4, 'created blob should have 4 points');
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user