Skip to content

Commit

Permalink
Fix visual tests (#35585)
Browse files Browse the repository at this point in the history
* Fix visual tests

They broke in #34509

* load bundle.js in visual tests

Co-authored-by: GeoSot <[email protected]>
  • Loading branch information
XhmikosR and GeoSot authored Jan 30, 2022
1 parent f77a58b commit 89f8876
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 86 deletions.
6 changes: 1 addition & 5 deletions js/tests/visual/alert.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ <h1>Alert <small>Bootstrap Visual Test</small></h1>
</div>
</div>

<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/alert.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
</body>
</html>
6 changes: 1 addition & 5 deletions js/tests/visual/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ <h1>Button <small>Bootstrap Visual Test</small></h1>
</div>
</div>

<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/button.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
</body>
</html>
7 changes: 1 addition & 6 deletions js/tests/visual/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ <h1>Carousel <small>Bootstrap Visual Test</small></h1>
</div>
</div>

<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/carousel.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
<script>
var t0
var t1
Expand Down
7 changes: 1 addition & 6 deletions js/tests/visual/collapse.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ <h5 class="mb-0">
</div>
</div>

<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/collapse.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
</body>
</html>
9 changes: 1 addition & 8 deletions js/tests/visual/dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,6 @@ <h1>Dropdown <small>Bootstrap Visual Test</small></h1>
</div>
</div>

<script src="../../../node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/dropdown.js"></script>
<script src="../../dist/collapse.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
</body>
</html>
17 changes: 4 additions & 13 deletions js/tests/visual/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,7 @@ <h4 class="modal-title" id="slowModalLabel">Lorem slowly</h4>
</button>
</div>

<script src="../../../node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/modal.js"></script>
<script src="../../dist/collapse.js"></script>
<script src="../../dist/tooltip.js"></script>
<script src="../../dist/popover.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
<script>
var ffBugTestResult = document.getElementById('ff-bug-test-result')
var firefoxTestDone = false
Expand All @@ -222,11 +213,11 @@ <h4 class="modal-title" id="slowModalLabel">Lorem slowly</h4>

var popoverElements = document.querySelectorAll('[data-bs-toggle="popover"]')
for (const popoverEl of popoverElements) {
new Popover(popoverEl)
new bootstrap.Popover(popoverEl)
}
var tooltipElements = document.querySelectorAll('[data-bs-toggle="tooltip"]')
for (const tooltipEl of tooltipElements) {
new Tooltip(tooltipEl)
new bootstrap.Tooltip(tooltipEl)
}

var tallToggle = document.getElementById('tall-toggle')
Expand All @@ -249,7 +240,7 @@ <h4 class="modal-title" id="slowModalLabel">Lorem slowly</h4>
ffBugInput.addEventListener('focus', handlerClickFfBugInput)

var btnPreventModal = document.getElementById('btnPreventModal')
var modalFf = new Modal(firefoxModal)
var modalFf = new bootstrap.Modal(firefoxModal)

btnPreventModal.addEventListener('click', function () {
function shownFirefoxModal() {
Expand Down
11 changes: 2 additions & 9 deletions js/tests/visual/popover.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,11 @@ <h1>Popover <small>Bootstrap Visual Test</small></h1>
</button>
</div>

<script src="../../../node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/tooltip.js"></script>
<script src="../../dist/popover.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
<script>
var popoverElements = document.querySelectorAll('[data-bs-toggle="popover"]')
for (const popoverEl of popoverElements) {
new Popover(popoverEl)
new bootstrap.Popover(popoverEl)
}
</script>
</body>
Expand Down
9 changes: 1 addition & 8 deletions js/tests/visual/scrollspy.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ <h2 id="final">Final section</h2>
<p>Ad leggings keytar, brunch id art party dolor labore.</p>
</div>

<script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/scrollspy.js"></script>
<script src="../../dist/dropdown.js"></script>
<script src="../../dist/collapse.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
</body>
</html>
7 changes: 1 addition & 6 deletions js/tests/visual/tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ <h4>Tabs with list-group (with fade)</h4>
</div>
</div>

<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/tab.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
</body>
</html>
12 changes: 4 additions & 8 deletions js/tests/visual/toast.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,26 @@ <h1>Toast <small>Bootstrap Visual Test</small></h1>
</div>
</div>

<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/toast.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
<script>
window.addEventListener('load', function () {
var toastElements = document.querySelectorAll('.toast')
for (const toastEl of toastElements) {
new Toast(toastEl)
new bootstrap.Toast(toastEl)
}

document.getElementById('btnShowToast').addEventListener('click', function () {
var toastElements = document.querySelectorAll('.toast')
for (const toastEl of toastElements) {
var toast = Toast.getInstance(toastEl)
var toast = bootstrap.Toast.getInstance(toastEl)
toast.show()
}
})

document.getElementById('btnHideToast').addEventListener('click', function () {
var toastElements = document.querySelectorAll('.toast')
for (const toastEl of toastElements) {
var toast = Toast.getInstance(toastEl)
var toast = bootstrap.Toast.getInstance(toastEl)
toast.hide()
}
})
Expand Down
18 changes: 6 additions & 12 deletions js/tests/visual/tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ <h1>Tooltip <small>Bootstrap Visual Test</small></h1>
<div id="customContainer"></div>
</div>

<script src="../../../node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/base-component.js"></script>
<script src="../../dist/tooltip.js"></script>
<script src="../../../dist/js/bootstrap.bundle.js"></script>
<script>
if (typeof document.body.attachShadow === 'function') {
var shadowRoot = document.getElementById('shadow').attachShadow({ mode: 'open' })
Expand All @@ -86,24 +80,24 @@ <h1>Tooltip <small>Bootstrap Visual Test</small></h1>
' Tooltip on top in a shadow dom' +
'</button>'

var firstChildTooltip = new Tooltip(shadowRoot.firstChild)
var secondChildTooltip = new Tooltip(shadowRoot.getElementById('secondTooltip'), {
var firstChildTooltip = new bootstrap.Tooltip(shadowRoot.firstChild)
var secondChildTooltip = new bootstrap.Tooltip(shadowRoot.getElementById('secondTooltip'), {
container: shadowRoot
})
}

var tooltipElements = document.querySelectorAll('[data-bs-toggle="tooltip"]')
for (const tooltipEl of tooltipElements) {
new Tooltip(tooltipEl)
new bootstrap.Tooltip(tooltipEl)
}

var tooltipElement = document.getElementById('tooltipElement')
var tooltipElementInstance = new Tooltip(tooltipElement, {
var tooltipElementInstance = new bootstrap.Tooltip(tooltipElement, {
container: document.getElementById('customContainer')
})

var target = document.getElementById('target')
var targetTooltip = new Tooltip(target, {
var targetTooltip = new bootstrap.Tooltip(target, {
placement : 'top',
trigger : 'manual'
})
Expand Down

0 comments on commit 89f8876

Please sign in to comment.