]> source.dussan.org Git - jquery-ui.git/commitdiff
Calendar tests: Simplify timeout steps
authorFelix Nagel <info@felixnagel.com>
Tue, 11 Oct 2016 23:09:03 +0000 (01:09 +0200)
committerFelix Nagel <info@felixnagel.com>
Tue, 11 Oct 2016 23:09:03 +0000 (01:09 +0200)
tests/unit/calendar/events.js

index d69aa137f9c7e1886ff8c7c60b3cf6fa0f1afa12..fef9d6bf5e5f6d4ff8aa5b40e71644b9dda0b52b 100644 (file)
@@ -69,32 +69,26 @@ asyncTest( "select", function() {
        } );
 
        function step1() {
-               setTimeout( function() {
-                       eventType = "mousedown";
-                       message = "on calendar button " + eventType;
-                       that.element.find( "table button:eq(1)" ).simulate( eventType );
-                       step2();
-               }, 50 );
+               eventType = "mousedown";
+               message = "on calendar button " + eventType;
+               that.element.find( "table button:eq(1)" ).simulate( eventType );
+               setTimeout( step2, 50 );
        }
 
        function step2() {
-               setTimeout( function() {
-                       eventType = "keydown";
-                       message = "on calendar button " + eventType;
-                       testHelper.focusGrid( that.element )
-                               .simulate( eventType, { keyCode: $.ui.keyCode.END } )
-                               .simulate( eventType, { keyCode: $.ui.keyCode.ENTER } );
-                       step3();
-               }, 50 );
+               eventType = "keydown";
+               message = "on calendar button " + eventType;
+               testHelper.focusGrid( that.element )
+                       .simulate( eventType, { keyCode: $.ui.keyCode.END } )
+                       .simulate( eventType, { keyCode: $.ui.keyCode.ENTER } );
+               setTimeout( step3, 50 );
        }
 
        // This should not trigger another event
        function step3() {
-               setTimeout( function() {
-                       that.element.calendar( "disable" );
-                       that.element.find( "table button:eq(10)" ).simulate( "mousedown" );
-                       start();
-               }, 50 );
+               that.element.calendar( "disable" );
+               that.element.find( "table button:eq(10)" ).simulate( "mousedown" );
+               setTimeout( start, 50 );
        }
 
        step1();