]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: Rename icon option to icons.submenu 697/head 698/head
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 12 Jul 2012 15:23:33 +0000 (17:23 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 12 Jul 2012 15:50:34 +0000 (17:50 +0200)
demos/menu/topalignmenu.html
tests/unit/menu/menu.html
tests/unit/menu/menu_common.js
tests/unit/menu/menu_options.js
ui/jquery.ui.menu.js

index 62373ba9db76c3b36758e07d9e12d2dcde8b6f9b..a6ac115203119f59a7f74964f02acfbf14a75fb2 100644 (file)
        <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>
index c58b9fc65805a9cfcefe10d5e2c7c7d705b15019..ed376232ede59986ee4278587cbd3993a341d1cc 100644 (file)
 </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">
index 2ab32ac05ef5e8f86eaa70173601100bddabccf3..4a89a947a891ab556438239cce08c7225a9ee2a9 100644 (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",
index 1ccbb20ab3aa453900dbf2d124486b5108b16383..a8b029201349b7759d43617e0e090af77c90844d 100644 (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
 
index e57d1985a2edc605ad785576ccb162d44de95db7..81fef2e7c6869f7ab1a6c0743d8b345f372c5e48 100644 (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()