element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( element.text(), customVal );
start();
- }, 50 );
+ });
});
asyncTest( "ESCAPE in multiline autocomplete", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( element.text(), customVal );
start();
- }, 50 );
+ });
});
asyncTest( "handle race condition", function() {
equal( count, 1, "request with 1 character is first" );
setTimeout(function() {
response([ "one" ]);
- setTimeout( checkResults, 1 );
- }, 1 );
+ setTimeout( checkResults );
+ });
return;
}
equal( count, 2, "request with 2 characters is second" );
// blur must be async for IE to handle it properly
setTimeout(function() {
element.simulate( "blur" );
- }, 1 );
- }, 50 );
+ });
+ });
});
});
ok( menu.is( ":visible" ), "menu is visible after second search" );
equal( menu.find( ".ui-menu-item" ).length, 2, "# of menu items" );
start();
- }, 50 );
- }, 50 );
+ });
+ });
});
asyncTest( "cancel focus", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( element.val(), customVal );
start();
- }, 50 );
+ });
});
asyncTest( "cancel select", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( element.val(), customVal );
start();
- }, 50 );
+ });
});
asyncTest( "blur during remote search", function() {
setTimeout(function() {
response([ "result" ]);
start();
- }, 100 );
+ }, 25);
},
open: function() {
ok( false, "opened after a blur" );
expect( 2 );
var element = $( "#autocomplete" ).autocomplete({
source: data,
- delay: 50
+ delay: 25
}),
menu = element.autocomplete( "widget" );
element.val( "ja" ).keydown();
setTimeout(function() {
ok( menu.is( ":visible" ), "menu is open after delay" );
start();
- }, 100 );
+ }, 50 );
});
asyncTest( "disabled", function() {
setTimeout(function() {
ok( menu.is( ":hidden" ) );
start();
- }, 50 );
+ });
});
test( "minLength", function() {
equal( req.term, "12", "correct search term" );
setTimeout(function() {
res([ "item" ]);
- }, 1 );
+ });
}
}),
menu = element.autocomplete( "widget" );
setTimeout(function() {
ok( menu.is( ":hidden" ), "menu is hidden after searches" );
start();
- }, 50 );
+ });
});
test( "minLength, exceed then drop below then exceed", function() {
equal($(window).scrollTop(), initialScroll, "scroll hasn't moved after focus moved to dialog");
element.dialog("destroy");
start();
- }, 500);
+ });
});
test("#5184: isOpen in dialogclose event is true", function() {
$( "#favorite-animal" ).focus();
ok( true, "close and destroy modal dialog before its really opened" );
start();
- }, 2 );
+ });
});
test("#4980: Destroy should place element back in original DOM position", function(){
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 );
});
});
-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() {
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();
setTimeout(function() {
equal( logOutput(), "keydown,1,2,3,4,0", "Keydown RIGHT (open submenu)" );
- setTimeout( menukeyboard2, 50 );
- }, 50 );
+ setTimeout( menukeyboard2 );
+ } );
}
function menukeyboard2() {
// re-open submenu
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
- setTimeout( menukeyboard3, 50 );
+ setTimeout( menukeyboard3 );
}
function menukeyboard3() {
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.SPACE } );
- setTimeout( menukeyboard4, 50 );
+ setTimeout( menukeyboard4 );
}
function menukeyboard4() {
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
- setTimeout( menukeyboard6, 50 );
- }, 50 );
- }, 50 );
+ setTimeout( menukeyboard6 );
+ } );
+ } );
}
function menukeyboard6() {
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();
});
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() {
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;
- element.tabs( "instance" ).delay = 50;
+ element.tabs( "instance" ).delay = 1;
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
tabs.eq( 0 ).simulate( "focus" );
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step2, 100 );
+ setTimeout( step2, 25 );
}
// left, home, space
// SPACE activates, cancels delay
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.SPACE } );
- setTimeout( step3, 1 );
+ setTimeout( step3 );
}
// end, enter
// ENTER activates, cancels delay
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.ENTER } );
- setTimeout( step4, 1 );
+ setTimeout( step4 );
}
// enter (collapse)
equal( tabs.eq( 2 ).attr( "aria-expanded" ), "false", "third tab has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
- setTimeout( start, 1 );
+ setTimeout( start );
}
- setTimeout( step1, 1 );
+ setTimeout( step1 );
});
// Navigation with CTRL and COMMAND (both behave the same)
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;
- element.tabs( "instance" ).delay = 50;
+ element.tabs( "instance" ).delay = 1;
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
tabs.eq( 0 ).simulate( "focus" );
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step2, 100 );
+ setTimeout( step2, 25 );
}
// right
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step3, 100 );
+ setTimeout( step3, 25 );
}
// down (wrap)
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step4, 100 );
+ setTimeout( step4, 25 );
}
// up (wrap)
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step5, 100 );
+ setTimeout( step5, 25 );
}
// left
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step6, 100 );
+ setTimeout( step6, 25 );
}
// home
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step7, 100 );
+ setTimeout( step7, 25 );
}
// end
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "true", "first tab has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
- setTimeout( step8, 100 );
+ setTimeout( step8, 25 );
}
// space
equal( tabs.eq( 0 ).attr( "aria-expanded" ), "false", "first tab has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
- setTimeout( start, 1 );
+ setTimeout( start );
}
- setTimeout( step1, 1 );
+ setTimeout( step1 );
});
});
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
panels.eq( 0 ).simulate( "focus" );
- setTimeout( step2, 1 );
+ setTimeout( step2 );
}
function step2() {
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
panels.eq( 1 ).simulate( "focus" );
- setTimeout( step3, 1 );
+ setTimeout( step3 );
}
function step3() {
panels.eq( 1 ).simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } );
strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );
- setTimeout( start, 1 );
+ setTimeout( start );
}
- setTimeout( step1, 1 );
+ setTimeout( step1 );
});
test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
equal( uiPanel.find( "p" ).length, 1, "panel html" );
state( element, 1, 0, 0, 0, 0 );
- setTimeout( tabsload1, 100 );
+ setTimeout( tabsload1 );
});
element.tabs( "load", 3 );
state( element, 1, 0, 0, 0, 0 );
});
element.one( "tabsload", function() {
ok( true, "tabsload invoked" );
- setTimeout( tabsload2, 100 );
+ setTimeout( tabsload2 );
});
element.tabs( "option", "active", 3 );
state( element, 0, 0, 0, 1, 0 );
equal( options, "drop", "correct options in _show()" );
setTimeout(function() {
callback();
- }, 1 );
+ });
};
widget._hide = function( element, options, callback ) {
strictEqual( element[ 0 ], panels[ 0 ], "correct element in _hide()" );
setTimeout(function() {
callback();
start();
- }, 1 );
+ });
};
ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" );