From: Andrew Luca Date: Sun, 21 Oct 2018 10:15:35 +0000 (+0300) Subject: test(Modal): reuse _getScrollbarWidth in tests X-Git-Tag: v4.2.0~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f1308ba22ee601744f7f71df712bc4a018b8a0a;p=thirdparty%2Fbootstrap.git test(Modal): reuse _getScrollbarWidth in tests --- diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 914366ae22..c8f247a350 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -13,14 +13,7 @@ $(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 = function () { - var scrollDiv = document.createElement('div') - scrollDiv.className = 'modal-scrollbar-measure' - document.body.appendChild(scrollDiv) - var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth - document.body.removeChild(scrollDiv) - return scrollbarWidth - } + $.fn.getScrollbarWidth = $.fn.modal.Constructor.prototype._getScrollbarWidth // Simulate scrollbars $('html').css('padding-right', '16px')