From a74ac174cca67c57ddd79a3c4f2f34d291edf2dd Mon Sep 17 00:00:00 2001 From: Kris Borchers Date: Sun, 14 Jul 2013 21:52:35 -0500 Subject: [PATCH] Menu tests: Check default is prevented on any click on disabled menus --- tests/unit/menu/menu_events.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 3c94a5a6c..093c9fe07 100644 --- a/tests/unit/menu/menu_events.js +++ b/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) { + if ( !event.isDefaultPrevented() ) { + log(); + } + }); + log( "click", true ); + click( $( "#menu1" ), "1" ); + log( "afterclick,disable" ); + element.menu("option", "disabled", true); + click( element, "2" ); + click( $( "#menu1" ), "3" ); + click( element, "1" ); + log( "enable" ); + element.menu("option", "disabled", false); + click( element, "3" ); + equal( logOutput(), "click,1,afterclick,disable,enable,3", "Click order not valid." ); +}); + })( jQuery ); -- 2.39.5