aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/bootstrap-collapse.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/bootstrap-collapse.js')
-rw-r--r--js/tests/unit/bootstrap-collapse.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-collapse.js b/js/tests/unit/bootstrap-collapse.js
new file mode 100644
index 000000000..698238d96
--- /dev/null
+++ b/js/tests/unit/bootstrap-collapse.js
@@ -0,0 +1,25 @@
+$(function () {
+
+ module("bootstrap-collapse")
+
+ test("should be defined on jquery object", function () {
+ ok($(document.body).collapse, 'collapse method is defined')
+ })
+
+ test("should return element", function () {
+ ok($(document.body).collapse()[0] == document.body, 'document.body returned')
+ })
+
+ test("should show a collapsed element", function () {
+ var el = $('<div class="collapse"></div>').collapse('show')
+ ok(el.hasClass('in'), 'has class in')
+ ok(/height/.test(el.attr('style')), 'has height set')
+ })
+
+ test("should hide a collapsed element", function () {
+ var el = $('<div class="collapse"></div>').collapse('hide')
+ ok(!el.hasClass('in'), 'does not have class in')
+ ok(/height/.test(el.attr('style')), 'has height set')
+ })
+
+}) \ No newline at end of file