diff options
| author | Mark Otto <[email protected]> | 2011-12-21 18:39:02 -0600 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2011-12-21 18:39:02 -0600 |
| commit | 9fb380151d477f1741b7609ade7a9e7fd5450b2c (patch) | |
| tree | a749f2b6917c09770af1586ae9f83e46115de7eb /js/tests/unit/bootstrap-button.js | |
| parent | 12a0d69454a2831031035d19237d36d38bb2c2a9 (diff) | |
| parent | a5a98a8a984512011dac1216b432b86c6eff96a4 (diff) | |
| download | bootstrap-9fb380151d477f1741b7609ade7a9e7fd5450b2c.tar.xz bootstrap-9fb380151d477f1741b7609ade7a9e7fd5450b2c.zip | |
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
Conflicts:
bootstrap.css
docs/javascript.html
Diffstat (limited to 'js/tests/unit/bootstrap-button.js')
| -rw-r--r-- | js/tests/unit/bootstrap-button.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-button.js b/js/tests/unit/bootstrap-button.js new file mode 100644 index 000000000..59e8f33bc --- /dev/null +++ b/js/tests/unit/bootstrap-button.js @@ -0,0 +1,54 @@ +$(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') + stop() + setTimeout(function () { + ok(btn.attr('disabled'), 'btn is disabled') + ok(btn.hasClass('disabled'), 'btn has disabled class') + start() + }, 0) + }) + + 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') + stop() + setTimeout(function () { + ok(btn.attr('disabled'), 'btn is disabled') + ok(btn.hasClass('disabled'), 'btn has disabled class') + start() + stop() + }, 0) + btn.button('reset') + equals(btn.html(), 'mdo', 'btn text equals mdo') + setTimeout(function () { + ok(!btn.attr('disabled'), 'btn is not disabled') + ok(!btn.hasClass('disabled'), 'btn does not have disabled class') + start() + }, 0) + }) + + 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 |
