From: Michael Rotoloni Date: Mon, 18 Nov 2013 14:29:10 +0000 (-0500) Subject: Added unit test for removing only active class from within the scroll spy key. X-Git-Tag: v3.2.0~363^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24e3a8b859aa82707c53fd22dd785195fbb45c59;p=thirdparty%2Fbootstrap.git Added unit test for removing only active class from within the scroll spy key. --- diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 06219a1c8d..126b5c9d7e 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 = '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '

Overview

' + + '

' + + 'Ad leggings keytar, brunch id art party dolor labore.' + + '

' + + '
' + + '
' + + '

Detail

' + + '

' + + 'Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard.' + + '

' + + '
' + + '
' + + '
' + , $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") + }) })