1
Fork 0
lorchess.ru/assets/vendor/bootstrap/js/tests/unit/scrollspy.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-01-24 13:24:23 +04:00
$(function () {
2014-04-17 22:36:17 +04:00
module('scrollspy')
2014-01-24 13:24:23 +04:00
2014-04-17 22:36:17 +04:00
test('should provide no conflict', function () {
2014-01-24 13:24:23 +04:00
var scrollspy = $.fn.scrollspy.noConflict()
ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)')
$.fn.scrollspy = scrollspy
})
2014-04-17 22:36:17 +04:00
test('should be defined on jquery object', function () {
2014-01-24 13:24:23 +04:00
ok($(document.body).scrollspy, 'scrollspy method is defined')
})
2014-04-17 22:36:17 +04:00
test('should return element', function () {
2014-01-24 13:24:23 +04:00
ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
})
2014-04-17 22:36:17 +04:00
test('should switch active class on scroll', function () {
2014-01-24 13:24:23 +04:00
var sectionHTML = '<div id="masthead"></div>'
2014-04-17 22:36:17 +04:00
$section = $(sectionHTML).append('#qunit-fixture'),
topbarHTML = '<div class="topbar">' +
'<div class="topbar-inner">' +
'<div class="container">' +
'<h3><a href="#">Bootstrap</a></h3>' +
'<li><a href="#masthead">Overview</a></li>' +
'</ul>' +
'</div>' +
'</div>' +
'</div>',
$topbar = $(topbarHTML).scrollspy()
2014-01-24 13:24:23 +04:00
ok($topbar.find('.active', true))
})
})