Skip to content
Permalink
Browse files

No commit message

  • Loading branch information
Paul Bakaus
Paul Bakaus committed Jun 1, 2008
1 parent 60ae201 commit 737ff7309ddc9203d59749cbd988045a33b0e40a
Showing with 75 additions and 0 deletions.
  1. +75 −0 ui/tests/draggable.js
@@ -243,5 +243,80 @@ test("{ cursor: 'move' }", function() {

});

test("{ distance: 10 }", function() {

expect(2);

var dragged = false;
$("#draggable2").draggable({
distance: 10,
start: function(e, ui) {
dragged = true;
}
});

drag("#draggable2", -9, -9);
equals(dragged, false, "The draggable should not have moved when moving -9px");

drag("#draggable2", -10, -10);
equals(dragged, true, "The draggable should have moved when moving -10px");

});

test("{ opacity: 0.5 }", function() {

expect(1);

var opacity = null;
$("#draggable2").draggable({
opacity: 0.5,
start: function(e, ui) {
opacity = $(this).css("opacity");
}
});

drag("#draggable2", -1, -1);

equals(opacity, "0.5", "start callback: opacity is 0.5");

});

test("{ zIndex: 10 }", function() {

expect(1);

var zIndex = null;
$("#draggable2").draggable({
zIndex: 10,
start: function(e, ui) {
zIndex = $(this).css("zIndex");
}
});

drag("#draggable2", -1, -1);

equals(zIndex, "10", "start callback: zIndex is 10");

});

test("callbacks occurance count", function() {

expect(3);

var start = 0, stop = 0, dragc = 0;
$("#draggable2").draggable({
start: function() { start++; },
drag: function() { dragc++; },
stop: function() { stop++; }
});

drag("#draggable2", 10, 10);

equals(start, 1, "start callback should happen exactly once");
equals(dragc, 11, "drag callback should happen exactly 1+10 times (first simultaneously with start)");
equals(stop, 1, "stop callback should happen exactly once");

});



0 comments on commit 737ff73

Please sign in to comment.
You can’t perform that action at this time.