From a14451deb3b8368de76aad6e728b27032bf8097a Mon Sep 17 00:00:00 2001 From: Ilias Date: Sun, 2 Apr 2017 14:26:25 +0300 Subject: Fix #18373: properly adjust padding-right of body and fixed elements when opening or closing modal --- js/tests/unit/modal.js | 123 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 95 insertions(+), 28 deletions(-) (limited to 'js/tests/unit/modal.js') diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 84492cec2..2c3e42230 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -9,6 +9,10 @@ $(function () { }) QUnit.module('modal', { + before: function () { + // Enable the scrollbar measurer + $('').appendTo('head') + }, 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() @@ -336,81 +340,144 @@ $(function () { $toggleBtn.trigger('click') }) - QUnit.test('should restore inline body padding after closing', function (assert) { + QUnit.test('should adjust the inline body padding when opening and restore when closing', function (assert) { assert.expect(2) var done = assert.async() - var originalBodyPad = 0 var $body = $(document.body) - - $body.css('padding-right', originalBodyPad) + var originalPadding = $body.css('padding-right') $('