mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Menu: Reset ui-menu-icons class in refresh. Fixes #9377: Menu: Refreshing should recheck for menu icons
This commit is contained in:
parent
b5c41a2b33
commit
91b7b9f9ab
@ -69,6 +69,19 @@ test( "refresh submenu", function() {
|
||||
equal( element.find( "ul:first .ui-menu-item" ).length, 4 );
|
||||
});
|
||||
|
||||
test( "refresh icons (see #9377)", function() {
|
||||
expect( 3 );
|
||||
var element = $( "#menu1" ).menu();
|
||||
ok( !element.hasClass( "ui-menu-icons") );
|
||||
element.find( "li:first a" ).html( '<span class="ui-icon ui-icon-disk"></span>Save</a>' );
|
||||
element.menu( "refresh" );
|
||||
|
||||
ok( element.hasClass( "ui-menu-icons" ) );
|
||||
element.find( "li:first a" ).html( "Save" );
|
||||
element.menu( "refresh" );
|
||||
ok( !element.hasClass( "ui-menu-icons") );
|
||||
});
|
||||
|
||||
test( "widget", function() {
|
||||
expect( 2 );
|
||||
var element = $( "#menu1" ).menu(),
|
||||
|
2
ui/jquery.ui.menu.js
vendored
2
ui/jquery.ui.menu.js
vendored
@ -282,6 +282,8 @@ $.widget( "ui.menu", {
|
||||
icon = this.options.icons.submenu,
|
||||
submenus = this.element.find( this.options.menus );
|
||||
|
||||
this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
|
||||
|
||||
// Initialize nested menus
|
||||
submenus.filter( ":not(.ui-menu)" )
|
||||
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
||||
|
Loading…
Reference in New Issue
Block a user