aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/bootstrap-scrollspy.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-09-10 22:14:57 -0700
committerJacob Thornton <[email protected]>2011-09-10 22:14:57 -0700
commit64176caa972fdf925fe244cdbf1d53d82da592f4 (patch)
tree413ff6c850a038be203b64526caca958db1487c6 /js/tests/unit/bootstrap-scrollspy.js
parenta71d5d8e991eee4073d3312743778b1991cfb650 (diff)
downloadbootstrap-64176caa972fdf925fe244cdbf1d53d82da592f4.tar.xz
bootstrap-64176caa972fdf925fe244cdbf1d53d82da592f4.zip
add bootstrap-scrollspy
Diffstat (limited to 'js/tests/unit/bootstrap-scrollspy.js')
-rw-r--r--js/tests/unit/bootstrap-scrollspy.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/tests/unit/bootstrap-scrollspy.js b/js/tests/unit/bootstrap-scrollspy.js
new file mode 100644
index 000000000..b9b309062
--- /dev/null
+++ b/js/tests/unit/bootstrap-scrollspy.js
@@ -0,0 +1,31 @@
+$(function () {
+
+ module("bootstrap-scrollspy")
+
+ test("should be defined on jquery object", function () {
+ ok($(document.body).scrollspy, 'scrollspy method is defined')
+ })
+
+ test("should return element", function () {
+ ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
+ })
+
+ test("should switch active class on scroll", function () {
+ var sectionHTML = '<div id="masthead"></div>'
+ , $section = $(sectionHTML).append('#qunit-runoff')
+ , topbarHTML ='<div class="topbar">'
+ + '<div class="topbar-inner">'
+ + '<div class="container">'
+ + '<h3><a href="#">Bootstrap</a></h3>'
+ + '<ul class="nav">'
+ + '<li><a href="#masthead">Overview</a></li>'
+ + '</ul>'
+ + '</div>'
+ + '</div>'
+ + '</div>'
+ , $topbar = $(topbarHTML).topbar()
+
+ ok(topbar.find('.active', true)
+ })
+
+}) \ No newline at end of file