<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>
</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">
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",
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
defaultElement: "<ul>",
delay: 300,
options: {
- icon: "ui-icon-carat-1-e",
+ icons: {
+ submenu: "ui-icon-carat-1-e"
+ },
menus: "ul",
position: {
my: "left top",
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()