aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/draggable/draggable_events.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/draggable/draggable_events.js')
-rw-r--r--tests/unit/draggable/draggable_events.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/draggable/draggable_events.js b/tests/unit/draggable/draggable_events.js
new file mode 100644
index 000000000..79b406e8c
--- /dev/null
+++ b/tests/unit/draggable/draggable_events.js
@@ -0,0 +1,27 @@
+/*
+ * draggable_events.js
+ */
+(function($) {
+
+module("draggable: events");
+
+test("callbacks occurance count", function() {
+
+ expect(3);
+
+ var start = 0, stop = 0, dragc = 0;
+ el = $("#draggable2").draggable({
+ start: function() { start++; },
+ drag: function() { dragc++; },
+ stop: function() { stop++; }
+ });
+
+ drag(el, 10, 10);
+
+ equals(start, 1, "start callback should happen exactly once");
+ equals(dragc, 3, "drag callback should happen exactly once per mousemove");
+ equals(stop, 1, "stop callback should happen exactly once");
+
+});
+
+})(jQuery);