Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann-S <johann.servoire@gmail.com>2018-07-11 11:40:06 +0300
committerJohann-S <johann.servoire@gmail.com>2018-07-11 12:05:38 +0300
commit283ab30164f0f58ffb13063d800b7a2ee686bb8a (patch)
tree642c8504cdc6dc5bb2ba866bf6918d45010633c8
parentcb82394fc8645d4e41476d19693844fac5022b4c (diff)
fix(modal): fix unit test and resetting style
-rw-r--r--js/src/modal.js13
-rw-r--r--js/tests/unit/modal.js3
2 files changed, 6 insertions, 10 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index e7f9d2d960..29fcc76bf5 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -431,7 +431,6 @@ const Modal = (($) => {
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
const fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT))
const stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT))
- const navbarToggler = [].slice.call(document.querySelectorAll(Selector.NAVBAR_TOGGLER))
// Adjust fixed content padding
$(fixedContent).each((index, element) => {
@@ -465,11 +464,8 @@ const Modal = (($) => {
const fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT))
$(fixedContent).each((index, element) => {
const padding = $(element).data('padding-right')
- if (typeof padding !== 'undefined') {
- $(element)
- .css('padding-right', padding)
- .removeData('padding-right')
- }
+ $(element).removeData('padding-right')
+ element.style.paddingRight = padding ? padding : ''
})
// Restore sticky content
@@ -483,9 +479,8 @@ const Modal = (($) => {
// Restore body padding
const padding = $(document.body).data('padding-right')
- if (typeof padding !== 'undefined') {
- $(document.body).css('padding-right', padding).removeData('padding-right')
- }
+ $(document.body).removeData('padding-right')
+ document.body.style.paddingRight = padding ? padding : ''
}
_getScrollbarWidth() { // thx d.walsh
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 2729e4e4b9..53a2e04167 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -21,7 +21,8 @@ $(function () {
document.body.removeChild(scrollDiv)
return scrollbarWidth
}
- // Simulate scrollbars in PhantomJS
+
+ // Simulate scrollbars
$('html').css('padding-right', '16px')
},
beforeEach: function () {