diff --git a/ui/tests/autodrag.html b/ui/tests/autodrag.html index 044716f66..2f8f2b2b9 100644 --- a/ui/tests/autodrag.html +++ b/ui/tests/autodrag.html @@ -28,11 +28,43 @@ $(function() { speed: "fast" }); - $('#begin').click(function(e) { + var queue; + var start = function() { + queue = tests.slice(); // clone $("#status").text("Running..."); - $(".drag:eq(0)").testMouse("drag", 100, 0, function() { - $('#status').text("Ready"); - }); + nextTest(); + } + var stop = function() { + $("#status").text("Ready"); + } + + var tests = []; + var nextTest = function() { + if (queue.length) { + queue.pop().apply(); + } else { + stop(); + } + } + + var addTest = function(fn) { + tests.unshift(fn); + } + + addTest(function() { + $("#d1").testMouse("drag", 100, 0, nextTest); + }); + + addTest(function() { + $("#d2").testMouse("drag", 100, 0, nextTest); + }); + + addTest(function() { + $("#d3").testMouse("drag", 100, 0, nextTest); + }); + + $('#begin').click(function(e) { + start(); }); }); @@ -49,15 +81,15 @@ $(function() {
-
+
Drag 1
-
+
Drag 2
-
+
Drag 3