UNPKG

bootbox

Version:

Wrappers for JavaScript alert(), confirm() and other flexible dialogs using Twitter's bootstrap framework

63 lines (49 loc) 1.79 kB
require('./vendor/setup'); var assert = require('assert'); var bootbox = require('../'); describe("#setBtnIcons", function() { var box; before(function() { bootbox.animate(false); bootbox.setBtnClasses({ CONFIRM: 'btn-danger', CANCEL: 'btn-primary', OK: 'btn-inverse' }); }); after(function() { $(".bootbox") .modal('hide') .remove(); }); describe("when invoking an alert dialog", function() { before(function() { box = bootbox.alert("Hello world!"); }); it("should change the default button class for the OK button", function() { assert.ok(box.find("a:last").hasClass("btn-inverse")); }); }); describe("when invoking a confirm dialog", function() { before(function() { box = bootbox.confirm("Hello world!"); }); it("should change the default button class for the CONFIRM button", function() { assert.ok(box.find("a:last").hasClass("btn-danger")); }); it("should change the default button class for the CANCEL button", function() { assert.ok(box.find("a:first").hasClass("btn-primary")); }); }); describe("when invoking a prompt dialog", function() { before(function() { box = bootbox.prompt("Hello world!"); }); it("should change the default button class for the CONFIRM button", function() { assert.ok(box.find(".modal-footer a:last").hasClass("btn-danger")); }); it("should change the default button class for the CANCEL button", function() { assert.ok(box.find(".modal-footer a:first").hasClass("btn-primary")); }); }); });