0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

Small clean-up in scrollspy unit test

This commit is contained in:
Heinrich Fenkart 2014-10-07 06:57:46 +02:00
parent 7af7a5eadb
commit 61705d35fa

View File

@ -29,22 +29,6 @@ $(function () {
strictEqual($scrollspy[0], $el[0], 'collection contains element') strictEqual($scrollspy[0], $el[0], 'collection contains element')
}) })
// Does not work properly ATM, #13500 will fix this
test('should switch "active" class on scroll', function () {
var 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>'
var $topbar = $(topbarHTML).bootstrapScrollspy()
ok($topbar.find('.active', true))
})
test('should only switch "active" class on current target', function () { test('should only switch "active" class on current target', function () {
stop() stop()
@ -77,9 +61,9 @@ $(function () {
var $section = $(sectionHTML).appendTo('#qunit-fixture') var $section = $(sectionHTML).appendTo('#qunit-fixture')
var $scrollspy = $section var $scrollspy = $section
.show() .show()
.find('#scrollspy-example') .find('#scrollspy-example')
.bootstrapScrollspy({ target: '#ss-target' }) .bootstrapScrollspy({ target: '#ss-target' })
$scrollspy.on('scroll.bs.scrollspy', function () { $scrollspy.on('scroll.bs.scrollspy', function () {
ok($section.hasClass('active'), '"active" class still on root node') ok($section.hasClass('active'), '"active" class still on root node')
@ -107,8 +91,8 @@ $(function () {
+ '</div>' + '</div>'
var $section = $(sectionHTML).appendTo('#qunit-fixture') var $section = $(sectionHTML).appendTo('#qunit-fixture')
var $scrollspy = $section var $scrollspy = $section
.show() .show()
.filter('#content') .filter('#content')
$scrollspy.bootstrapScrollspy({ target: '#navigation', offset: $scrollspy.position().top }) $scrollspy.bootstrapScrollspy({ target: '#navigation', offset: $scrollspy.position().top })