diff options
| author | Michael Rotoloni <[email protected]> | 2013-11-18 09:29:10 -0500 |
|---|---|---|
| committer | Michael Rotoloni <[email protected]> | 2013-11-18 09:29:10 -0500 |
| commit | 24e3a8b859aa82707c53fd22dd785195fbb45c59 (patch) | |
| tree | 7485f112dfdf139c57d82a2dd594363a8def2115 | |
| parent | 9f30f557213f1e8f821414473550639f5f93f29a (diff) | |
| download | bootstrap-24e3a8b859aa82707c53fd22dd785195fbb45c59.tar.xz bootstrap-24e3a8b859aa82707c53fd22dd785195fbb45c59.zip | |
Added unit test for removing only active class from within the scroll spy key.
| -rw-r--r-- | js/tests/unit/scrollspy.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 06219a1c8..126b5c9d7 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -34,4 +34,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") + }) }) |
