From: Jacob Date: Fri, 14 Mar 2014 04:44:05 +0000 (-0700) Subject: Merge pull request #11453 from moodyroto/patch-1 X-Git-Tag: v3.2.0~363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c9739d4773c268b114296d90e61b5f4e2932517;p=thirdparty%2Fbootstrap.git Merge pull request #11453 from moodyroto/patch-1 fix scrollspy for targets within tabs --- 8c9739d4773c268b114296d90e61b5f4e2932517 diff --cc js/tests/unit/scrollspy.js index 694af95c62,126b5c9d7e..09ec547571 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@@ -1,36 -1,74 +1,73 @@@ $(function () { - module("scrollspy") + module('scrollspy') - test("should provide no conflict", function () { - var scrollspy = $.fn.scrollspy.noConflict() - ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)') - $.fn.scrollspy = scrollspy - }) + test('should provide no conflict', function () { + var scrollspy = $.fn.scrollspy.noConflict() + ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)') + $.fn.scrollspy = scrollspy + }) - test("should be defined on jquery object", function () { - ok($(document.body).scrollspy, 'scrollspy method is defined') - }) + 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 return element', function () { + ok($(document.body).scrollspy()[0] == document.body, 'document.body returned') + }) - test("should switch active class on scroll", function () { - var sectionHTML = '
' - , $section = $(sectionHTML).append('#qunit-fixture') - , topbarHTML ='
' - + '
' - + '
' - + '

Bootstrap

' - + '' - + '
' - + '
' - + '
' - , $topbar = $(topbarHTML).scrollspy() + test('should switch active class on scroll', function () { + var sectionHTML = '
', + $section = $(sectionHTML).append('#qunit-fixture'), + topbarHTML = '
' + + '
' + + '
' + + '

Bootstrap

' + + '
  • Overview
  • ' + + '' + + '
    ' + + '
    ' + + '
    ', + $topbar = $(topbarHTML).scrollspy() - ok($topbar.find('.active', true)) - }) + 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") + }) })