github.com/kayoticsully/syncthing@v0.8.9-0.20140724133906-c45a2fdc03f8/assets/bootstrap-3.1.1/js/tests/unit/scrollspy.js (about)

     1  $(function () {
     2  
     3      module('scrollspy')
     4  
     5        test('should provide no conflict', function () {
     6          var scrollspy = $.fn.scrollspy.noConflict()
     7          ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)')
     8          $.fn.scrollspy = scrollspy
     9        })
    10  
    11        test('should be defined on jquery object', function () {
    12          ok($(document.body).scrollspy, 'scrollspy method is defined')
    13        })
    14  
    15        test('should return element', function () {
    16          ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
    17        })
    18  
    19        test('should switch active class on scroll', function () {
    20          var sectionHTML = '<div id="masthead"></div>'
    21              $section = $(sectionHTML).append('#qunit-fixture'),
    22              topbarHTML = '<div class="topbar">' +
    23              '<div class="topbar-inner">' +
    24              '<div class="container">' +
    25              '<h3><a href="#">Bootstrap</a></h3>' +
    26              '<li><a href="#masthead">Overview</a></li>' +
    27              '</ul>' +
    28              '</div>' +
    29              '</div>' +
    30              '</div>',
    31              $topbar = $(topbarHTML).scrollspy()
    32  
    33          ok($topbar.find('.active', true))
    34        })
    35  
    36  })