]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
tests: remove extra spaces, unneeded arrays and add missing newlines
authorXhmikosR <xhmikosr@gmail.com>
Fri, 26 Nov 2021 07:16:59 +0000 (09:16 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 1 Dec 2021 12:30:49 +0000 (14:30 +0200)
18 files changed:
js/tests/unit/base-component.spec.js
js/tests/unit/carousel.spec.js
js/tests/unit/collapse.spec.js
js/tests/unit/dom/selector-engine.spec.js
js/tests/unit/dropdown.spec.js
js/tests/unit/modal.spec.js
js/tests/unit/offcanvas.spec.js
js/tests/unit/scrollspy.spec.js
js/tests/unit/tab.spec.js
js/tests/unit/toast.spec.js
js/tests/unit/tooltip.spec.js
js/tests/unit/util/backdrop.spec.js
js/tests/unit/util/component-functions.spec.js
js/tests/unit/util/focustrap.spec.js
js/tests/unit/util/index.spec.js
js/tests/unit/util/scrollbar.spec.js
js/tests/unit/util/swipe.spec.js
js/tests/unit/util/template-factory.spec.js

index 9fe4e72d7bdd0ed6016ee5226dfe26e20e8bccac..9e0b872d49e805c07bdfb923616ca327ad574d36 100644 (file)
@@ -66,6 +66,7 @@ describe('Base Component', () => {
       })
     })
   })
