Skip to content
Permalink
Browse files

Menu: Rename icon option to icons.submenu

  • Loading branch information...
jzaefferer committed Jul 12, 2012
1 parent 1510f7e commit 7759fb4dba5d4135297994a8292dad093d704e19
@@ -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

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

0 comments on commit 7759fb4

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