Skip to content
Permalink
Browse files

Menu tests: Check default is prevented on any click on disabled menus

  • Loading branch information...
kborchers committed Jul 15, 2013
1 parent 2f49702 commit a74ac174cca67c57ddd79a3c4f2f34d291edf2dd
Showing with 21 additions and 0 deletions.
  1. +21 −0 tests/unit/menu/menu_events.js
@@ -598,4 +598,25 @@ asyncTest( "handle keyboard navigation with spelling of menu items", function()
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) {

This comment has been minimized.

Copy link
@scottgonzalez
if ( !event.isDefaultPrevented() ) {
log();
}
});
log( "click", true );
click( $( "#menu1" ), "1" );

This comment has been minimized.

Copy link
@scottgonzalez

scottgonzalez Jul 15, 2013

Member

use element

log( "afterclick,disable" );
element.menu("option", "disabled", true);

This comment has been minimized.

Copy link
@scottgonzalez
click( element, "2" );
click( $( "#menu1" ), "3" );

This comment has been minimized.

Copy link
@scottgonzalez

scottgonzalez Jul 15, 2013

Member

use element

click( element, "1" );
log( "enable" );
element.menu("option", "disabled", false);

This comment has been minimized.

Copy link
@scottgonzalez
click( element, "3" );
equal( logOutput(), "click,1,afterclick,disable,enable,3", "Click order not valid." );
});

})( jQuery );

0 comments on commit a74ac17

Please sign in to comment.
You can’t perform that action at this time.