5 test("should provide no conflict", function () {
6 var alert = $.fn.alert.noConflict()
7 ok(!$.fn.alert, 'alert was set back to undefined (org value)')
11 test("should be defined on jquery object", function () {
12 ok($(document.body).alert, 'alert method is defined')
15 test("should return element", function () {
16 ok($(document.body).alert()[0] == document.body, 'document.body returned')
19 test("should fade element out on clicking .close", function () {
20 var alertHTML = '<div class="alert-message warning fade in">'
21 + '<a class="close" href="#" data-dismiss="alert">×</a>'
22 + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
24 , alert = $(alertHTML).alert()
26 alert.find('.close').click()
28 ok(!alert.hasClass('in'), 'remove .in class on .close click')
31 test("should remove element when clicking .close", function () {
32 $.support.transition = false
34 var alertHTML = '<div class="alert-message warning fade in">'
35 + '<a class="close" href="#" data-dismiss="alert">×</a>'
36 + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
38 , alert = $(alertHTML).appendTo('#qunit-fixture').alert()
40 ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
42 alert.find('.close').click()
44 ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
47 test("should not fire closed when close is prevented", function () {
48 $.support.transition = false
50 $('<div class="alert"/>')
51 .on('close.bs.alert', function (e) {
56 .on('closed.bs.alert', function () {