mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Menu: Allow changing icons option after creation. Fixes #8927 - Menu: Can't change icons option after init
This commit is contained in:
parent
0d53fbfd0b
commit
2c3d311f90
@ -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() {
|
||||
|
9
ui/jquery.ui.menu.js
vendored
9
ui/jquery.ui.menu.js
vendored
@ -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" );
|
||||
|
Loading…
Reference in New Issue
Block a user