bootbox
Version:
Wrappers for JavaScript alert(), confirm() and other flexible dialogs using Twitter's bootstrap framework
62 lines (49 loc) • 1.98 kB
JavaScript
require('./vendor/setup');
var assert = require('assert');
var bootbox = require('../');
describe("classes", function() {
var box;
after(function() {
$(".bootbox")
.remove();
});
describe("when single class applied globally", function() {
before(function() {
bootbox.classes("globalTestClass");
box = bootbox.dialog("foo");
});
it("should apply the class to the modal", function() {
assert.ok(box.hasClass("globalTestClass"));
});
describe("but when passed as an option", function() {
before(function() {
box = bootbox.dialog("foo", [], {"classes": "localTestClass"});
});
it("should only apply the option specified class to the modal", function() {
assert.ok(!box.hasClass("globalTestClass"));
assert.ok(box.hasClass("localTestClass"));
});
});
});
describe("when multiple classes applied globally", function() {
before(function() {
bootbox.classes("globalTestClass globalTestClass2");
box = bootbox.dialog("foo");
});
it("should apply the classes to the modal", function() {
assert.ok(box.hasClass("globalTestClass"));
assert.ok(box.hasClass("globalTestClass2"));
});
describe("but when passed as an option", function() {
before(function() {
box = bootbox.dialog("foo", [], {"classes": "localTestClass localTestClass2"});
});
it("should only apply the option specified classes to the modal", function() {
assert.ok(!box.hasClass("globalTestClass"));
assert.ok(!box.hasClass("globalTestClass2"));
assert.ok(box.hasClass("localTestClass"));
assert.ok(box.hasClass("localTestClass2"));
});
});
});
});