aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/menu
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-04-19 11:19:52 -0500
committerkborchers <kris.borchers@gmail.com>2012-04-19 11:19:52 -0500
commitc16bd7c510cff4e0b01d9c191128af014523da7c (patch)
treefd50c26fd0a0408c0f44380a9f75dd618be2719e /tests/unit/menu
parent163555d7bf27fe5d272e404de3c4439902710f54 (diff)
downloadjquery-ui-c16bd7c510cff4e0b01d9c191128af014523da7c.tar.gz
jquery-ui-c16bd7c510cff4e0b01d9c191128af014523da7c.zip
Menu tests: Don't pollute the global namespace with helpers.
Diffstat (limited to 'tests/unit/menu')
-rw-r--r--tests/unit/menu/menu_events.js175
-rw-r--r--tests/unit/menu/menu_methods.js17
-rw-r--r--tests/unit/menu/menu_options.js19
-rw-r--r--tests/unit/menu/menu_test_helpers.js28
4 files changed, 125 insertions, 114 deletions
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index dccb5f7a2..a0051c70b 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -3,21 +3,24 @@
*/
(function($) {
+var log = TestHelpers.menu.log,
+ click = TestHelpers.menu.click;
+
module("menu: events");
test("handle click on menu", function() {
expect(1);
var menu = $('#menu1').menu({
select: function(event, ui) {
- menu_log();
+ log();
}
});
- menu_log("click",true);
- menu_click($('#menu1'),"1");
- menu_log("afterclick");
- menu_click( menu,"2");
- menu_click($('#menu1'),"3");
- menu_click( menu,"1");
+ log("click",true);
+ click($('#menu1'),"1");
+ log("afterclick");
+ click( menu,"2");
+ click($('#menu1'),"3");
+ click( menu,"1");
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});
@@ -25,16 +28,16 @@ test("handle click on custom item menu", function() {
expect(1);
var menu = $('#menu5').menu({
select: function(event, ui) {
- menu_log();
+ log();
},
menus: "div"
});
- menu_log("click",true);
- menu_click($('#menu5'),"1");
- menu_log("afterclick");
- menu_click( menu,"2");
- menu_click($('#menu5'),"3");
- menu_click( menu,"1");
+ log("click",true);
+ click($('#menu5'),"1");
+ log("afterclick");
+ click( menu,"2");
+ click($('#menu5'),"3");
+ click( menu,"1");
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});
@@ -75,7 +78,7 @@ test( "handle blur on custom item menu: click", function() {
items: "div"
});
- menu_click($('#menu5'),"1");
+ click($('#menu5'),"1");
$( "<a>", { id: "remove"} ).appendTo("body").trigger( "click" );
$("#remove").remove();
@@ -144,60 +147,60 @@ test("handle keyboard navigation on menu without scroll and without submenus", f
expect(12);
var element = $('#menu1').menu({
select: function(event, ui) {
- menu_log($(ui.item[0]).text());
+ log($(ui.item[0]).text());
},
focus: function( event, ui ) {
- menu_log($(event.target).find(".ui-state-focus").parent().index());
+ log($(event.target).find(".ui-state-focus").parent().index());
}
});
- menu_log("keydown",true);
+ log("keydown",true);
element.focus();
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "1,keydown,", "Keydown UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "4,keydown,", "Keydown END");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
});
@@ -206,14 +209,14 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
expect(14);
var element = $('#menu2').menu({
select: function(event, ui) {
- menu_log($(ui.item[0]).text());
+ log($(ui.item[0]).text());
},
focus: function( event, ui ) {
- menu_log($(event.target).find(".ui-state-focus").parent().index());
+ log($(event.target).find(".ui-state-focus").parent().index());
}
});
- menu_log("keydown",true);
+ log("keydown",true);
element.one( "menufocus", function( event, ui ) {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
@@ -223,16 +226,16 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
element.focus();
function menukeyboard1() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
@@ -246,7 +249,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
}
function menukeyboard2() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)");
@@ -256,35 +259,35 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
}
function menukeyboard3() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "2,keydown,", "Keydown END");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
setTimeout( menukeyboard4, 50 );
}
@@ -292,7 +295,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
function menukeyboard4() {
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)");
@@ -304,69 +307,69 @@ test("handle keyboard navigation on menu with scroll and without submenus", func
expect(14);
var element = $('#menu3').menu({
select: function(event, ui) {
- menu_log($(ui.item[0]).text());
+ log($(ui.item[0]).text());
},
focus: function( event, ui ) {
- menu_log($(event.target).find(".ui-state-focus").parent().index());
+ log($(event.target).find(".ui-state-focus").parent().index());
}
});
- menu_log("keydown",true);
+ log("keydown",true);
element.focus();
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "37,keydown,", "Keydown END");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
});
@@ -375,14 +378,14 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
expect(14);
var element = $('#menu4').menu({
select: function(event, ui) {
- menu_log($(ui.item[0]).text());
+ log($(ui.item[0]).text());
},
focus: function( event, ui ) {
- menu_log($(event.target).find(".ui-state-focus").parent().index());
+ log($(event.target).find(".ui-state-focus").parent().index());
}
});
- menu_log("keydown",true);
+ log("keydown",true);
element.one( "menufocus", function( event, ui ) {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
@@ -393,16 +396,16 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
function menukeyboard1() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
@@ -413,7 +416,7 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
}
function menukeyboard2() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)");
@@ -423,35 +426,35 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
}
function menukeyboard3() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "27,keydown,", "Keydown END");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
setTimeout( menukeyboard4, 50 );
}
@@ -459,7 +462,7 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
function menukeyboard4() {
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)");
@@ -471,14 +474,14 @@ asyncTest("handle keyboard navigation and mouse click on menu with disabled item
expect(6);
var element = $('#menu6').menu({
select: function(event, ui) {
- menu_log($(ui.item[0]).text());
+ log($(ui.item[0]).text());
},
focus: function( event, ui ) {
- menu_log($(event.target).find(".ui-state-focus").parent().index());
+ log($(event.target).find(".ui-state-focus").parent().index());
}
});
- menu_log("keydown",true);
+ log("keydown",true);
element.one( "menufocus", function( event, ui ) {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
@@ -489,29 +492,29 @@ asyncTest("handle keyboard navigation and mouse click on menu with disabled item
function menukeyboard1() {
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "4,3,2,keydown,", "Keydown focus disabled item with submenu");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
setTimeout( function() {
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect on disabled sub-menu)");
- menu_log("keydown",true);
+ log("keydown",true);
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
setTimeout( function() {
equal( $("#log").html(), "keydown,", "Keydown ENTER (no effect on disabled sub-menu)");
- menu_log("click",true);
- menu_click( element, "1" );
+ log("click",true);
+ click( element, "1" );
equal( $("#log").html(), "click,", "Click disabled item (no effect)");
start();
}, 50);
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js
index 200ea4427..6ad7bc134 100644
--- a/tests/unit/menu/menu_methods.js
+++ b/tests/unit/menu/menu_methods.js
@@ -3,25 +3,28 @@
*/
(function($) {
+var log = TestHelpers.menu.log,
+ click = TestHelpers.menu.click;
+
module("menu: methods");
test( "enable/disable", function() {
expect( 3 );
var menu = $( "#menu1" ).menu({
select: function(event, ui) {
- menu_log();
+ log();
}
});
menu.menu("disable");
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
- menu_log("click",true);
- menu_click(menu,"1");
- menu_log("afterclick");
+ log("click",true);
+ click(menu,"1");
+ log("afterclick");
menu.menu("enable");
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
- menu_log("click");
- menu_click(menu,"1");
- menu_log("afterclick");
+ log("click");
+ click(menu,"1");
+ log("afterclick");
equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid.");
});
diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js
index cda52d88d..e651fd2d1 100644
--- a/tests/unit/menu/menu_options.js
+++ b/tests/unit/menu/menu_options.js
@@ -3,6 +3,9 @@
*/
(function($) {
+var log = TestHelpers.menu.log,
+ click = TestHelpers.menu.click;
+
module("menu: options");
test( "{ disabled: true }", function() {
@@ -10,13 +13,13 @@ test( "{ disabled: true }", function() {
var menu = $( "#menu1" ).menu({
disabled: true,
select: function(event, ui) {
- menu_log();
+ log();
}
});
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
- menu_log("click",true);
- menu_click(menu,"1");
- menu_log("afterclick");
+ log("click",true);
+ click(menu,"1");
+ log("afterclick");
equal( $("#log").html(), "afterclick,click,", "Click order not valid.");
});
@@ -25,13 +28,13 @@ test( "{ disabled: false }", function() {
var menu = $( "#menu1" ).menu({
disabled: false,
select: function(event, ui) {
- menu_log();
+ log();
}
});
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
- menu_log("click",true);
- menu_click(menu,"1");
- menu_log("afterclick");
+ log("click",true);
+ click(menu,"1");
+ log("afterclick");
equal( $("#log").html(), "afterclick,1,click,", "Click order not valid.");
});
diff --git a/tests/unit/menu/menu_test_helpers.js b/tests/unit/menu/menu_test_helpers.js
index e83795e5a..a576af19a 100644
--- a/tests/unit/menu/menu_test_helpers.js
+++ b/tests/unit/menu/menu_test_helpers.js
@@ -1,14 +1,16 @@
-function menu_log( message, clear ) {
- if ( clear ) {
- $( "#log" ).empty();
- }
- if ( message === undefined ) {
- message = $( "#log" ).data( "lastItem" );
- }
- $( "#log" ).prepend( $.trim( message ) + "," );
-}
+TestHelpers.menu = {
+ log: function( message, clear ) {
+ if ( clear ) {
+ $( "#log" ).empty();
+ }
+ if ( message === undefined ) {
+ message = $( "#log" ).data( "lastItem" );
+ }
+ $( "#log" ).prepend( $.trim( message ) + "," );
+ },
-function menu_click( menu, item ) {
- $( "#log" ).data( "lastItem", item );
- menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
-} \ No newline at end of file
+ click: function( menu, item ) {
+ $( "#log" ).data( "lastItem", item );
+ menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
+ }
+}; \ No newline at end of file