From: David Bailey Date: Tue, 29 Aug 2017 11:01:41 +0000 (+0100) Subject: Fix unit tests in PhantomJS X-Git-Tag: v4.0.0-beta.2~299^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2622a015f2d38673e3af92a3031ae8b2f2a9ce0f;p=thirdparty%2Fbootstrap.git Fix unit tests in PhantomJS Use a virtual scrollbar as this is simpler than having a real one (overflow: scroll doesn't seem to work in Phantom), and disable it for the new test. One test has also been altered to prevent erroneous fails when other inline styles are added to the body (e.g. overflow). --- diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 3611dfdf11..735dc4f0c8 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -21,6 +21,8 @@ $(function () { document.body.removeChild(scrollDiv) return scrollbarWidth } + // Simulate scrollbars in PhantomJS + $('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 @@ -397,14 +399,19 @@ $(function () { var $body = $(document.body) var originalPadding = $body.css('padding-right') - $('#qunit-container').hide() + // Hide scrollbars to prevent the body overflowing + $body.css('overflow', 'hidden') // real scrollbar (for in-browser testing) + $('html').css('padding-right', '0px') // simulated scrollbar (for PhantomJS) + $('