Skip to content
Permalink
Browse files

Menu: Allow changing icons option after creation. Fixes #8927 - Menu:…

… Can't change icons option after init
  • Loading branch information...
jzaefferer committed Dec 27, 2012
1 parent 0d53fbf commit 2c3d311f90281e95827708e2e8d0e52832a437de
Showing with 13 additions and 1 deletion.
  1. +4 −1 tests/unit/menu/menu_options.js
  2. +9 −0 ui/jquery.ui.menu.js
@@ -41,9 +41,12 @@ test( "{ disabled: false }", function() {
});

test( "{ icons: default }", function() {
expect( 1 );
expect( 2 );
var element = $( "#menu2" ).menu();
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-carat-1-e" );

element.menu("option", "icons.submenu", "ui-icon-triangle-1-e");
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-triangle-1-e" );
});

test( "{ icons: { submenu: 'custom' } }", function() {
@@ -343,6 +343,15 @@ $.widget( "ui.menu", {
}[ this.options.role ];
},

_setOption: function( key, value ) {
if ( key === "icons" ) {
this.element.find( ".ui-menu-icon" )
.removeClass( this.options.icons.submenu )
.addClass( value.submenu );
}
this._super( key, value );
},

focus: function( event, item ) {
var nested, focused;
this.blur( event, event && event.type === "focus" );

0 comments on commit 2c3d311

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