Menu: Rename icon option to icons.submenu

This commit is contained in:
Jörn Zaefferer 2012-07-12 17:23:33 +02:00
parent 1510f7e28a
commit 7759fb4dba
5 changed files with 27 additions and 10 deletions

View File

@ -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>

View File

@ -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">

View File

@ -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",

View File

@ -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

View File

@ -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()