aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2011-10-31 23:22:13 -0700
committerMark Otto <[email protected]>2011-10-31 23:22:13 -0700
commita21363a749f7d30a282e24cefd83840a5a3fca7c (patch)
treec3dc61772359fdcbb75418bd105a61e3e5579f70 /js/tests/unit
parent98007b8394a5cf892694000d066a07a32f8c517f (diff)
parent8f726dc6ef3ee725ef032ef4a11dbce26982ae24 (diff)
downloadbootstrap-a21363a749f7d30a282e24cefd83840a5a3fca7c.tar.xz
bootstrap-a21363a749f7d30a282e24cefd83840a5a3fca7c.zip
Merge branch 'dev' of github.com:twitter/bootstrap into dev
Conflicts: bootstrap.css
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/bootstrap-buttons.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-buttons.js b/js/tests/unit/bootstrap-buttons.js
new file mode 100644
index 000000000..9784f5222
--- /dev/null
+++ b/js/tests/unit/bootstrap-buttons.js
@@ -0,0 +1,42 @@
+$(function () {
+
+ module("bootstrap-buttons")
+
+ test("should be defined on jquery object", function () {
+ ok($(document.body).button, 'tabs method is defined')
+ })
+
+ test("should return element", function () {
+ ok($(document.body).button()[0] == document.body, 'document.body returned')
+ })
+
+ test("should return set state to loading", function () {
+ var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
+ equals(btn.html(), 'mdo', 'btn text equals mdo')
+ btn.button('loading')
+ equals(btn.html(), 'fat', 'btn text equals fat')
+ ok(btn.attr('disabled'), 'btn is disabled')
+ ok(btn.hasClass('disabled'), 'btn has disabled class')
+ })
+
+ test("should return reset state", function () {
+ var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
+ equals(btn.html(), 'mdo', 'btn text equals mdo')
+ btn.button('loading')
+ equals(btn.html(), 'fat', 'btn text equals fat')
+ ok(btn.attr('disabled'), 'btn is disabled')
+ ok(btn.hasClass('disabled'), 'btn is disabled')
+ btn.button('reset')
+ equals(btn.html(), 'mdo', 'btn text equals mdo')
+ ok(!btn.attr('disabled'), 'btn is not disabled')
+ ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
+ })
+
+ test("should toggle active", function () {
+ var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
+ ok(!btn.hasClass('active'), 'btn does not have active class')
+ btn.button('toggle')
+ ok(btn.hasClass('active'), 'btn has class active')
+ })
+
+}) \ No newline at end of file