\r
});\r
\r
+test("{ distance: 10 }", function() {\r
+\r
+ expect(2);\r
+\r
+ var dragged = false;\r
+ $("#draggable2").draggable({\r
+ distance: 10,\r
+ start: function(e, ui) {\r
+ dragged = true;\r
+ }\r
+ });\r
+ \r
+ drag("#draggable2", -9, -9);\r
+ equals(dragged, false, "The draggable should not have moved when moving -9px");\r
+ \r
+ drag("#draggable2", -10, -10);\r
+ equals(dragged, true, "The draggable should have moved when moving -10px");\r
+\r
+});\r
+\r
+test("{ opacity: 0.5 }", function() {\r
+\r
+ expect(1);\r
+\r
+ var opacity = null;\r
+ $("#draggable2").draggable({\r
+ opacity: 0.5,\r
+ start: function(e, ui) {\r
+ opacity = $(this).css("opacity");\r
+ }\r
+ });\r
+ \r
+ drag("#draggable2", -1, -1);\r
+\r
+ equals(opacity, "0.5", "start callback: opacity is 0.5");\r
+\r
+});\r
+\r
+test("{ zIndex: 10 }", function() {\r
+\r
+ expect(1);\r
+\r
+ var zIndex = null;\r
+ $("#draggable2").draggable({\r
+ zIndex: 10,\r
+ start: function(e, ui) {\r
+ zIndex = $(this).css("zIndex");\r
+ }\r
+ });\r
+ \r
+ drag("#draggable2", -1, -1);\r
+\r
+ equals(zIndex, "10", "start callback: zIndex is 10");\r
+\r
+});\r
+\r
+test("callbacks occurance count", function() {\r
+\r
+ expect(3);\r
+\r
+ var start = 0, stop = 0, dragc = 0;\r
+ $("#draggable2").draggable({\r
+ start: function() { start++; },\r
+ drag: function() { dragc++; },\r
+ stop: function() { stop++; }\r
+ });\r
+ \r
+ drag("#draggable2", 10, 10);\r
+\r
+ equals(start, 1, "start callback should happen exactly once");\r
+ equals(dragc, 11, "drag callback should happen exactly 1+10 times (first simultaneously with start)");\r
+ equals(stop, 1, "stop callback should happen exactly once");\r
+\r
+});\r
+\r
\r
\r