aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/menu/helper.js
blob: 748dfe773c21ddc43dcda342b0e1298d4206480d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
define( [
	"jquery",
	"lib/helper"
], function( $, helper ) {

var lastItem,
	log = [];

return $.extend( helper, {
	log: function( message, clear ) {
		if ( clear ) {
			log.length = 0;
		}
		if ( message === undefined ) {
			message = lastItem;
		}
		log.push( String.prototype.trim.call( message ) );
	},

	logOutput: function() {
		return log.join( "," );
	},

	clearLog: function() {
		log.length = 0;
	},

	click: function( menu, item ) {
		lastItem = item;
		menu.children()
			.eq( item )
			.children( ".ui-menu-item-wrapper" )
			.trigger( "click" );
	}
} );

} );