aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/static/index.html2
-rw-r--r--tests/unit/index.html1
-rw-r--r--tests/unit/menu/menu.html74
-rw-r--r--tests/unit/menu/menu_core.js32
-rw-r--r--tests/unit/menu/menu_defaults.js11
-rw-r--r--tests/unit/menu/menu_events.js24
-rw-r--r--tests/unit/menu/menu_methods.js19
-rw-r--r--tests/unit/menu/menu_options.js10
-rw-r--r--tests/unit/menu/menu_tickets.js8
-rw-r--r--tests/visual/all.html1
-rw-r--r--tests/visual/autocomplete/autocomplete.html1
-rw-r--r--tests/visual/compound/widgets_in_dialog.html2
-rw-r--r--tests/visual/index.html8
-rw-r--r--tests/visual/menu/contextmenu.html55
-rw-r--r--tests/visual/menu/drilldown.html17
-rw-r--r--tests/visual/menu/menu.html60
-rw-r--r--tests/visual/menu/menubar.html94
-rw-r--r--tests/visual/menu/nested.html10
-rw-r--r--tests/visual/position/position.html2
19 files changed, 349 insertions, 82 deletions
diff --git a/tests/static/index.html b/tests/static/index.html
index 80048bf42..3145ad219 100644
--- a/tests/static/index.html
+++ b/tests/static/index.html
@@ -32,6 +32,8 @@
<li><a href="button/default.html">Button</a></li>
<li><a href="datepicker/default.html">Datepicker</a></li>
<li><a href="dialog/default.html">Dialog</a></li>
+ <li><a href="menu/default.html">Menu</a></li>
+ <li><a href="menu/all-menus-icons.html">Menu with icons</a></li>
<li><a href="progressbar/default.html">Progressbar</a></li>
<li><a href="slider/default.html">Slider</a></li>
<li><a href="tabs/default.html">Tabs</a></li>
diff --git a/tests/unit/index.html b/tests/unit/index.html
index 33de9e765..1566cfc38 100644
--- a/tests/unit/index.html
+++ b/tests/unit/index.html
@@ -24,6 +24,7 @@
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.accordion.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.datepicker.js"></script>
diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html
new file mode 100644
index 000000000..b47728641
--- /dev/null
+++ b/tests/unit/menu/menu.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Menu Test Suite</title>
+
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
+
+ <script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
+ <script type="text/javascript" src="../../../external/qunit.js"></script>
+ <script type="text/javascript" src="../../jquery.simulate.js"></script>
+ <script type="text/javascript" src="../testsuite.js"></script>
+
+ <script type="text/javascript">
+
+ function log(message,clear) {
+ if (clear && clear === true) {
+ $("#log").html("");
+ }
+ if ( message === undefined ) {
+ message = $("#log").data("lastItem");
+ }
+ $("#log").prepend( message + "," );
+ }
+ function clickMenu(menu,item) {
+ $("#log").data("lastItem",item);
+ $('li:eq(' + item + ') a',menu).trigger("click");
+ }
+
+
+ </script>
+ <script type="text/javascript" src="menu_core.js"></script>
+ <script type="text/javascript" src="menu_defaults.js"></script>
+ <script type="text/javascript" src="menu_events.js"></script>
+ <script type="text/javascript" src="menu_methods.js"></script>
+ <script type="text/javascript" src="menu_options.js"></script>
+ <script type="text/javascript" src="menu_tickets.js"></script>
+
+
+ <style>
+ #main { font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
+ #list, #list1 *, #navigation, #navigation * { margin: 0; padding: 0; font-size: 12px; }
+ .mainOnMoon {position: absolute; top: -10000px; left: -10000px;}
+ </style>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Menu Test Suite</h1>
+<h2 id="qunit-banner"></h2>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests">
+</ol>
+
+
+<div id="main" class="mainOnMoon">
+
+<ul class="foo" id="menu1">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+</ul>
+<div id="log"></div>
+
+</div>
+
+</body>
+</html>
diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js
new file mode 100644
index 000000000..a1cf11b7f
--- /dev/null
+++ b/tests/unit/menu/menu_core.js
@@ -0,0 +1,32 @@
+/*
+ * menu_core.js
+ */
+
+
+(function($) {
+
+module("menu: core");
+
+test("accessibility", function () {
+ expect(3);
+ var ac = $('#menu1').menu();
+ var item0 = $("li:eq(0) a");
+
+ ok( ac.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
+ equals( ac.attr("role"), "listbox", "main role");
+ equals( ac.attr("aria-activedescendant"), "ui-active-menuitem", "aria attribute");
+});
+
+test("items class and role", function () {
+ var ac = $('#menu1').menu();
+ expect(1 + 4 * $("li",ac).length);
+ ok( ($("li",ac).length > 0 ), "number of menu items");
+ $("li",ac).each(function(item) {
+ ok( $(this).hasClass("ui-menu-item"), "menu item ("+ item + ") class for item");
+ equals( $(this).attr("role"), "menuitem", "menu item ("+ item + ") role");
+ ok( $("a",this).hasClass("ui-corner-all"), "a element class for menu item ("+ item + ") ");
+ equals( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") ");
+ });
+});
+
+})(jQuery);
diff --git a/tests/unit/menu/menu_defaults.js b/tests/unit/menu/menu_defaults.js
new file mode 100644
index 000000000..c3f741d2a
--- /dev/null
+++ b/tests/unit/menu/menu_defaults.js
@@ -0,0 +1,11 @@
+/*
+ * menu_defaults.js
+ */
+
+var menu_defaults = {
+ disabled: false,
+ navigationFilter: function() {}
+
+};
+
+commonWidgetTests('menu', { defaults: menu_defaults });
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
new file mode 100644
index 000000000..a03bec3f6
--- /dev/null
+++ b/tests/unit/menu/menu_events.js
@@ -0,0 +1,24 @@
+/*
+ * menu_events.js
+ */
+(function($) {
+
+module("menu: events");
+
+test("handle click on menu", function() {
+ expect(1);
+ var ac = $('#menu1').menu({
+ select: function(event, ui) {
+ log();
+ }
+ });
+ log("click",true);
+ clickMenu($('#menu1'),"1");
+ log("afterclick");
+ clickMenu( ac,"2");
+ clickMenu($('#menu1'),"3");
+ clickMenu( ac,"1");
+ equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
+});
+
+})(jQuery);
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js
new file mode 100644
index 000000000..b6ebaf215
--- /dev/null
+++ b/tests/unit/menu/menu_methods.js
@@ -0,0 +1,19 @@
+/*
+ * menu_methods.js
+ */
+(function($) {
+
+module("menu: methods");
+
+test("destroy", function() {
+ var beforeHtml = $("#menu1").find("div").css("font-style", "normal").end().parent().html();
+ var afterHtml = $("#menu1").menu().menu("destroy").parent().html();
+ // Opera 9 outputs role="" instead of removing the attribute like everyone else
+ if ($.browser.opera) {
+ afterHtml = afterHtml.replace(/ role=""/g, "");
+ }
+ equal( afterHtml, beforeHtml );
+});
+
+
+})(jQuery);
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js
new file mode 100644
index 000000000..03822fd74
--- /dev/null
+++ b/tests/unit/menu/menu_options.js
@@ -0,0 +1,10 @@
+/*
+ * menu_options.js
+ */
+(function($) {
+
+module("menu: options");
+
+
+
+})(jQuery);
diff --git a/tests/unit/menu/menu_tickets.js b/tests/unit/menu/menu_tickets.js
new file mode 100644
index 000000000..760afd368
--- /dev/null
+++ b/tests/unit/menu/menu_tickets.js
@@ -0,0 +1,8 @@
+/*
+ * menu_tickets.js
+ */
+(function($) {
+
+module("menu: tickets");
+
+})(jQuery);
diff --git a/tests/visual/all.html b/tests/visual/all.html
index 4bbd323b0..c50465a47 100644
--- a/tests/visual/all.html
+++ b/tests/visual/all.html
@@ -11,6 +11,7 @@
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.accordion.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.datepicker.js"></script>
diff --git a/tests/visual/autocomplete/autocomplete.html b/tests/visual/autocomplete/autocomplete.html
index 9b0ba66f6..199451e9c 100644
--- a/tests/visual/autocomplete/autocomplete.html
+++ b/tests/visual/autocomplete/autocomplete.html
@@ -9,6 +9,7 @@
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script type="text/javascript">
diff --git a/tests/visual/compound/widgets_in_dialog.html b/tests/visual/compound/widgets_in_dialog.html
index 11120ea24..dc1b551cf 100644
--- a/tests/visual/compound/widgets_in_dialog.html
+++ b/tests/visual/compound/widgets_in_dialog.html
@@ -13,7 +13,7 @@
<script type="text/javascript" src="../../../ui/jquery.ui.resizable.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.accordion.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.dialog.js"></script>
diff --git a/tests/visual/index.html b/tests/visual/index.html
index c7b709279..04e23fddd 100644
--- a/tests/visual/index.html
+++ b/tests/visual/index.html
@@ -41,6 +41,14 @@
<li><a href="button/button.html">Button</a></li>
<li><a href="datepicker/datepicker.html">Datepicker</a></li>
<li><a href="dialog/dialog.html">Dialog</a></li>
+ <li>
+ <a href="menu/menu.html">Menu</a>
+ <ul>
+ <li><a href="menu/contextmenu.html">Context Menu</a></li>
+ <li><a href="menu/nested.html">Nested Menu</a></li>
+ <li><a href="menu/drilldown.html">Drilldown Menu</a></li>
+ </ul>
+ </li>
<li><a href="progressbar/progressbar.html">Progressbar</a></li>
<li><a href="slider/slider.html">Slider</a></li>
<li><a href="spinner/spinner.html">Spinner</a></li>
diff --git a/tests/visual/menu/contextmenu.html b/tests/visual/menu/contextmenu.html
index eb328abf0..d3fdc4e7c 100644
--- a/tests/visual/menu/contextmenu.html
+++ b/tests/visual/menu/contextmenu.html
@@ -8,7 +8,7 @@
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script type="text/javascript">
$(function() {
@@ -18,23 +18,24 @@
top: 10
}).appendTo(document.body).themeswitcher();
- var menus = $("#menu1, #menu2").menu({
- selected: function(event, ui) {
- $("#log").append("<div>Selected " + ui.item.text() + "</div>");
- }
- }).hide();
-
-
- $("button").click(function(event) {
+ $("button").each(function() {
+ $(this).next().menu({
+ selected: function(event, ui) {
+ $(this).hide();
+ $("#log").append("<div>Selected " + ui.item.text() + "</div>");
+ },
+ input: $(this)
+ }).hide();
+ }).click(function(event) {
// TODO required to prevent the click handler below from handling this event
event.stopPropagation();
- $("#menu" + this.id).menu("deactivate").show().position({
+ var menu = $("#menu" + this.id).menu("deactivate").show().position({
my: "left top",
at: "right top",
of: event.pageX > 0 ? event : this
});
$(document).one("click", function() {
- menus.hide();
+ menu.hide();
})
}).keydown(function(event) {
var menu = $("#menu" + this.id).data("menu");
@@ -42,24 +43,8 @@
return;
event.stopPropagation();
switch (event.keyCode) {
- case $.ui.keyCode.PAGE_UP:
- menu.previousPage();
- break;
- case $.ui.keyCode.PAGE_DOWN:
- menu.nextPage();
- break;
- case $.ui.keyCode.UP:
- menu.previous();
- break;
- case $.ui.keyCode.DOWN:
- menu.next();
- event.preventDefault();
- break;
- case $.ui.keyCode.ENTER:
case $.ui.keyCode.TAB:
- menu.select();
menu.widget().hide();
- event.preventDefault();
break;
case $.ui.keyCode.ESCAPE:
menu.widget().hide();
@@ -86,7 +71,7 @@
});
}
if (match.length) {
- menu.activate(match);
+ menu.activate(event, match);
if (match.length > 1) {
menu.previousFilter = character;
menu.filterTimer = setTimeout(function() {
@@ -111,7 +96,6 @@
<body>
<button id="1">Show context menu 1</button>
-
<ul id="menu1">
<li><a href="#">Amsterdam</a></li>
<li><a href="#">Anaheim</a></li>
@@ -123,6 +107,12 @@
<li><a href="#">Zurich</a></li>
</ul>
+<div class="ui-widget" style="margin-top:2em; font-family:Arial">
+ Log:
+ <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
+</div>
+
+<button id="2">Show context menu 2</button>
<ul id="menu2">
<li><a href="#">Aberdeen</a></li>
<li><a href="#">Ada</a></li>
@@ -164,12 +154,5 @@
<li><a href="#">Amesville</a></li>
</ul>
-<div class="ui-widget" style="margin-top:2em; font-family:Arial">
- Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
-</div>
-
-<button id="2">Show context menu 2</button>
-
</body>
</html>
diff --git a/tests/visual/menu/drilldown.html b/tests/visual/menu/drilldown.html
index 7bb7b03a2..65cdf1111 100644
--- a/tests/visual/menu/drilldown.html
+++ b/tests/visual/menu/drilldown.html
@@ -9,9 +9,16 @@
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
+ <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script type="text/javascript">
$(function() {
+ $.fn.themeswitcher && $('<div/>').css({
+ position: "absolute",
+ right: 10,
+ top: 10
+ }).appendTo(document.body).themeswitcher();
+
$.widget("ui.drilldown", {
_init: function() {
var self = this;
@@ -21,10 +28,12 @@
this.element.find("ul").hide().prev("a").prepend('<span class="ui-icon ui-icon-carat-1-e"></span>').end().filter(":first").show();
this.element.find("ul").menu({
+ // disable built-in key handling
+ input: $(),
focus: function(event, ui) {
self.activeItem = ui.item;
},
- selected: function(event, ui) {
+ select: function(event, ui) {
if (this != self.active[0]) {
return;
}
@@ -33,7 +42,7 @@
self._open(nested);
} else {
self.element.find("h3").text(ui.item.text());
- self.options.selected.apply(this, arguments);
+ self.options.select.apply(this, arguments);
}
}
});
@@ -115,7 +124,7 @@
});
var drilldown = $("#drilldown").drilldown({
- selected: function(event, ui) {
+ select: function(event, ui) {
$("#log").append("<div>Selected " + ui.item.text() + "</div>");
}
});
diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html
index 3a10da2e8..ec31a0f96 100644
--- a/tests/visual/menu/menu.html
+++ b/tests/visual/menu/menu.html
@@ -7,8 +7,7 @@
<script type="text/javascript" src="../../../jquery-1.4.4.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript">
$(function() {
$.fn.themeswitcher && $('<div/>').css({
@@ -17,39 +16,25 @@
top: 10
}).appendTo(document.body).themeswitcher();
- var menus = $("#menu1, #menu2").menu({
- selected: function(event, ui) {
- $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
- }
- }).keydown(function(event) {
- var menu = $(this).data("menu");
- if (menu.widget().is(":hidden"))
- return;
- event.stopPropagation();
- switch (event.keyCode) {
- case $.ui.keyCode.PAGE_UP:
- menu.previousPage();
- event.preventDefault();
- break;
- case $.ui.keyCode.PAGE_DOWN:
- menu.nextPage();
- event.preventDefault();
- break;
- case $.ui.keyCode.UP:
- menu.previous();
- event.preventDefault();
- break;
- case $.ui.keyCode.DOWN:
- menu.next();
- event.preventDefault();
- break;
- case $.ui.keyCode.ENTER:
- menu.select();
- event.preventDefault();
- break;
- }
- });
+ function create() {
+ menus.menu({
+ select: function(event, ui) {
+ $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
+ }
+ });
+ }
+
+ var menus = $("#menu1, #menu2");
+ create();
+ $("#toggle-destroy").toggle(function() {
+ menus.menu("destroy");
+ }, create);
+ $("#toggle-disable").toggle(function() {
+ menus.menu("disable");
+ }, function() {
+ menus.menu("enable");
+ });
});
</script>
<style>
@@ -60,7 +45,7 @@
</head>
<body>
-<ul id="menu1" tabindex="0">
+<ul id="menu1">
<li><a href="#">Aberdeen</a></li>
<li><a href="#">Ada</a></li>
<li><a href="#">Adamsville</a></li>
@@ -68,7 +53,7 @@
<li><a href="#">Adelphi</a></li>
</ul>
-<ul id="menu2" tabindex="0">
+<ul id="menu2">
<li><a href="#">Aberdeen</a></li>
<li><a href="#">Ada</a></li>
<li><a href="#">Adamsville</a></li>
@@ -114,5 +99,8 @@
<div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
+<button id="toggle-disable">Disable / Enable</button>
+<button id="toggle-destroy">Destroy / Create</button>
+
</body>
</html>
diff --git a/tests/visual/menu/menubar.html b/tests/visual/menu/menubar.html
new file mode 100644
index 000000000..087365c42
--- /dev/null
+++ b/tests/visual/menu/menubar.html
@@ -0,0 +1,94 @@
+<!doctype html>
+<html>
+<head>
+ <title>Menu Visual Test: Default</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
+ <script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
+ <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
+ <script type="text/javascript">
+ $(function() {
+ $.fn.themeswitcher && $('<div/>').css({
+ position: "absolute",
+ right: 10,
+ top: 10
+ }).appendTo(document.body).themeswitcher();
+
+ $(".menubar").children("a")
+ .button()
+ .click(function() {
+ var button = $(this);
+ var menu = button.next();
+ if (menu.is(":visible")) {
+ menu.hide();
+ return false;
+ }
+ menu.parent().find(".ui-menu").not(menu).hide();
+ menu.show().css({ left:0, top: 0 }).position({
+ my: "left top",
+ at: "left bottom",
+ of: button
+ });
+ $(document).bind("click.menubar", function(event) {
+ if ($(event.target).closest(".ui-menu")[0] == menu[0]) {
+ return;
+ }
+ $(this).unbind(".menubar");
+ menu.hide();
+ });
+ return false;
+ })
+ .each(function() {
+ $(this).next().hide().menu({
+ input: $(this),
+ select: function(event, ui) {
+ $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
+ }
+ });
+ });
+
+ });
+ </script>
+ <style>
+ body { font-size:62.5%; }
+ .ui-menu { width: 200px; }
+ .menubar .ui-menu { position: absolute; }
+ </style>
+</head>
+<body>
+
+<div class="menubar ui-widget-header">
+ <a href="#">File</a>
+ <ul>
+ <li><a href="#">Open...</a></li>
+ <li><a href="#">Save</a></li>
+ <li><a href="#">Save as...</a></li>
+ <li><a href="#">Close</a></li>
+ <li><a href="#">Quit</a></li>
+ </ul>
+ <a href="#">Edit</a>
+ <ul>
+ <li><a href="#">Copy</a></li>
+ <li><a href="#">Cut</a></li>
+ <li><a href="#">Paste</a></li>
+ </ul>
+ <a href="#">View</a>
+ <ul>
+ <li><a href="#">Fullscreen</a></li>
+ <li><a href="#">Fit into view</a></li>
+ <li><a href="#">Customize...</a></li>
+ </ul>
+</div>
+
+<div class="ui-widget" style="margin-top:2em; font-family:Arial">
+ Log:
+ <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
+</div>
+
+</body>
+</html>
diff --git a/tests/visual/menu/nested.html b/tests/visual/menu/nested.html
index c7f9a0914..2508c55c4 100644
--- a/tests/visual/menu/nested.html
+++ b/tests/visual/menu/nested.html
@@ -8,8 +8,8 @@
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
- <script type="text/javascript" src="../../../external/jquery.bgiframe-2.1.2.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
+ <script type="text/javascript" src="../../../external/jquery.bgiframe-2.1.1.js"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script type="text/javascript">
$(function() {
@@ -28,7 +28,9 @@
this.element.find("ul").hide().prev("a").prepend('<span class="ui-icon ui-icon-carat-1-e"></span>');
this.element.find("ul").andSelf().menu({
- selected: this.options.selected,
+ // disable built-in key handling
+ input: $(),
+ select: this.options.select,
focus: function(event, ui) {
self.active = ui.item.parent();
self.activeItem = ui.item;
@@ -75,7 +77,7 @@
});
var nestedmenu = $("#menu").nestedmenu({
- selected: function(event, ui) {
+ select: function(event, ui) {
$("#log").append("<div>Selected " + ui.item.text() + "</div>");
}
}).hide();
diff --git a/tests/visual/position/position.html b/tests/visual/position/position.html
index 80452bc81..11fb48d6e 100644
--- a/tests/visual/position/position.html
+++ b/tests/visual/position/position.html
@@ -9,7 +9,7 @@
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script type="text/javascript">
$(function() {