diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 694af95c62..09ec547571 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 = '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '
' + + '
' + + '
' + + '

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