forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.mmenu-tests.ts
85 lines (72 loc) · 2.16 KB
/
jquery.mmenu-tests.ts
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
///<reference path="../jquery/jquery.d.ts" />
///<reference path="../jquery.mmenu/jquery.mmenu.d.ts" />
// --------------------------------------------------------
// ---------------- TEST DEFAULT OPTIONS ------------------
// --------------------------------------------------------
var menu: JQuery = $("#my-menu");
menu.mmenu(
// options
{
extensions: [],
navbar: {
add: true,
title: "Menu",
titleLink: "parent"
},
onClick: {
close: true,
preventDefault: false,
setSelected: false
},
slidingSubmenus: true
},
// configurations
{
classNames: {
divider: "Divider",
inset: "Inset",
panel: "Panel",
selected: "Selected",
vertical: "vertical"
},
clone: false,
openingInterval: 25,
panelNodetype: "div, ul, ol",
transitionDuration: 400
}
);
// --------------------------------------------------------
// ------------------- TEST MMENU API ---------------------
// --------------------------------------------------------
var api = menu.data("mmenu");
var myPanel: JQuery = $("#panel");
var listItem: JQuery = $(".list-item");
api.closeAllPanels();
api.bind("closeAllPanels", function() {
console.log("close all opened panels and go back to the first panel.");
});
api.closePanel(myPanel);
api.bind("closePanel", function(panel) {
console.log("close this ", panel);
});
api.getInstance();
api.bind("getInstance", function() {
console.log("get the class instance for the menu.");
});
api.init(myPanel);
api.bind("init", function(panel) {
console.log("method to (re)initialize a newly added ", panel);
});
api.openPanel(myPanel);
api.bind("openPanel", function(panel) {
console.log("This panel is now opened ", panel);
});
api.setSelected(listItem, true);
api.bind("setSelected", function(listItem, selected) {
console.log("set or unset a list item as selected ", listItem);
console.log("has selected ", selected);
});
api.update();
api.bind("update", function() {
console.log("update the appearance for the menu");
});