aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob <[email protected]>2014-03-13 21:44:05 -0700
committerJacob <[email protected]>2014-03-13 21:44:05 -0700
commit8c9739d4773c268b114296d90e61b5f4e2932517 (patch)
treed9a1b6768c0aa98814e86233b76cd4a443ecc31c
parent7b41aab775e98cf53bd13a8318eb80979c87dcff (diff)
parent24e3a8b859aa82707c53fd22dd785195fbb45c59 (diff)
downloadbootstrap-8c9739d4773c268b114296d90e61b5f4e2932517.tar.xz
bootstrap-8c9739d4773c268b114296d90e61b5f4e2932517.zip
Merge pull request #11453 from moodyroto/patch-1
fix scrollspy for targets within tabs
-rw-r--r--js/tests/unit/scrollspy.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js
index 694af95c6..09ec54757 100644
--- a/js/tests/unit/scrollspy.js
+++ b/js/tests/unit/scrollspy.js
@@ -33,4 +33,41 @@ $(function () {
ok($topbar.find('.active', true))
})
+ test("should only switch active class on current target", function () {
+ var
+ sectionHTML = '<div id="root" class="active">'
+ + '<div class="topbar">'
+ + '<div class="topbar-inner">'
+ + '<div class="container" id="ss-target">'
+ + '<ul class="nav">'
+ + '<li><a href="#masthead">Overview</a></li>'
+ + '<li><a href="#detail">Detail</a></li>'
+ + '</ul>'
+ + '</div>'
+ + '</div>'
+ + '</div>'
+ + '<div id="scrollspy-example" style="height: 100px; overflow: auto;">'
+ + '<div style="height: 200px;">'
+ + '<h4 id="masthead">Overview</h4>'
+ + '<p style="height: 200px">'
+ + 'Ad leggings keytar, brunch id art party dolor labore.'
+ + '</p>'
+ + '</div>'
+ + '<div style="height: 200px;">'
+ + '<h4 id="detail">Detail</h4>'
+ + '<p style="height: 200px">'
+ + 'Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard.'
+ + '</p>'
+ + '</div>'
+ + '</div>'
+ + '</div>'
+ , $section = $(sectionHTML).appendTo("#qunit-fixture")
+ , $scrollSpy = $section
+ .show()
+ .find("#scrollspy-example")
+ .scrollspy({target: "#ss-target"})
+
+ $scrollSpy.scrollTop(350);
+ ok($section.hasClass("active"), "Active class still on root node")
+ })
})