diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js
index a4407ece96..063dfabcfb 100644
--- a/js/tests/unit/scrollspy.js
+++ b/js/tests/unit/scrollspy.js
@@ -112,7 +112,7 @@ $(function () {
var $scrollspy = $section
.show()
.find('#scrollspy-example')
- .bootstrapScrollspy({ target: $('#ss-target') })
+ .bootstrapScrollspy({ target: document.getElementById('#ss-target') })
$scrollspy.on('scroll.bs.scrollspy', function () {
assert.ok($section.hasClass('active'), '"active" class still on root node')
@@ -321,89 +321,89 @@ $(function () {
})
QUnit.test('should allow passed in option offset method: offset', function (assert) {
- assert.expect(4)
+ assert.expect(4)
- var testOffsetMethod = function (type) {
- var deferred = $.Deferred()
- var navbarHtml =
- ''
- var contentHtml =
- '
'
- + '
div 1
'
- + '
div 2
'
- + '
div 3
'
- + '
'
+ var testOffsetMethod = function (type) {
+ var deferred = $.Deferred()
+ var navbarHtml =
+ ''
+ var contentHtml =
+ ''
+ + '
div 1
'
+ + '
div 2
'
+ + '
div 3
'
+ + '
'
- $(navbarHtml).appendTo('#qunit-fixture')
- var $content = $(contentHtml)
- .appendTo('#qunit-fixture')
+ $(navbarHtml).appendTo('#qunit-fixture')
+ var $content = $(contentHtml)
+ .appendTo('#qunit-fixture')
- if (type === 'js') $content.bootstrapScrollspy({ target: '.navbar', offset: 0, method: 'offset' })
- else if (type === 'data') $(window).trigger('load.bs.scrollspy.data-api')
+ if (type === 'js') $content.bootstrapScrollspy({ target: '.navbar', offset: 0, method: 'offset' })
+ else if (type === 'data') $(window).trigger('load.bs.scrollspy.data-api')
- var $target = $('#div-' + type + 'm-2')
- var scrollspy = $content.data('bs.scrollspy')
+ var $target = $('#div-' + type + 'm-2')
+ var scrollspy = $content.data('bs.scrollspy')
- assert.ok(scrollspy._offsets[1] === $target.offset().top, 'offsed method with ' + type + ' option')
- assert.ok(scrollspy._offsets[1] !== $target.position().top, 'position method with ' + type + ' option')
+ assert.ok(scrollspy._offsets[1] === $target.offset().top, 'offsed method with ' + type + ' option')
+ assert.ok(scrollspy._offsets[1] !== $target.position().top, 'position method with ' + type + ' option')
- deferred.resolve()
+ deferred.resolve()
- return deferred.promise()
- }
+ return deferred.promise()
+ }
- $.when(testOffsetMethod('js'))
- .then(function () { testOffsetMethod('data') })
- })
+ $.when(testOffsetMethod('js'))
+ .then(function () { testOffsetMethod('data') })
+ })
- QUnit.test('should allow passed in option offset method: position', function (assert) {
- assert.expect(4)
+ QUnit.test('should allow passed in option offset method: position', function (assert) {
+ assert.expect(4)
- var testOffsetMethod = function (type) {
- var deferred = $.Deferred()
- var navbarHtml =
- ''
- var contentHtml =
- ''
- + '
div 1
'
- + '
div 2
'
- + '
div 3
'
- + '
'
+ var testOffsetMethod = function (type) {
+ var deferred = $.Deferred()
+ var navbarHtml =
+ ''
+ var contentHtml =
+ ''
+ + '
div 1
'
+ + '
div 2
'
+ + '
div 3
'
+ + '
'
- $(navbarHtml).appendTo('#qunit-fixture')
- var $content = $(contentHtml)
- .appendTo('#qunit-fixture')
+ $(navbarHtml).appendTo('#qunit-fixture')
+ var $content = $(contentHtml)
+ .appendTo('#qunit-fixture')
- if (type === 'js') $content.bootstrapScrollspy({ target: '.navbar', offset: 0, method: 'position' })
- else if (type === 'data') $(window).trigger('load.bs.scrollspy.data-api')
+ if (type === 'js') $content.bootstrapScrollspy({ target: '.navbar', offset: 0, method: 'position' })
+ else if (type === 'data') $(window).trigger('load.bs.scrollspy.data-api')
- var $target = $('#div-' + type + 'm-2')
- var scrollspy = $content.data('bs.scrollspy')
+ var $target = $('#div-' + type + 'm-2')
+ var scrollspy = $content.data('bs.scrollspy')
- assert.ok(scrollspy._offsets[1] !== $target.offset().top, 'offsed method with ' + type + ' option')
- assert.ok(scrollspy._offsets[1] === $target.position().top, 'position method with ' + type + ' option')
+ assert.ok(scrollspy._offsets[1] !== $target.offset().top, 'offsed method with ' + type + ' option')
+ assert.ok(scrollspy._offsets[1] === $target.position().top, 'position method with ' + type + ' option')
- deferred.resolve()
+ deferred.resolve()
- return deferred.promise()
- }
+ return deferred.promise()
+ }
- $.when(testOffsetMethod('js'))
- .then(function () { testOffsetMethod('data') })
- })
+ $.when(testOffsetMethod('js'))
+ .then(function () { testOffsetMethod('data') })
+ })
})