diff options
author | Louis-Maxime Piton <louismaxime.piton@orange.com> | 2021-12-02 13:01:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 13:01:11 +0300 |
commit | d8999dd5666336dcf6976cc65bc0d562a4baec5a (patch) | |
tree | f085870113e1b95891b664974dbc2665cf16905b /js | |
parent | 385fea49e8a7c83f2e9655cd9453256aef254aaa (diff) |
Tests: Minor fixes (#35455)
Diffstat (limited to 'js')
-rw-r--r-- | js/tests/unit/carousel.spec.js | 10 | ||||
-rw-r--r-- | js/tests/unit/collapse.spec.js | 8 | ||||
-rw-r--r-- | js/tests/unit/dropdown.spec.js | 2 | ||||
-rw-r--r-- | js/tests/unit/modal.spec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/offcanvas.spec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/tab.spec.js | 2 | ||||
-rw-r--r-- | js/tests/unit/tooltip.spec.js | 17 |
7 files changed, 26 insertions, 25 deletions
diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js index 66f4a8367b..ce9cd0fbcd 100644 --- a/js/tests/unit/carousel.spec.js +++ b/js/tests/unit/carousel.spec.js @@ -1430,7 +1430,7 @@ describe('Carousel', () => { ' <div class="carousel-item">item 3</div>', ' </div>', ' <button class="carousel-control-prev" data-bs-target="#myCarousel" type="button" data-bs-slide="prev"></button>', - ' <button id="next" class="carousel-control-next" data-bs-target="#myCarousel" type="button" data-bs-slide="next"></div>', + ' <button id="next" class="carousel-control-next" data-bs-target="#myCarousel" type="button" data-bs-slide="next"></button>', '</div>' ].join('') @@ -1453,8 +1453,8 @@ describe('Carousel', () => { ' <div id="item2" class="carousel-item">item 2</div>', ' <div class="carousel-item">item 3</div>', ' </div>', - ' <a class="carousel-control-prev" href="#myCarousel" role="button" data-bs-slide="prev"></button>', - ' <a id="next" class="carousel-control-next" href="#myCarousel" role="button" data-bs-slide="next"></div>', + ' <a class="carousel-control-prev" href="#myCarousel" role="button" data-bs-slide="prev"></a>', + ' <a id="next" class="carousel-control-next" href="#myCarousel" role="button" data-bs-slide="next"></a>', '</div>' ].join('') @@ -1520,8 +1520,8 @@ describe('Carousel', () => { ' <div id="item2" class="carousel-item">item 2</div>', ' <div class="carousel-item">item 3</div>', ' </div>', - ' <button class="carousel-control-prev" data-bs-target="#myCarousel" type="button" data-bs-slide="prev"></div>', - ' <button id="next" class="carousel-control-next" data-bs-target="#myCarousel" type="button" data-bs-slide="next"></div>', + ' <button class="carousel-control-prev" data-bs-target="#myCarousel" type="button" data-bs-slide="prev"></button>', + ' <button id="next" class="carousel-control-next" data-bs-target="#myCarousel" type="button" data-bs-slide="next"></button>', '</div>' ].join('') diff --git a/js/tests/unit/collapse.spec.js b/js/tests/unit/collapse.spec.js index a7635006fe..327a68449b 100644 --- a/js/tests/unit/collapse.spec.js +++ b/js/tests/unit/collapse.spec.js @@ -276,18 +276,18 @@ describe('Collapse', () => { ' <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>', + ' <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>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>', + ' <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>content</div>', ' </div>', ' </div>', ' </div>', diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js index aec70063ec..037a6a5a93 100644 --- a/js/tests/unit/dropdown.spec.js +++ b/js/tests/unit/dropdown.spec.js @@ -130,7 +130,7 @@ describe('Dropdown', () => { it('should allow to pass config to Popper with `popperConfig` as a function', () => { fixtureEl.innerHTML = [ '<div class="dropdown">', - ' <button class="btn dropdown-toggle" data-bs-toggle="dropdown" data-bs-placement="right" >Dropdown</button>', + ' <button class="btn dropdown-toggle" data-bs-toggle="dropdown" data-bs-placement="right">Dropdown</button>', ' <div class="dropdown-menu">', ' <a class="dropdown-item" href="#">Secondary link</a>', ' </div>', diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index 5729942e57..84a95c86ad 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -277,8 +277,7 @@ describe('Modal', () => { fixtureEl.innerHTML = [ '<button type="button" data-bs-dismiss="modal" data-bs-target="#modal1"></button>', '<div id="modal1" class="modal fade">', - ' <div class="modal-dialog">', - ' </div>', + ' <div class="modal-dialog"></div>', '</div>' ].join('') @@ -303,8 +302,7 @@ describe('Modal', () => { it('should set .modal\'s scroll top to 0', done => { fixtureEl.innerHTML = [ '<div class="modal fade">', - ' <div class="modal-dialog">', - ' </div>', + ' <div class="modal-dialog"></div>', '</div>' ].join('') diff --git a/js/tests/unit/offcanvas.spec.js b/js/tests/unit/offcanvas.spec.js index 191a9f8018..f4b0b64828 100644 --- a/js/tests/unit/offcanvas.spec.js +++ b/js/tests/unit/offcanvas.spec.js @@ -490,7 +490,7 @@ describe('Offcanvas', () => { it('should call hide first, if another offcanvas is open', done => { fixtureEl.innerHTML = [ - '<button id="btn2" data-bs-toggle="offcanvas" data-bs-target="#offcanvas2" ></button>', + '<button id="btn2" data-bs-toggle="offcanvas" data-bs-target="#offcanvas2"></button>', '<div id="offcanvas1" class="offcanvas"></div>', '<div id="offcanvas2" class="offcanvas"></div>' ].join('') @@ -512,7 +512,7 @@ describe('Offcanvas', () => { it('should focus on trigger element after closing offcanvas', done => { fixtureEl.innerHTML = [ - '<button id="btn" data-bs-toggle="offcanvas" data-bs-target="#offcanvas" ></button>', + '<button id="btn" data-bs-toggle="offcanvas" data-bs-target="#offcanvas"></button>', '<div id="offcanvas" class="offcanvas"></div>' ].join('') @@ -536,7 +536,7 @@ describe('Offcanvas', () => { it('should not focus on trigger element after closing offcanvas, if it is not visible', done => { fixtureEl.innerHTML = [ - '<button id="btn" data-bs-toggle="offcanvas" data-bs-target="#offcanvas" ></button>', + '<button id="btn" data-bs-toggle="offcanvas" data-bs-target="#offcanvas"></button>', '<div id="offcanvas" class="offcanvas"></div>' ].join('') diff --git a/js/tests/unit/tab.spec.js b/js/tests/unit/tab.spec.js index 43d20438eb..bafa085526 100644 --- a/js/tests/unit/tab.spec.js +++ b/js/tests/unit/tab.spec.js @@ -114,7 +114,7 @@ describe('Tab', () => { fixtureEl.innerHTML = [ '<nav class="nav">', ' <button type="button" data-bs-target="#home" role="tab">Home</button>', - ' <button type="button" id="triggerProfile" data-bs-target="#profile" role="tab">Profile</a>', + ' <button type="button" id="triggerProfile" data-bs-target="#profile" role="tab">Profile</button>', '</nav>', '<div>', ' <div id="home" role="tabpanel"></div>', diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 57a3d68410..f92b74d963 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -1112,7 +1112,8 @@ describe('Tooltip', () => { it('should do nothing if the content is a child of the element', () => { fixtureEl.innerHTML = [ '<a href="#" rel="tooltip" title="Another tooltip">', - '<div id="childContent"></div>' + ' <div id="childContent"></div>', + '</a>' ].join('') const tooltipEl = fixtureEl.querySelector('a') @@ -1130,7 +1131,8 @@ describe('Tooltip', () => { it('should add the content as a child of the element for jQuery elements', () => { fixtureEl.innerHTML = [ '<a href="#" rel="tooltip" title="Another tooltip">', - '<div id="childContent"></div>' + ' <div id="childContent"></div>', + '</a>' ].join('') const tooltipEl = fixtureEl.querySelector('a') @@ -1147,7 +1149,8 @@ describe('Tooltip', () => { it('should add the child text content in the element', () => { fixtureEl.innerHTML = [ '<a href="#" rel="tooltip" title="Another tooltip">', - '<div id="childContent">Tooltip</div>' + ' <div id="childContent">Tooltip</div>', + '</a>' ].join('') const tooltipEl = fixtureEl.querySelector('a') @@ -1160,7 +1163,7 @@ describe('Tooltip', () => { }) it('should add html without sanitize it', () => { - fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>' const tooltipEl = fixtureEl.querySelector('a') const tooltip = new Tooltip(tooltipEl, { @@ -1174,7 +1177,7 @@ describe('Tooltip', () => { }) it('should add html sanitized', () => { - fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>' const tooltipEl = fixtureEl.querySelector('a') const tooltip = new Tooltip(tooltipEl, { @@ -1193,7 +1196,7 @@ describe('Tooltip', () => { }) it('should add text content', () => { - fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>' const tooltipEl = fixtureEl.querySelector('a') const tooltip = new Tooltip(tooltipEl) @@ -1206,7 +1209,7 @@ describe('Tooltip', () => { describe('_getTitle', () => { it('should return the title', () => { - fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip">' + fixtureEl.innerHTML = '<a href="#" rel="tooltip" title="Another tooltip"></a>' const tooltipEl = fixtureEl.querySelector('a') const tooltip = new Tooltip(tooltipEl) |