$(function () { 'use strict' window.Util = typeof bootstrap !== 'undefined' ? bootstrap.Util : Util QUnit.module('modal plugin') QUnit.test('should be defined on jquery object', function (assert) { assert.expect(1) assert.ok($(document.body).modal, 'modal method is defined') }) QUnit.module('modal', { before: function () { // Enable the scrollbar measurer $('').appendTo('head') // Function to calculate the scrollbar width which is then compared to the padding or margin changes $.fn.getScrollbarWidth = $.fn.modal.Constructor.prototype._getScrollbarWidth // Simulate scrollbars $('html').css('padding-right', '16px') }, beforeEach: function () { // Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode $.fn.bootstrapModal = $.fn.modal.noConflict() }, afterEach: function () { $('.modal-backdrop, #modal-test').remove() $(document.body).removeClass('modal-open') $.fn.modal = $.fn.bootstrapModal delete $.fn.bootstrapModal $('#qunit-fixture').html('') } }) QUnit.test('should provide no conflict', function (assert) { assert.expect(1) assert.strictEqual(typeof $.fn.modal, 'undefined', 'modal was set back to undefined (orig value)') }) QUnit.test('should throw explicit error on undefined method', function (assert) { assert.expect(1) var $el = $('