info@54: $(function () { info@54: info@54: module("alert") info@54: info@54: test("should provide no conflict", function () { info@54: var alert = $.fn.alert.noConflict() info@54: ok(!$.fn.alert, 'alert was set back to undefined (org value)') info@54: $.fn.alert = alert info@54: }) info@54: info@54: test("should be defined on jquery object", function () { info@54: ok($(document.body).alert, 'alert method is defined') info@54: }) info@54: info@54: test("should return element", function () { info@54: ok($(document.body).alert()[0] == document.body, 'document.body returned') info@54: }) info@54: info@54: test("should fade element out on clicking .close", function () { info@54: var alertHTML = '
' info@54: , alert = $(alertHTML).alert() info@54: info@54: alert.find('.close').click() info@54: info@54: ok(!alert.hasClass('in'), 'remove .in class on .close click') info@54: }) info@54: info@54: test("should remove element when clicking .close", function () { info@54: $.support.transition = false info@54: info@54: var alertHTML = ' ' info@54: , alert = $(alertHTML).appendTo('#qunit-fixture').alert() info@54: info@54: ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom') info@54: info@54: alert.find('.close').click() info@54: info@54: ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom') info@54: }) info@54: info@54: test("should not fire closed when close is prevented", function () { info@54: $.support.transition = false info@54: stop(); info@54: $('') info@54: .on('close.bs.alert', function (e) { info@54: e.preventDefault(); info@54: ok(true); info@54: start(); info@54: }) info@54: .on('closed.bs.alert', function () { info@54: ok(false); info@54: }) info@54: .alert('close') info@54: }) info@54: info@54: })