Skip to content

Commit

Permalink
fix(modal): fix unit test and resetting style
Browse files Browse the repository at this point in the history
  • Loading branch information
Johann-S committed Jul 11, 2018
1 parent cb82394 commit 283ab30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
13 changes: 4 additions & 9 deletions js/src/modal.js
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion js/tests/unit/modal.js
Expand Up @@ -21,7 +21,8 @@ $(function () {
document.body.removeChild(scrollDiv)
return scrollbarWidth
}
// Simulate scrollbars in PhantomJS

// Simulate scrollbars
$('html').css('padding-right', '16px')
},
beforeEach: function () {
Expand Down

0 comments on commit 283ab30

Please sign in to comment.