remove unused build-responsive.less
[bootswatch] / bower_components / bootstrap / js / tests / unit / alert.js
1 $(function () {
2
3     module("alert")
4
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)')
8         $.fn.alert = alert
9       })
10
11       test("should be defined on jquery object", function () {
12         ok($(document.body).alert, 'alert method is defined')
13       })
14
15       test("should return element", function () {
16         ok($(document.body).alert()[0] == document.body, 'document.body returned')
17       })
18
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>'
23           + '</div>'
24           , alert = $(alertHTML).alert()
25
26         alert.find('.close').click()
27
28         ok(!alert.hasClass('in'), 'remove .in class on .close click')
29       })
30
31       test("should remove element when clicking .close", function () {
32         $.support.transition = false
33
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>'
37           + '</div>'
38           , alert = $(alertHTML).appendTo('#qunit-fixture').alert()
39
40         ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
41
42         alert.find('.close').click()
43
44         ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
45       })
46
47       test("should not fire closed when close is prevented", function () {
48         $.support.transition = false
49         stop();
50         $('<div class="alert"/>')
51           .on('close.bs.alert', function (e) {
52             e.preventDefault();
53             ok(true);
54             start();
55           })
56           .on('closed.bs.alert', function () {
57             ok(false);
58           })
59           .alert('close')
60       })
61
62 })