#291 added unit test for creating a blob via json who has the tension defined before the points array

This commit is contained in:
Eric Rowell
2013-07-24 21:57:45 -07:00
parent e65b975a6a
commit 7a1b854a12
2 changed files with 53 additions and 10 deletions

View File

@@ -62,5 +62,48 @@ Test.Modules.BLOB = {
//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');
}
};