]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu tests: Check default is prevented on any click on disabled menus
authorKris Borchers <kris.borchers@gmail.com>
Mon, 15 Jul 2013 02:52:35 +0000 (21:52 -0500)
committerScott González <scott.gonzalez@gmail.com>
Tue, 26 Nov 2013 16:30:18 +0000 (11:30 -0500)
(cherry picked from commit a74ac174cca67c57ddd79a3c4f2f34d291edf2dd)

tests/unit/menu/menu_events.js

index 3c94a5a6c14238d026707a090390f8598d32c541..093c9fe072d7731a054c8e12347ba5485c1be12f 100644 (file)
@@ -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 );