+
   describe('Public Methods', () => {
     describe('constructor', () => {
       it('should accept element, either passed as a CSS selector or DOM element', () => {
@@ -93,6 +94,7 @@ describe('Base Component', () => {
         expect(selectorInstance._element).not.toBeDefined()
       })
     })
+
     describe('dispose', () => {
       it('should dispose an component', () => {
         createInstance()
@@ -144,6 +146,7 @@ describe('Base Component', () => {
         expect(DummyClass.getInstance(div)).toBeNull()
       })
     })
+
     describe('getOrCreateInstance', () => {
       it('should return an instance', () => {
         createInstance()
index a4b440c893854853da07076e1b2ce0991ab5988e..66f4a8367b49e78911db40a89215194b47d6e1c1 100644 (file)
@@ -235,9 +235,7 @@ describe('Carousel', () => {
 
       const carouselEl = fixtureEl.querySelector('#myCarousel')
       const carousel = new Carousel(carouselEl, { wrap: true })
-      const getActiveId = () => {
-        return carouselEl.querySelector('.carousel-item.active').getAttribute('id')
-      }
+      const getActiveId = () => carouselEl.querySelector('.carousel-item.active').getAttribute('id')
 
       carouselEl.addEventListener('slid.bs.carousel', event => {
         const activeId = getActiveId()
@@ -1153,6 +1151,7 @@ describe('Carousel', () => {
       })
     })
   })
+
   describe('rtl function', () => {
     it('"_directionToOrder" and "_orderToDirection" must return the right results', () => {
       fixtureEl.innerHTML = '<div></div>'
index fa8024f6e1cb1c1139866a5727ce12cf3f71cf13..a7635006fe1c06df104a0024a6eea6ec9dae56d3 100644 (file)
@@ -268,31 +268,31 @@ describe('Collapse', () => {
     it('should be able to handle toggling of other children siblings', done => {
       fixtureEl.innerHTML = [
         '<div id="parentGroup" class="accordion">',
-        '   <div id="parentHeader" class="accordion-header">',
-        '      <button data-bs-target="#parentContent" data-bs-toggle="collapse" role="button" class="accordion-toggle">Parent</button>',
-        '   </div>',
-        '   <div id="parentContent" class="accordion-collapse collapse" aria-labelledby="parentHeader" data-bs-parent="#parentGroup">',
-        '      <div class="accordion-body">',
-        '         <div id="childGroup" class="accordion">',
-        '            <div class="accordion-item">',
-        '               <div id="childHeader1" class="accordion-header">',
-        '                  <button data-bs-target="#childContent1" data-bs-toggle="collapse" role="button" class="accordion-toggle">Child 1</button>',
-        '               </div>',
-        '               <div id="childContent1" class="accordion-collapse collapse" aria-labelledby="childHeader1" data-bs-parent="#childGroup">',
-        '                  <div>content</div>',
-        '               </div>',
-        '            </div>',
-        '            <div class="accordion-item">',
-        '               <div id="childHeader2" class="accordion-header">',
-        '                  <button data-bs-target="#childContent2" data-bs-toggle="collapse" role="button" class="accordion-toggle">Child 2</button>',
-        '               </div>',
-        '               <div id="childContent2" class="accordion-collapse collapse" aria-labelledby="childHeader2" data-bs-parent="#childGroup">',
-        '                  <div>content</div>',
-        '               </div>',
-        '            </div>',
-        '         </div>',
+        '  <div id="parentHeader" class="accordion-header">',
+        '    <button data-bs-target="#parentContent" data-bs-toggle="collapse" role="button" class="accordion-toggle">Parent</button>',
+        '  </div>',
+        '  <div id="parentContent" class="accordion-collapse collapse" aria-labelledby="parentHeader" data-bs-parent="#parentGroup">',
+        '    <div class="accordion-body">',
+        '      <div id="childGroup" class="accordion">',
+        '        <div class="accordion-item">',
+        '          <div id="childHeader1" class="accordion-header">',
+        '           <button data-bs-target="#childContent1" data-bs-toggle="collapse" role="button" class="accordion-toggle">Child 1</button>',
+        '          </div>',
+        '          <div id="childContent1" class="accordion-collapse collapse" aria-labelledby="childHeader1" data-bs-parent="#childGroup">',
+        '           <div>content</div>',
+        '          </div>',
+        '        </div>',
+        '        <div class="accordion-item">',
+        '          <div id="childHeader2" class="accordion-header">',
+        '           <button data-bs-target="#childContent2" data-bs-toggle="collapse" role="button" class="accordion-toggle">Child 2</button>',
+        '          </div>',
+        '          <div id="childContent2" class="accordion-collapse collapse" aria-labelledby="childHeader2" data-bs-parent="#childGroup">',
+        '           <div>content</div>',
+        '          </div>',
+        '        </div>',
         '      </div>',
-        '   </div>',
+        '    </div>',
+        '  </div>',
         '</div>'
       ].join('')
 
@@ -322,31 +322,32 @@ describe('Collapse', () => {
 
       parentBtn.click()
     })
+
     it('should not change tab tabpanels descendants on accordion', done => {
       fixtureEl.innerHTML = [
         '<div class="accordion" id="accordionExample">',
-        '      <div class="accordion-item">',
-        '        <h2 class="accordion-header" id="headingOne">',
-        '          <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">',
-        '            Accordion Item #1',
-        '          </button>',
-        '        </h2>',
-        '        <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">',
-        '          <div class="accordion-body">',
-        '            <nav>',
-        '              <div class="nav nav-tabs" id="nav-tab" role="tablist">',
-        '                <button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button" role="tab" aria-controls="nav-home" aria-selected="true">Home</button>',
-        '                <button class="nav-link" id="nav-profile-tab" data-bs-toggle="tab" data-bs-target="#nav-profile" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</button>',
-        '              </div>',
-        '            </nav>',
-        '            <div class="tab-content" id="nav-tabContent">',
-        '              <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">Home</div>',
-        '              <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">Profile</div>',
-        '            </div>',
+        '  <div class="accordion-item">',
+        '    <h2 class="accordion-header" id="headingOne">',
+        '      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">',
+        '        Accordion Item #1',
+        '      </button>',
+        '    </h2>',
+        '    <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">',
+        '      <div class="accordion-body">',
+        '        <nav>',
+        '          <div class="nav nav-tabs" id="nav-tab" role="tablist">',
+        '            <button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button" role="tab" aria-controls="nav-home" aria-selected="true">Home</button>',
+        '            <button class="nav-link" id="nav-profile-tab" data-bs-toggle="tab" data-bs-target="#nav-profile" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</button>',
         '          </div>',
+        '        </nav>',
+        '        <div class="tab-content" id="nav-tabContent">',
+        '          <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">Home</div>',
+        '          <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">Profile</div>',
         '        </div>',
         '      </div>',
-        '    </div>'
+        '    </div>',
+        '  </div>',
+        '</div>'
       ].join('')
 
       const el = fixtureEl.querySelector('#collapseOne')
index 3df753b72fc85258ae0ecb8419ccbb7520993d19..005e92704cc25d307929e6509baa31ddeddd12bb 100644 (file)
@@ -197,9 +197,7 @@ describe('SelectorEngine', () => {
     })
 
     it('should return not return elements with negative tab index', () => {
-      fixtureEl.innerHTML = [
-        '<button tabindex="-1">lorem</button>'
-      ].join('')
+      fixtureEl.innerHTML = '<button tabindex="-1">lorem</button>'
 
       const expectedElements = []
 
@@ -207,9 +205,7 @@ describe('SelectorEngine', () => {
     })
 
     it('should return contenteditable elements', () => {
-      fixtureEl.innerHTML = [
-        '<div contenteditable="true">lorem</div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div contenteditable="true">lorem</div>'
 
       const expectedElements = [fixtureEl.querySelector('[contenteditable="true"]')]
 
@@ -217,9 +213,7 @@ describe('SelectorEngine', () => {
     })
 
     it('should not return disabled elements', () => {
-      fixtureEl.innerHTML = [
-        '<button disabled="true">lorem</button>'
-      ].join('')
+      fixtureEl.innerHTML = '<button disabled="true">lorem</button>'
 
       const expectedElements = []
 
@@ -227,9 +221,7 @@ describe('SelectorEngine', () => {
     })
 
     it('should not return invisible elements', () => {
-      fixtureEl.innerHTML = [
-        '<button style="display:none;">lorem</button>'
-      ].join('')
+      fixtureEl.innerHTML = '<button style="display:none;">lorem</button>'
 
       const expectedElements = []
 
index 0765768d4b4e1c796a986355fe575342e123f00b..9c0eae6d85608e41d9a70edf1a6d1f248a692c98 100644 (file)
@@ -1750,8 +1750,8 @@ describe('Dropdown', () => {
         '      <a class="dropdown-item" href="#">Secondary link</a>',
         '      <a class="dropdown-item" href="#">Something else here</a>',
         '      <div class="divider"></div>',
-        '     <a class="dropdown-item" href="#">Another link</a>',
-        '   </div>',
+        '      <a class="dropdown-item" href="#">Another link</a>',
+        '    </div>',
         '  </div>',
         '</div>'
       ]
@@ -1783,7 +1783,7 @@ describe('Dropdown', () => {
         '    <button class="btn dropdown-toggle" data-bs-toggle="dropdown">Dropdown</button>',
         '    <div class="dropdown-menu">',
         '      <a class="dropdown-item" href="#">Some Item</a>',
-        '   </div>',
+        '    </div>',
         '  </div>',
         '</div>'
       ]
index dd501aa7bfb8007b4ec354849c05a71009c9506a..5729942e57c472b0e1c14591317292ea688c86e7 100644 (file)
@@ -57,9 +57,7 @@ describe('Modal', () => {
 
   describe('toggle', () => {
     it('should call ScrollBarHelper to handle scrollBar on body', done => {
-      fixtureEl.innerHTML = [
-        '<div class="modal"><div class="modal-dialog"></div></div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div class="modal"><div class="modal-dialog"></div></div>'
 
       spyOn(ScrollBarHelper.prototype, 'hide').and.callThrough()
       spyOn(ScrollBarHelper.prototype, 'reset').and.callThrough()
index e262a9a3a04215bcd8e6403204ade657ebf13ba5..191a9f801820157fd17f35b9dc8c199a9e994d3e 100644 (file)
@@ -108,10 +108,7 @@ describe('Offcanvas', () => {
 
   describe('config', () => {
     it('should have default values', () => {
-      fixtureEl.innerHTML = [
-        '<div class="offcanvas">',
-        '</div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div class="offcanvas"></div>'
 
       const offCanvasEl = fixtureEl.querySelector('.offcanvas')
       const offCanvas = new Offcanvas(offCanvasEl)
@@ -123,10 +120,7 @@ describe('Offcanvas', () => {
     })
 
     it('should read data attributes and override default config', () => {
-      fixtureEl.innerHTML = [
-        '<div class="offcanvas" data-bs-scroll="true" data-bs-backdrop="false"  data-bs-keyboard="false">',
-        '</div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div class="offcanvas" data-bs-scroll="true" data-bs-backdrop="false" data-bs-keyboard="false"></div>'
 
       const offCanvasEl = fixtureEl.querySelector('.offcanvas')
       const offCanvas = new Offcanvas(offCanvasEl)
@@ -138,10 +132,7 @@ describe('Offcanvas', () => {
     })
 
     it('given a config object must override data attributes', () => {
-      fixtureEl.innerHTML = [
-        '<div class="offcanvas" data-bs-scroll="true" data-bs-backdrop="false"  data-bs-keyboard="false">',
-        '</div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div class="offcanvas" data-bs-scroll="true" data-bs-backdrop="false" data-bs-keyboard="false"></div>'
 
       const offCanvasEl = fixtureEl.querySelector('.offcanvas')
       const offCanvas = new Offcanvas(offCanvasEl, {
@@ -154,6 +145,7 @@ describe('Offcanvas', () => {
       expect(offCanvas._config.scroll).toBeFalse()
     })
   })
+
   describe('options', () => {
     it('if scroll is enabled, should allow body to scroll while offcanvas is open', done => {
       fixtureEl.innerHTML = '<div class="offcanvas"></div>'
index 1b713757e3a69d64acd7b2f957205c4e16cdb56e..5c044e697aecd0dc7e6fe7968438eacb2e16e263 100644 (file)
@@ -73,8 +73,8 @@ describe('ScrollSpy', () => {
         '  </ul>',
         '</nav>',
         '<div id="content" style="height: 200px; overflow-y: auto;">',
-        ' <div id="two" style="height: 300px;"></div>',
-        ' <div id="three" style="height: 10px;"></div>',
+        '  <div id="two" style="height: 300px;"></div>',
+        '  <div id="three" style="height: 10px;"></div>',
         '</div>'
       ].join('')
 
@@ -175,16 +175,16 @@ describe('ScrollSpy', () => {
       fixtureEl.innerHTML = [
         '<div id="header" style="height: 500px;"></div>',
         '<nav id="navigation" class="navbar">',
-        ' <ul class="navbar-nav">',
-        '   <li class="nav-item"><a class="nav-link active" id="one-link" href="#one">One</a></li>',
-        '   <li class="nav-item"><a class="nav-link" id="two-link" href="#two">Two</a></li>',
-        '   <li class="nav-item"><a class="nav-link" id="three-link" href="#three">Three</a></li>',
-        ' </ul>',
+        '  <ul class="navbar-nav">',
+        '    <li class="nav-item"><a class="nav-link active" id="one-link" href="#one">One</a></li>',
+        '    <li class="nav-item"><a class="nav-link" id="two-link" href="#two">Two</a></li>',
+        '    <li class="nav-item"><a class="nav-link" id="three-link" href="#three">Three</a></li>',
+        '  </ul>',
         '</nav>',
         '<div id="content" style="height: 200px; overflow-y: auto;">',
-        ' <div id="one" style="height: 500px;"></div>',
-        ' <div id="two" style="height: 300px;"></div>',
-        ' <div id="three" style="height: 10px;"></div>',
+        '  <div id="one" style="height: 500px;"></div>',
+        '  <div id="two" style="height: 300px;"></div>',
+        '  <div id="three" style="height: 10px;"></div>',
         '</div>'
       ].join('')
 
index ade0f35704faa0e1e7de8e3cc821d34a8c08bdd3..43d20438ebdda4903201b4ef9ce38b79f05364df 100644 (file)
@@ -21,8 +21,12 @@ describe('Tab', () => {
   describe('constructor', () => {
     it('should take care of element either passed as a CSS selector or DOM element', () => {
       fixtureEl.innerHTML = [
-        '<ul class="nav"><li><a href="#home" role="tab">Home</a></li></ul>',
-        '<ul><li id="home"></li></ul>'
+        '<ul class="nav">',
+        '  <li><a href="#home" role="tab">Home</a></li>',
+        '</ul>',
+        '<ul>',
+        '  <li id="home"></li>',
+        '</ul>'
       ].join('')
 
       const tabEl = fixtureEl.querySelector('[href="#home"]')
@@ -112,7 +116,10 @@ describe('Tab', () => {
         '  <button type="button" data-bs-target="#home" role="tab">Home</button>',
         '  <button type="button" id="triggerProfile" data-bs-target="#profile" role="tab">Profile</a>',
         '</nav>',
-        '<div><div id="home" role="tabpanel"></div><div id="profile" role="tabpanel"></div></div>'
+        '<div>',
+        '  <div id="home" role="tabpanel"></div>',
+        '  <div id="profile" role="tabpanel"></div>',
+        '</div>'
       ].join('')
 
       const profileTriggerEl = fixtureEl.querySelector('#triggerProfile')
@@ -132,7 +139,10 @@ describe('Tab', () => {
         '  <button type="button" data-bs-target="#home" role="tab">Home</button>',
         '  <button type="button" id="triggerProfile" data-bs-target="#profile" role="tab">Profile</button>',
         '</div>',
-        '<div><div id="home" role="tabpanel"></div><div id="profile" role="tabpanel"></div></div>'
+        '<div>',
+        '  <div id="home" role="tabpanel"></div>',
+        '  <div id="profile" role="tabpanel"></div>',
+        '</div>'
       ].join('')
 
       const profileTriggerEl = fixtureEl.querySelector('#triggerProfile')
index 9541bcdeec0f628516d1f82c6d1c8a6b84707c73..c4ea43808c5271b536c9a3fe753d0ceb1f7d7aaa 100644 (file)
@@ -393,7 +393,7 @@ describe('Toast', () => {
         '  <div class="toast-body">',
         '    a simple toast',
         '  </div>',
-        '  </div>'
+        '</div>'
       ].join('')
 
       const toastEl = fixtureEl.querySelector('.toast')
index 9b87f75b2a0acc187403014d1ba7748812729ea8..d8ca21a630e7215ae88d5fad7d9fca6b9a7892e3 100644 (file)
@@ -416,13 +416,14 @@ describe('Tooltip', () => {
     })
 
     it('should show a tooltip when hovering a children element', done => {
-      fixtureEl.innerHTML =
-        '<a href="#" rel="tooltip" title="Another tooltip">' +
-          '<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 100 100">' +
-            '<rect width="100%" fill="#563d7c"/>' +
-            '<circle cx="50" cy="50" r="30" fill="#fff"/>' +
-          '</svg>' +
+      fixtureEl.innerHTML = [
+        '<a href="#" rel="tooltip" title="Another tooltip">',
+        '  <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 100 100">',
+        '    <rect width="100%" fill="#563d7c"/>',
+        '    <circle cx="50" cy="50" r="30" fill="#fff"/>',
+        '  </svg>',
         '</a>'
+      ].join('')
 
       const tooltipEl = fixtureEl.querySelector('a')
       const tooltip = new Tooltip(tooltipEl)
@@ -1201,7 +1202,7 @@ describe('Tooltip', () => {
 
       const content = [
         '<div id="childContent">',
-        ' <button type="button">test btn</button>',
+        '  <button type="button">test btn</button>',
         '</div>'
       ].join('')
 
index 5a62ab8b153b3108b2675819b24cbf09158d86e4..4fa9e543668fc33a59c10cb2bc02eadbbb9e81a1 100644 (file)
@@ -232,6 +232,7 @@ describe('Backdrop', () => {
       })
     })
   })
+
   describe('Config', () => {
     describe('rootElement initialization', () => {
       it('Should be appended on "document.body" by default', done => {
@@ -258,10 +259,7 @@ describe('Backdrop', () => {
       })
 
       it('Should appended on any element given by the proper config', done => {
-        fixtureEl.innerHTML = [
-          '<div id="wrapper">',
-          '</div>'
-        ].join('')
+        fixtureEl.innerHTML = '<div id="wrapper"></div>'
 
         const wrapper = fixtureEl.querySelector('#wrapper')
         const instance = new Backdrop({
index edaedd32ee1d2b98d2379b00cf995031c20cd801..16f910a633ec3344420004812ce7f499a909f423 100644 (file)
@@ -33,7 +33,7 @@ describe('Plugin functions', () => {
     it('should get Plugin and execute the given method, when a click occurred on data-bs-dismiss="PluginName"', () => {
       fixtureEl.innerHTML = [
         '<div id="foo" class="test">',
-        '      <button type="button" data-bs-dismiss="test" data-bs-target="#foo"></button>',
+        '  <button type="button" data-bs-dismiss="test" data-bs-target="#foo"></button>',
         '</div>'
       ].join('')
 
@@ -53,7 +53,7 @@ describe('Plugin functions', () => {
     it('if data-bs-dismiss="PluginName" hasn\'t got "data-bs-target", "getOrCreateInstance" has to be initialized by closest "plugin.Name" class', () => {
       fixtureEl.innerHTML = [
         '<div id="foo" class="test">',
-        '   <button type="button" data-bs-dismiss="test"></button>',
+        '  <button type="button" data-bs-dismiss="test"></button>',
         '</div>'
       ].join('')
 
@@ -73,7 +73,7 @@ describe('Plugin functions', () => {
     it('if data-bs-dismiss="PluginName" is disabled, must not trigger function', () => {
       fixtureEl.innerHTML = [
         '<div id="foo" class="test">',
-        '   <button type="button" disabled data-bs-dismiss="test"></button>',
+        '  <button type="button" disabled data-bs-dismiss="test"></button>',
         '</div>'
       ].join('')
 
@@ -90,7 +90,7 @@ describe('Plugin functions', () => {
     it('should prevent default when the trigger is <a> or <area>', () => {
       fixtureEl.innerHTML = [
         '<div id="foo" class="test">',
-        '      <a type="button" data-bs-dismiss="test"></a>',
+        '  <a type="button" data-bs-dismiss="test"></a>',
         '</div>'
       ].join('')
 
index 12fd46ecf4d7d9789683d5f053f308d9c02ee61a..52a7573971c21884e8a70ff05ac429374a745ca7 100644 (file)
@@ -45,7 +45,7 @@ describe('FocusTrap', () => {
       fixtureEl.innerHTML = [
         '<a href="#" id="outside">outside</a>',
         '<div id="focustrap" tabindex="-1">',
-        '   <a href="#" id="inside">inside</a>',
+        '  <a href="#" id="inside">inside</a>',
         '</div>'
       ].join('')
 
@@ -78,9 +78,9 @@ describe('FocusTrap', () => {
       fixtureEl.innerHTML = [
         '<a href="#" id="outside">outside</a>',
         '<div id="focustrap" tabindex="-1">',
-        '   <a href="#" id="first">first</a>',
-        '   <a href="#" id="inside">inside</a>',
-        '   <a href="#" id="last">last</a>',
+        '  <a href="#" id="first">first</a>',
+        '  <a href="#" id="inside">inside</a>',
+        '  <a href="#" id="last">last</a>',
         '</div>'
       ].join('')
 
@@ -115,9 +115,9 @@ describe('FocusTrap', () => {
       fixtureEl.innerHTML = [
         '<a href="#" id="outside">outside</a>',
         '<div id="focustrap" tabindex="-1">',
-        '   <a href="#" id="first">first</a>',
-        '   <a href="#" id="inside">inside</a>',
-        '   <a href="#" id="last">last</a>',
+        '  <a href="#" id="first">first</a>',
+        '  <a href="#" id="inside">inside</a>',
+        '  <a href="#" id="last">last</a>',
         '</div>'
       ].join('')
 
index e0220091e3c6de1ce6b616d13e60d3023f6d3c4d..a9e446c9df415ac10e8b3b2d6cc9a6f203ad9365 100644 (file)
@@ -431,6 +431,7 @@ describe('Util', () => {
       expect(Util.isDisabled(el('#select'))).toBeFalse()
       expect(Util.isDisabled(el('#input'))).toBeFalse()
     })
+
     it('should return true if the element has disabled attribute', () => {
       fixtureEl.innerHTML = [
         '<div>',
index ee17d3c7b45fa2dd1fffcb8eedb4b5813abc894b..c42234c4fe40636c4760aa4d8754fc48e6f306d7 100644 (file)
@@ -24,7 +24,9 @@ describe('ScrollBar', () => {
     }
   }
 
-  const isScrollBarHidden = () => { // IOS devices, Android devices and Browsers on Mac, hide scrollbar by default and appear it, only while scrolling. So the tests for scrollbar would fail
+  // iOS, Android devices and macOS browsers hide scrollbar by default and show it only while scrolling.
+  // So the tests for scrollbar would fail
+  const isScrollBarHidden = () => {
     const calc = windowCalculations()
     return calc.htmlClient === calc.htmlOffset && calc.htmlClient === calc.window
   }
@@ -52,9 +54,7 @@ describe('ScrollBar', () => {
     it('should return true if body is overflowing', () => {
       document.documentElement.style.overflowY = 'scroll'
       document.body.style.overflowY = 'scroll'
-      fixtureEl.innerHTML = [
-        '<div style="height: 110vh; width: 100%"></div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
       const result = new ScrollBarHelper().isOverflowing()
 
       if (isScrollBarHidden()) {
@@ -67,9 +67,7 @@ describe('ScrollBar', () => {
     it('should return false if body is not overflowing', () => {
       doc.style.overflowY = 'hidden'
       document.body.style.overflowY = 'hidden'
-      fixtureEl.innerHTML = [
-        '<div style="height: 110vh; width: 100%"></div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
       const scrollBar = new ScrollBarHelper()
       const result = scrollBar.isOverflowing()
 
@@ -81,9 +79,7 @@ describe('ScrollBar', () => {
     it('should return an integer greater than zero, if body is overflowing', () => {
       doc.style.overflowY = 'scroll'
       document.body.style.overflowY = 'scroll'
-      fixtureEl.innerHTML = [
-        '<div style="height: 110vh; width: 100%"></div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
       const result = new ScrollBarHelper().getWidth()
 
       if (isScrollBarHidden()) {
@@ -96,9 +92,7 @@ describe('ScrollBar', () => {
     it('should return 0 if body is not overflowing', () => {
       document.documentElement.style.overflowY = 'hidden'
       document.body.style.overflowY = 'hidden'
-      fixtureEl.innerHTML = [
-        '<div style="height: 110vh; width: 100%"></div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div style="height: 110vh; width: 100%"></div>'
 
       const result = new ScrollBarHelper().getWidth()
 
@@ -109,9 +103,9 @@ describe('ScrollBar', () => {
   describe('hide - reset', () => {
     it('should adjust the inline padding of fixed elements which are full-width', done => {
       fixtureEl.innerHTML = [
-        '<div style="height: 110vh; width: 100%">' +
-        '<div class="fixed-top" id="fixed1" style="padding-right: 0px; width: 100vw"></div>',
-        '<div class="fixed-top" id="fixed2" style="padding-right: 5px; width: 100vw"></div>',
+        '<div style="height: 110vh; width: 100%">',
+        '  <div class="fixed-top" id="fixed1" style="padding-right: 0px; width: 100vw"></div>',
+        '  <div class="fixed-top" id="fixed2" style="padding-right: 5px; width: 100vw"></div>',
         '</div>'
       ].join('')
       doc.style.overflowY = 'scroll'
@@ -145,8 +139,8 @@ describe('ScrollBar', () => {
 
     it('should adjust the inline margin and padding of sticky elements', done => {
       fixtureEl.innerHTML = [
-        '<div style="height: 110vh">' +
-        '<div class="sticky-top" style="margin-right: 10px; padding-right: 20px; width: 100vw; height: 10px"></div>',
+        '<div style="height: 110vh">',
+        '  <div class="sticky-top" style="margin-right: 10px; padding-right: 20px; width: 100vw; height: 10px"></div>',
         '</div>'
       ].join('')
       doc.style.overflowY = 'scroll'
@@ -173,9 +167,7 @@ describe('ScrollBar', () => {
     })
 
     it('should not adjust the inline margin and padding of sticky and fixed elements when element do not have full width', () => {
-      fixtureEl.innerHTML = [
-        '<div class="sticky-top" style="margin-right: 0px; padding-right: 0px; width: 50vw"></div>'
-      ].join('')
+      fixtureEl.innerHTML = '<div class="sticky-top" style="margin-right: 0px; padding-right: 0px; width: 50vw"></div>'
 
       const stickyTopEl = fixtureEl.querySelector('.sticky-top')
       const originalMargin = getMarginX(stickyTopEl)
@@ -195,8 +187,8 @@ describe('ScrollBar', () => {
 
     it('should not put data-attribute if element doesn\'t have the proper style property, should just remove style property if element didn\'t had one', () => {
       fixtureEl.innerHTML = [
-        '<div style="height: 110vh; width: 100%">' +
-        '<div class="sticky-top" id="sticky" style="width: 100vw"></div>',
+        '<div style="height: 110vh; width: 100%">',
+        '  <div class="sticky-top" id="sticky" style="width: 100vw"></div>',
         '</div>'
       ].join('')
 
@@ -243,7 +235,7 @@ describe('ScrollBar', () => {
         fixtureEl.innerHTML = [
           '<style>',
           '  body {',
-          `       padding-right: ${styleSheetPadding} }`,
+          `    padding-right: ${styleSheetPadding}`,
           '  }',
           '</style>'
         ].join('')
@@ -283,7 +275,7 @@ describe('ScrollBar', () => {
         fixtureEl.innerHTML = [
           '<style>',
           '  body {',
-          `       padding-right: ${styleSheetPadding} }`,
+          `    padding-right: ${styleSheetPadding}`,
           '  }',
           '</style>'
         ].join('')
index 474e34f653f40c883a8aa5bc33fe4ab341750f94..93131b8fddd380ac7fa1bdc28cd18618382b3c19 100644 (file)
@@ -39,17 +39,17 @@ describe('Swipe', () => {
     fixtureEl = getFixture()
     const cssStyle = [
       '<style>',
-      '   #fixture .pointer-event {',
-      '     touch-action: pan-y;',
+      '  #fixture .pointer-event {',
+      '    touch-action: pan-y;',
       '  }',
-      '   #fixture div {',
-      '     width: 300px;',
-      '     height: 300px;',
+      '  #fixture div {',
+      '    width: 300px;',
+      '    height: 300px;',
       '  }',
       '</style>'
     ].join('')
 
-    fixtureEl.innerHTML = '<div id="swipeEl"></div>' + cssStyle
+    fixtureEl.innerHTML = `<div id="swipeEl"></div>${cssStyle}`
     swipeEl = fixtureEl.querySelector('div')
   })
 
@@ -266,7 +266,7 @@ describe('Swipe', () => {
       expect(Swipe.isSupported()).toBeTrue()
     })
 
-    it('should return "false" if "touchstart" not exists in document element and "navigator.maxTouchPoints" are  zero (0)', () => {
+    it('should return "false" if "touchstart" not exists in document element and "navigator.maxTouchPoints" are zero (0)', () => {
       Object.defineProperty(window.navigator, 'maxTouchPoints', () => 0)
       deleteDocumentElementOntouchstart()
 
index dccf2a5857b7fdf5ee234a1117b9659a48a6fbae..0fdf87146669474f2a840010206c7ecd8d0a380b 100644 (file)
@@ -113,11 +113,11 @@ describe('TemplateFactory', () => {
   describe('Content', () => {
     it('add simple text content', () => {
       const template = [
-        '<div>' +
-        '<div class="foo"></div>' +
-        '<div class="foo2"></div>' +
+        '<div>',
+        '  <div class="foo"></div>',
+        '  <div class="foo2"></div>',
         '</div>'
-      ].join(' ')
+      ].join('')
 
       const factory = new TemplateFactory({
         template,
@@ -245,14 +245,15 @@ describe('TemplateFactory', () => {
       expect(factory.hasContent()).toBeFalse()
     })
   })
+
   describe('changeContent', () => {
     it('should change Content', () => {
       const template = [
-        '<div>' +
-        '<div class="foo"></div>' +
-        '<div class="foo2"></div>' +
+        '<div>',
+        '  <div class="foo"></div>',
+        '  <div class="foo2"></div>',
         '</div>'
-      ].join(' ')
+      ].join('')
 
       const factory = new TemplateFactory({
         template,
@@ -276,11 +277,11 @@ describe('TemplateFactory', () => {
 
     it('should change only the given, content', () => {
       const template = [
-        '<div>' +
-        '<div class="foo"></div>' +
-        '<div class="foo2"></div>' +
+        '<div>',
+        '  <div class="foo"></div>',
+        '  <div class="foo2"></div>',
         '</div>'
-      ].join(' ')
+      ].join('')
 
       const factory = new TemplateFactory({
         template,