}
});
log( "click", true );
- click( $( "#menu1" ), "1" );
+ click( element, "1" );
log( "afterclick" );
click( element, "2" );
- click( $( "#menu1" ), "3" );
+ click( element, "3" );
click( element, "1" );
equal( logOutput(), "click,1,afterclick,2,3,1", "Click order not valid." );
});
menus: "div"
});
log( "click", true );
- click( $( "#menu5" ), "1" );
+ click( element, "1" );
log( "afterclick" );
click( element, "2" );
- click( $( "#menu5" ), "3" );
+ click( element, "3" );
click( element, "1" );
equal( logOutput(), "click,1,afterclick,2,3,1", "Click order not valid." );
});
});
log( "focus", true );
- element[0].focus();
+ element[ 0 ].focus();
setTimeout(function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
- element[0].blur();
+ element[ 0 ].blur();
setTimeout(function() {
- element[0].focus();
+ element[ 0 ].focus();
setTimeout(function() {
equal( logOutput(), "focus,0,1,2,2", "current active item remains active" );
start();
expect( 12 );
var element = $( "#menu1" ).menu({
select: function( event, ui ) {
- log( $( ui.item[0] ).text() );
+ log( $( ui.item[ 0 ] ).text() );
},
focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
});
log( "keydown", true );
- element[0].focus();
+ element[ 0 ].focus();
setTimeout(function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
expect( 14 );
var element = $( "#menu3" ).menu({
select: function( event, ui ) {
- log( $( ui.item[0] ).text() );
+ log( $( ui.item[ 0 ] ).text() );
},
focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
});
log( "keydown", true );
- element[0].focus();
+ element[ 0 ].focus();
setTimeout(function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
expect( 14 );
var element = $( "#menu4" ).menu({
select: function( event, ui ) {
- log( $( ui.item[0] ).text() );
+ log( $( ui.item[ 0 ] ).text() );
},
focus: function( event ) {
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
equal( logOutput(), "keydown,0,1,3,4", "Keydown focus Delphi by repeating the 'd' again" );
start();
});
- element[0].focus();
+ element[ 0 ].focus();
});
test( "ensure default is prevented when clicking on anchors in disabled menus ", function() {
expect( 1 );
var element = $( "#menu1" ).menu();
- element.bind("click.menu", function(event) {
+ element.bind( "click.menu", function(event) {
if ( !event.isDefaultPrevented() ) {
log();
}
});
log( "click", true );
- click( $( "#menu1" ), "1" );
+ click( element, "1" );
log( "afterclick,disable" );
- element.menu("option", "disabled", true);
+ element.menu( "option", "disabled", true );
click( element, "2" );
- click( $( "#menu1" ), "3" );
+ click( element, "3" );
click( element, "1" );
log( "enable" );
- element.menu("option", "disabled", false);
+ element.menu( "option", "disabled", false );
click( element, "3" );
equal( logOutput(), "click,1,afterclick,disable,enable,3", "Click order not valid." );
});