changed draggable() to setDraggable(). added getDraggable(). added more unit tests and functional tests

This commit is contained in:
Eric Rowell
2012-06-18 22:02:13 -07:00
parent dee78e86e2
commit c8d8aa6028
7 changed files with 418 additions and 422 deletions

View File

@@ -18,7 +18,7 @@ Test.prototype.tests = {
stroke: 'black'
});
circle.draggable(true);
circle.setDraggable(true);
layer.add(circle);
stage.add(layer);
@@ -31,10 +31,6 @@ Test.prototype.tests = {
dragStart = true;
});
circle.on('dragstart', function() {
dragStart = true;
});
circle.on('dragmove', function() {
dragMove = true;
});
@@ -80,6 +76,73 @@ Test.prototype.tests = {
});
});
},
'DRAG AND DROP - drag and drop layer': function(containerId) {
var urls = dataUrls['DRAG AND DROP - drag and drop layer'];
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200,
throttle: 999
});
var layer = new Kinetic.Layer({
drawFunc: function() {
var context = this.getContext();
context.beginPath();
context.moveTo(200, 50);
context.lineTo(420, 80);
context.quadraticCurveTo(300, 100, 260, 170);
context.closePath();
context.fillStyle = 'blue';
context.fill();
},
draggable: true
});
var circle1 = new Kinetic.Ellipse({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 70,
fill: 'red'
});
var circle2 = new Kinetic.Ellipse({
x: 400,
y: stage.getHeight() / 2,
radius: 70,
fill: 'green'
});
layer.add(circle1);
layer.add(circle2);
stage.add(layer);
stage.toDataURL(function(startDataUrl) {
test(urls[0] === startDataUrl, 'start data url is incorrect');
/*
* simulate drag and drop
*/
stage._mousedown({
clientX: 399,
clientY: 96
});
stage._mousemove({
clientX: 210,
clientY: 109
});
stage._mouseup({
clientX: 210,
clientY: 109
});
stage.toDataURL(function(endDataUrl) {
test(urls[1] === endDataUrl, 'end data url is incorrect');
});
});
},
'EVENTS - modify fill stroke and stroke width on hover with circle': function(containerId) {
var urls = dataUrls['EVENTS - modify fill stroke and stroke width on hover with circle'];
var stage = new Kinetic.Stage({