-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #22332: Adjust tests for hidden scrollbar #22337
Conversation
js/tests/unit/modal.js
Outdated
@@ -12,6 +12,14 @@ $(function () { | |||
before: function () { | |||
// Enable the scrollbar measurer | |||
$('<style type="text/css"> .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll; } </style>').appendTo('head') | |||
$.fn.getScrollbarWidth = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can add here, why did you add this function
js/tests/unit/modal.js
Outdated
}) | ||
.bootstrapModal('show') | ||
// This test only works when the vertical scrollbar is visible and part of the document (which is not the case for macOS and mobile devices) | ||
if ($(this).getScrollbarWidth()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will fail because no test will be run here you should add an else
condition
Edit : As I said, see here : https://travis-ci.org/twbs/bootstrap/jobs/217986589
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional removed.
thank you for your comments.
983299179@qq.com
From: Ilias
Date: 2017-04-03 17:20
To: twbs/bootstrap
CC: Subscribed
Subject: Re: [twbs/bootstrap] Fix #22332: Check if the scrollbar affects the document before running the padding tests (#22337)
There's no point running the test when no changes are made to the DOM. I will move the conditional outside and if that fails too I will remove the opening test altogether.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@Johann-S I modified the tests to check if the padding/margin is changed as expected, even if that is zero. Should no longer give errors, but please give it a try. You may want to clear the "changes requested" flag, since I forced a push on the previous commit to keep it clean. |
Thank you @deilv every tests passed (https://travis-ci.org/twbs/bootstrap/jobs/218028318) |
On macOS and mobile devices the scrollbar is not part of the document, but rather floats above it. This means that it does not affect body/fixed element padding and scrollbarWidth is equal to 0.
The problem in #22332 was caused by the fact that the test expected padding-right to be increased while opening a modal, but threw an error when it was not (because padding + 0 = padding).
To address the issue the following changes have been made: