migrated Canvas, DragAndDrop, Global, and Tween tests to mocha

This commit is contained in:
Eric Rowell
2013-09-09 10:08:16 -07:00
parent c40fc7cf38
commit 1ea9e68ff6
8 changed files with 95 additions and 111 deletions

View File

@@ -0,0 +1,55 @@
suite('DragAndDrop', function() {
// ======================================================
test('test drag and drop properties and methods', function() {
var stage = addStage();
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4,
name: 'myCircle'
});
stage.add(layer);
layer.add(circle);
layer.draw();
// test defaults
assert.equal(circle.isDraggable(), false);
//change properties
circle.setDraggable(true);
// test new properties
assert.equal(circle.getDraggable(), true);
});
// ======================================================
test('multiple drag and drop sets with setDraggable()', function() {
var stage = addStage();
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: 380,
y: stage.getHeight() / 2,
radius: 70,
strokeWidth: 4,
fill: 'red',
stroke: 'black'
});
circle.setDraggable(true);
assert.equal(circle.getDraggable(), true);
circle.setDraggable(true);
assert.equal(circle.getDraggable(), true);
circle.setDraggable(false);
assert.equal(!circle.getDraggable(), true);
layer.add(circle);
stage.add(layer);
});
});