mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Menu: Rename icon option to icons.submenu
This commit is contained in:
parent
1510f7e28a
commit
7759fb4dba
@ -13,7 +13,10 @@
|
||||
<script>
|
||||
$(function() {
|
||||
$( "#menu" ).menu({
|
||||
position: { of: "ul:has(a.ui-state-focus):last" }
|
||||
position: { of: "ul:has(a.ui-state-focus):last" },
|
||||
icons: {
|
||||
submenu: "ui-icon-carat-1-e"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -44,11 +44,7 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="qunit-header">jQuery UI Menu Test Suite</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit">jQuery UI Menu Test Suite</div>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
<ul class="foo" id="menu1">
|
||||
|
@ -1,7 +1,9 @@
|
||||
TestHelpers.commonWidgetTests( "menu", {
|
||||
defaults: {
|
||||
disabled: false,
|
||||
icon: "ui-icon-carat-1-e",
|
||||
icons: {
|
||||
submenu: "ui-icon-carat-1-e"
|
||||
},
|
||||
menus: "ul",
|
||||
position: {
|
||||
my: "left top",
|
||||
|
@ -40,7 +40,21 @@ test( "{ disabled: false }", function() {
|
||||
equal( logOutput(), "click,1,afterclick", "Click order not valid." );
|
||||
});
|
||||
|
||||
// TODO: test icon option
|
||||
test( "{ icons: default }", function() {
|
||||
expect( 1 );
|
||||
var element = $( "#menu2" ).menu();
|
||||
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-carat-1-e" );
|
||||
});
|
||||
|
||||
test( "{ icons: { submenu: 'custom' } }", function() {
|
||||
expect( 1 );
|
||||
var element = $( "#menu2" ).menu({
|
||||
icons: {
|
||||
submenu: "custom-class"
|
||||
}
|
||||
});
|
||||
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon custom-class" );
|
||||
});
|
||||
|
||||
// TODO: test menus option
|
||||
|
||||
|
6
ui/jquery.ui.menu.js
vendored
6
ui/jquery.ui.menu.js
vendored
@ -22,7 +22,9 @@ $.widget( "ui.menu", {
|
||||
defaultElement: "<ul>",
|
||||
delay: 300,
|
||||
options: {
|
||||
icon: "ui-icon-carat-1-e",
|
||||
icons: {
|
||||
submenu: "ui-icon-carat-1-e"
|
||||
},
|
||||
menus: "ul",
|
||||
position: {
|
||||
my: "left top",
|
||||
@ -276,7 +278,7 @@ $.widget( "ui.menu", {
|
||||
refresh: function() {
|
||||
// Initialize nested menus
|
||||
var menus,
|
||||
icon = this.options.icon,
|
||||
icon = this.options.icons.submenu,
|
||||
submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
|
||||
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
||||
.hide()
|
||||
|
Loading…
Reference in New Issue
Block a user