forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootbox-tests.ts
74 lines (58 loc) · 1.81 KB
/
bootbox-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
// QUnit Tests for Bootbox 3.0
/// <reference path="bootbox.d.ts" />
bootbox.alert("Are we ok?");
bootbox.alert("Are we ok with Test button?", "Test");
bootbox.alert("Are we ok with callback?", function() {
console.log("Callback called!");
});
bootbox.alert("Are we ok with callback and custom button?", "Test", function() {
console.log("Callback called!");
});
bootbox.confirm("Click ok to pass test", function(result) {
console.log(result);
});
bootbox.confirm("Click cancel to pass test", function(result) {
console.log(!result);
});
bootbox.confirm("Click confirm to pass test", "Cancel?", "Confirm?", function(result) {
console.log(result);
});
bootbox.confirm("Click cancel to pass test", "Cancel?", "Confirm?", function(result) {
console.log(!result);
});
bootbox.prompt("Are we ok?");
bootbox.prompt("Enter 'ok' to pass test", function(result) {
console.log(result);
});
bootbox.prompt("Enter 'ok' to pass test", "Cancel?", "Confirm?", function(result) {
console.log(result);
});
bootbox.prompt("Keep default value and click ok", "Cancel?", "Confirm?", function(result) {
console.log(result);
}, "Test Value");
bootbox.dialog("Test Dialog");
var handler = {
label: "OK",
class: "MyClass",
callback: function () {
console.log("Test Dialog");
}
};
var option = {
header: "header",
headerCloseButton: true
};
bootbox.dialog("Test Dialog", handler);
bootbox.dialog("Test Dialog", [handler], option);
bootbox.hideAll();
bootbox.animate(false);
bootbox.backdrop("backdrop");
bootbox.classes("myClass");
var icons: BootboxIcons = {
OK: "OK Icon",
CANCEL: "Cancel Icon",
CONFIRM: "Confirm Icon"
};
bootbox.setIcons(icons);
bootbox.setLocale("en");
bootbox.addLocale("klingon", { OK: "luq", CANCEL: "qIl", CONFIRM: "Confirm" });