]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
fix(modal): fix unit test and resetting style
authorJohann-S <johann.servoire@gmail.com>
Wed, 11 Jul 2018 08:40:06 +0000 (10:40 +0200)
committerJohann-S <johann.servoire@gmail.com>
Wed, 11 Jul 2018 09:05:38 +0000 (11:05 +0200)
js/src/modal.js
js/tests/unit/modal.js

index e7f9d2d9604d48e55526104867d1ac9d1cc8a3c9..29fcc76bf5e8f4747e6f49f5ae29cd6398eb925c 100644 (file)
@@ -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
index 2729e4e4b9f210ea7ad42b5964aa82a33d4a4d17..53a2e0416765d8ba4a599fcaff32bbc4c456339f 100644 (file)
@@ -21,7 +21,8 @@ $(function () {
         document.body.removeChild(scrollDiv)
         return scrollbarWidth
       }
-      // Simulate scrollbars in PhantomJS
+
+      // Simulate scrollbars
       $('html').css('padding-right', '16px')
     },
     beforeEach: function () {