diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2015-02-17 16:11:58 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2015-03-04 23:04:07 +0100 |
commit | 666f051c3a7c0313acacad0255ab8a45697777c3 (patch) | |
tree | ce60522e6bd237ca14ae41270e6e6159190593e5 /tests/unit/menu | |
parent | 19783fd3e6a6e6e02a2030028e8820076c3b1295 (diff) | |
download | jquery-ui-666f051c3a7c0313acacad0255ab8a45697777c3.tar.gz jquery-ui-666f051c3a7c0313acacad0255ab8a45697777c3.zip |
Tests: Reduce timeouts to optimize testsuite runtime
Diffstat (limited to 'tests/unit/menu')
-rw-r--r-- | tests/unit/menu/menu_core.js | 4 | ||||
-rw-r--r-- | tests/unit/menu/menu_events.js | 42 | ||||
-rw-r--r-- | tests/unit/menu/menu_methods.js | 8 |
3 files changed, 26 insertions, 28 deletions
diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index f02f97fca..5be717a66 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -54,9 +54,9 @@ asyncTest( "#9532: Need a way in Menu to keep ui-state-active class on selected element.menu( "focus", null, firstChild ); wrapper.addClass( "ui-state-active" ); setTimeout( function() { - ok( wrapper.is( ".ui-state-active" ), "ui-state-active improperly removed" ); + ok( wrapper.is( ".ui-state-active" ) ); start(); - }, 500 ); + }); }); })( jQuery ); diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index b1ade3b85..ad13de3b8 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -111,62 +111,66 @@ asyncTest( "handle focus of menu with active item", function() { }); }); -asyncTest( "handle submenu auto collapse: mouseleave", function() { +asyncTest( "handle submenu auto collapse: mouseleave, default markup", function() { expect( 4 ); + $.ui.menu.prototype.delay = 1; var element = $( "#menu2" ).menu(), event = $.Event( "mouseenter" ); function menumouseleave1() { equal( element.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" ); element.menu( "focus", event, element.find( "li:nth-child(7) li:first" ) ); - setTimeout( menumouseleave2, 350 ); + setTimeout( menumouseleave2, 25 ); } function menumouseleave2() { equal( element.find( "ul[aria-expanded='true']" ).length, 2, "second submenu expanded" ); element.find( "ul[aria-expanded='true']:first" ).trigger( "mouseleave" ); - setTimeout( menumouseleave3, 350 ); + setTimeout( menumouseleave3, 25 ); } function menumouseleave3() { equal( element.find( "ul[aria-expanded='true']" ).length, 1, "second submenu collapsed" ); element.trigger( "mouseleave" ); - setTimeout( menumouseleave4, 350 ); + setTimeout( menumouseleave4, 25 ); } function menumouseleave4() { equal( element.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" ); + $.ui.menu.prototype.delay = 300; start(); } element.find( "li:nth-child(7)" ).trigger( "mouseenter" ); - setTimeout( menumouseleave1, 350 ); + setTimeout( menumouseleave1, 25 ); }); -asyncTest( "handle submenu auto collapse: mouseleave", function() { +asyncTest( "handle submenu auto collapse: mouseleave, custom markup", function() { expect( 4 ); + $.ui.menu.prototype.delay = 1; var element = $( "#menu5" ).menu({ menus: ".menu" }), event = $.Event( "mouseenter" ); function menumouseleave1() { equal( element.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" ); element.menu( "focus", event, element.find( ":nth-child(7)" ).find( ".menu" ).eq( 0 ).children().eq( 0 ) ); - setTimeout( menumouseleave2, 350 ); + setTimeout( menumouseleave2, 25 ); } function menumouseleave2() { equal( element.find( "div[aria-expanded='true']" ).length, 2, "second submenu expanded" ); element.find( "div[aria-expanded='true']:first" ).trigger( "mouseleave" ); - setTimeout( menumouseleave3, 350 ); + setTimeout( menumouseleave3, 25 ); } function menumouseleave3() { equal( element.find( "div[aria-expanded='true']" ).length, 1, "second submenu collapsed" ); element.trigger( "mouseleave" ); - setTimeout( menumouseleave4, 350 ); + setTimeout( menumouseleave4, 25 ); } function menumouseleave4() { equal( element.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" ); + $.ui.menu.prototype.delay = 300; start(); } element.find( ":nth-child(7)" ).trigger( "mouseenter" ); - setTimeout( menumouseleave1, 350 ); + setTimeout( menumouseleave1, 25 ); }); asyncTest( "handle keyboard navigation on menu without scroll and without submenus", function() { @@ -251,7 +255,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); equal( logOutput(), "keydown,1,2", "Keydown DOWN" ); - setTimeout( menukeyboard1, 50 ); + setTimeout( menukeyboard1 ); }); element.focus(); @@ -274,8 +278,8 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" setTimeout(function() { equal( logOutput(), "keydown,1,2,3,4,0", "Keydown RIGHT (open submenu)" ); - setTimeout( menukeyboard2, 50 ); - }, 50 ); + setTimeout( menukeyboard2 ); + } ); } function menukeyboard2() { @@ -285,7 +289,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" // re-open submenu element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); - setTimeout( menukeyboard3, 50 ); + setTimeout( menukeyboard3 ); } function menukeyboard3() { @@ -319,7 +323,7 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" log( "keydown", true ); element.simulate( "keydown", { keyCode: $.ui.keyCode.SPACE } ); - setTimeout( menukeyboard4, 50 ); + setTimeout( menukeyboard4 ); } function menukeyboard4() { @@ -344,9 +348,9 @@ asyncTest( "handle keyboard navigation on menu without scroll and with submenus" log( "keydown", true ); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - setTimeout( menukeyboard6, 50 ); - }, 50 ); - }, 50 ); + setTimeout( menukeyboard6 ); + } ); + } ); } function menukeyboard6() { @@ -446,7 +450,7 @@ asyncTest( "handle keyboard navigation on menu with scroll and with submenus", f element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); equal( logOutput(), "keydown,1,2", "Keydown DOWN" ); - setTimeout( menukeyboard1, 50 ); + setTimeout( menukeyboard1 ); }); element.focus(); diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index ef8279018..1cc3ec179 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -11,19 +11,13 @@ module( "menu: methods", { }); test( "destroy", function() { - expect( 4 ); - domEqual( "#menu1", function() { - $( "#menu1" ).menu().menu( "destroy" ); - }); + expect( 2 ); domEqual( "#menu2", function() { $( "#menu2" ).menu().menu( "destroy" ); }); domEqual( "#menu5", function() { $( "#menu5").menu().menu( "destroy" ); }); - domEqual( "#menu6", function() { - $( "#menu6" ).menu().menu( "destroy" ); - }); }); test( "enable/disable", function() { |