equal
deleted
inserted
replaced
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 + '<ul class="nav">' |
|
27 + '<li><a href="#masthead">Overview</a></li>' |
|
28 + '</ul>' |
|
29 + '</div>' |
|
30 + '</div>' |
|
31 + '</div>' |
|
32 , $topbar = $(topbarHTML).scrollspy() |
|
33 |
|
34 ok($topbar.find('.active', true)) |
|
35 }) |
|
36 |
|
37 }) |
|