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,42 @@
1
+$(function () {
2
+
3
+    module("bootstrap-buttons")
4
+
5
+      test("should be defined on jquery object", function () {
6
+        ok($(document.body).button, 'tabs method is defined')
7
+      })
8
+
9
+      test("should return element", function () {
10
+        ok($(document.body).button()[0] == document.body, 'document.body returned')
11
+      })
12
+
13
+      test("should return set state to loading", function () {
14
+        var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
15
+        equals(btn.html(), 'mdo', 'btn text equals mdo')
16
+        btn.button('loading')
17
+        equals(btn.html(), 'fat', 'btn text equals fat')
18
+        ok(btn.attr('disabled'), 'btn is disabled')
19
+        ok(btn.hasClass('disabled'), 'btn has disabled class')
20
+      })
21
+
22
+      test("should return reset state", function () {
23
+        var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
24
+        equals(btn.html(), 'mdo', 'btn text equals mdo')
25
+        btn.button('loading')
26
+        equals(btn.html(), 'fat', 'btn text equals fat')
27
+        ok(btn.attr('disabled'), 'btn is disabled')
28
+        ok(btn.hasClass('disabled'), 'btn is disabled')
29
+        btn.button('reset')
30
+        equals(btn.html(), 'mdo', 'btn text equals mdo')
31
+        ok(!btn.attr('disabled'), 'btn is not disabled')
32
+        ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
33
+      })
34
+
35
+      test("should toggle active", function () {
36
+        var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
37
+        ok(!btn.hasClass('active'), 'btn does not have active class')
38
+        btn.button('toggle')
39
+        ok(btn.hasClass('active'), 'btn has class active')
40
+      })
41
+
42
+})
0 43
\ No newline at end of file