bootstrap-scrollspy.js 972 B

12345678910111213141516171819202122232425262728293031
  1. $(function () {
  2. module("bootstrap-scrollspy")
  3. test("should be defined on jquery object", function () {
  4. ok($(document.body).scrollspy, 'scrollspy method is defined')
  5. })
  6. test("should return element", function () {
  7. ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
  8. })
  9. test("should switch active class on scroll", function () {
  10. var sectionHTML = '<div id="masthead"></div>'
  11. , $section = $(sectionHTML).append('#qunit-fixture')
  12. , topbarHTML ='<div class="topbar">'
  13. + '<div class="topbar-inner">'
  14. + '<div class="container">'
  15. + '<h3><a href="#">Bootstrap</a></h3>'
  16. + '<ul class="nav">'
  17. + '<li><a href="#masthead">Overview</a></li>'
  18. + '</ul>'
  19. + '</div>'
  20. + '</div>'
  21. + '</div>'
  22. , $topbar = $(topbarHTML).scrollspy()
  23. ok($topbar.find('.active', true))
  24. })
  25. })