jquery-ui/tests/unit/menu/helper.js

37 lines
561 B
JavaScript
Raw Permalink Normal View History

define( [
"jquery",
"lib/helper"
], function( $, helper ) {
2012-06-18 17:26:46 +00:00
var lastItem,
log = [];
return $.extend( helper, {
log: function( message, clear ) {
if ( clear ) {
2012-06-18 17:26:46 +00:00
log.length = 0;
}
if ( message === undefined ) {
2012-06-18 17:26:46 +00:00
message = lastItem;
}
log.push( $.trim( message ) );
2012-06-18 17:26:46 +00:00
},
logOutput: function() {
return log.join( "," );
2012-06-18 17:26:46 +00:00
},
clearLog: function() {
log.length = 0;
},
2011-08-04 01:15:38 +00:00
click: function( menu, item ) {
2012-06-18 17:26:46 +00:00
lastItem = item;
menu.children( ":eq(" + item + ")" )
.children( ".ui-menu-item-wrapper" )
.trigger( "click" );
}
} );
2012-06-18 17:26:46 +00:00
} );