From d79c6f071b03cefddb1efa50cbefb8111767db1b Mon Sep 17 00:00:00 2001 From: Andrew Luca Date: Sun, 21 Oct 2018 13:15:35 +0300 Subject: [PATCH] test(Modal): reuse _getScrollbarWidth in tests --- js/tests/unit/modal.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 914366ae2214..c8f247a35060 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')