Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

final procedural project

ER authored on 13/04/2012 10:17:34
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,41 @@
1
+$(function () {
2
+
3
+    module("bootstrap-alerts")
4
+
5
+      test("should be defined on jquery object", function () {
6
+        ok($(document.body).alert, 'alert method is defined')
7
+      })
8
+
9
+      test("should return element", function () {
10
+        ok($(document.body).alert()[0] == document.body, 'document.body returned')
11
+      })
12
+
13
+      test("should fade element out on clicking .close", function () {
14
+        var alertHTML = '<div class="alert-message warning fade in">'
15
+          + '<a class="close" href="#">×</a>'
16
+          + '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
17
+          + '</div>'
18
+          , alert = $(alertHTML).alert()
19
+
20
+        alert.find('.close').click()
21
+
22
+        ok(!alert.hasClass('in'), 'remove .in class on .close click')
23
+      })
24
+
25
+      test("should remove element when clicking .close", function () {
26
+        $.support.transition = false
27
+
28
+        var alertHTML = '<div class="alert-message warning fade in">'
29
+          + '<a class="close" href="#">×</a>'
30
+          + '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
31
+          + '</div>'
32
+          , alert = $(alertHTML).appendTo('#qunit-runoff').alert()
33
+
34
+        ok($('#qunit-runoff').find('.alert-message').length, 'element added to dom')
35
+
36
+        alert.find('.close').click()
37
+
38
+        ok(!$('#qunit-runoff').find('.alert-message').length, 'element removed from dom')
39
+      })
40
+
41
+})
0 42
\ No newline at end of file