$(function () { 'use strict'; module('scrollspy plugin') test('should be defined on jquery object', function () { ok($(document.body).scrollspy, 'scrollspy method is defined') }) module('scrollspy', { setup: function () { // Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode $.fn.bootstrapScrollspy = $.fn.scrollspy.noConflict() }, teardown: function () { $.fn.scrollspy = $.fn.bootstrapScrollspy delete $.fn.bootstrapScrollspy } }) test('should provide no conflict', function () { ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)') }) test('should return element', function () { ok($(document.body).bootstrapScrollspy()[0] == document.body, 'document.body returned') }) test('should switch active class on scroll', function () { var sectionHTML = '
' $(sectionHTML).append('#qunit-fixture') var topbarHTML = ' ' var $topbar = $(topbarHTML).bootstrapScrollspy() $(sectionHTML).append('#qunit-fixture') ok($topbar.find('.active', true)) }) asyncTest('should only switch active class on current target', function () { expect(1); var sectionHTML = '' + 'Ad leggings keytar, brunch id art party dolor labore.' + '
' + '' + 'Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard.' + '
' + '