updated bootboxjs and tests

This commit is contained in:
Kon P
2014-08-28 22:02:03 -07:00
parent 8d868ab873
commit 173f4b0841
2 changed files with 92 additions and 83 deletions
+44 -50
View File
@@ -2,73 +2,67 @@
/// <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() {
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.alert({
message: "Are we ok with callback and custom button?",
callback: function () {
console.log("Callback called!");
}
});
bootbox.confirm("Click ok to pass test", function(result) {
console.log(result);
});
bootbox.confirm("Click ok to pass test");
bootbox.confirm("Click cancel to pass test", function(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.confirm({
message: "Click confirm to pass test",
callback: function (result) {
console.log(result);
}
});
bootbox.prompt("Are we ok?");
bootbox.prompt("Enter 'ok' to pass test", function(result) {
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({
message: "Enter 'ok' to pass test", callback: 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",
bootbox.dialog("Test Dialog", function (result) {
return result;
});
bootbox.dialog({
message: "Test Dialog",
callback: function (result) { }
});
var bdo: BootboxDialogOptions;
var sampleButton: BootboxButton = {
label: 'ButtonLabelToUse',
callback: function () {
console.log("Test Dialog");
return 'callback of button click'
},
className: 'additionalButtonClassName'
};
bdo = {
message: '',
className: 'callName',
buttons: {
'ButtonTextLabel': sampleButton
}
};
var option = {
header: "header",
headerCloseButton: true
};
bootbox.dialog(bdo);
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" });
bootbox.hideAll();