mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 09:04:14 +02:00
Use es6 on visual tests (#36915)
This commit is contained in:
@@ -47,17 +47,17 @@
|
|||||||
|
|
||||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var t0
|
let t0
|
||||||
var t1
|
let t1
|
||||||
var carousel = document.getElementById('carousel-example-generic')
|
const carousel = document.getElementById('carousel-example-generic')
|
||||||
|
|
||||||
// Test to show that the carousel doesn't slide when the current tab isn't visible
|
// Test to show that the carousel doesn't slide when the current tab isn't visible
|
||||||
// Test to show that transition-duration can be changed with css
|
// Test to show that transition-duration can be changed with css
|
||||||
carousel.addEventListener('slid.bs.carousel', function (event) {
|
carousel.addEventListener('slid.bs.carousel', event => {
|
||||||
t1 = performance.now()
|
t1 = performance.now()
|
||||||
console.log('transition-duration took ' + (t1 - t0) + 'ms, slid at ' + event.timeStamp)
|
console.log('transition-duration took ' + (t1 - t0) + 'ms, slid at ' + event.timeStamp)
|
||||||
})
|
})
|
||||||
carousel.addEventListener('slide.bs.carousel', function () {
|
carousel.addEventListener('slide.bs.carousel', () => {
|
||||||
t0 = performance.now()
|
t0 = performance.now()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@@ -201,8 +201,8 @@
|
|||||||
|
|
||||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var ffBugTestResult = document.getElementById('ff-bug-test-result')
|
const ffBugTestResult = document.getElementById('ff-bug-test-result')
|
||||||
var firefoxTestDone = false
|
const firefoxTestDone = false
|
||||||
|
|
||||||
function reportFirefoxTestResult(result) {
|
function reportFirefoxTestResult(result) {
|
||||||
if (!firefoxTestDone) {
|
if (!firefoxTestDone) {
|
||||||
@@ -211,18 +211,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var popoverElements = document.querySelectorAll('[data-bs-toggle="popover"]')
|
document.querySelectorAll('[data-bs-toggle="popover"]').forEach(popoverEl => new bootstrap.Popover(popoverEl))
|
||||||
for (const popoverEl of popoverElements) {
|
|
||||||
new bootstrap.Popover(popoverEl)
|
|
||||||
}
|
|
||||||
var tooltipElements = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
|
||||||
for (const tooltipEl of tooltipElements) {
|
|
||||||
new bootstrap.Tooltip(tooltipEl)
|
|
||||||
}
|
|
||||||
|
|
||||||
var tallToggle = document.getElementById('tall-toggle')
|
document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(tooltipEl => new bootstrap.Tooltip(tooltipEl))
|
||||||
var tall = document.getElementById('tall')
|
|
||||||
tallToggle.addEventListener('click', function () {
|
const tall = document.getElementById('tall')
|
||||||
|
document.getElementById('tall-toggle').addEventListener('click', () => {
|
||||||
if (tall.style.display === 'none') {
|
if (tall.style.display === 'none') {
|
||||||
tall.style.display = 'block'
|
tall.style.display = 'block'
|
||||||
} else {
|
} else {
|
||||||
@@ -230,8 +224,8 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var ffBugInput = document.getElementById('ff-bug-input')
|
const ffBugInput = document.getElementById('ff-bug-input')
|
||||||
var firefoxModal = document.getElementById('firefoxModal')
|
const firefoxModal = document.getElementById('firefoxModal')
|
||||||
function handlerClickFfBugInput() {
|
function handlerClickFfBugInput() {
|
||||||
firefoxModal.addEventListener('focus', reportFirefoxTestResult.bind(false))
|
firefoxModal.addEventListener('focus', reportFirefoxTestResult.bind(false))
|
||||||
ffBugInput.addEventListener('focus', reportFirefoxTestResult.bind(true))
|
ffBugInput.addEventListener('focus', reportFirefoxTestResult.bind(true))
|
||||||
@@ -239,16 +233,15 @@
|
|||||||
}
|
}
|
||||||
ffBugInput.addEventListener('focus', handlerClickFfBugInput)
|
ffBugInput.addEventListener('focus', handlerClickFfBugInput)
|
||||||
|
|
||||||
var btnPreventModal = document.getElementById('btnPreventModal')
|
const modalFf = new bootstrap.Modal(firefoxModal)
|
||||||
var modalFf = new bootstrap.Modal(firefoxModal)
|
|
||||||
|
|
||||||
btnPreventModal.addEventListener('click', function () {
|
document.getElementById('btnPreventModal').addEventListener('click', () => {
|
||||||
function shownFirefoxModal() {
|
const shownFirefoxModal = () => {
|
||||||
modalFf.hide()
|
modalFf.hide()
|
||||||
firefoxModal.removeEventListener('shown.bs.modal', hideFirefoxModal)
|
firefoxModal.removeEventListener('shown.bs.modal', hideFirefoxModal)
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideFirefoxModal(event) {
|
const hideFirefoxModal = event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
firefoxModal.removeEventListener('hide.bs.modal', hideFirefoxModal)
|
firefoxModal.removeEventListener('hide.bs.modal', hideFirefoxModal)
|
||||||
|
|
||||||
@@ -266,16 +259,16 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Test transition duration
|
// Test transition duration
|
||||||
var t0
|
let t0
|
||||||
var t1
|
let t1
|
||||||
var slowModal = document.getElementById('slowModal')
|
const slowModal = document.getElementById('slowModal')
|
||||||
|
|
||||||
slowModal.addEventListener('shown.bs.modal', function () {
|
slowModal.addEventListener('shown.bs.modal', () => {
|
||||||
t1 = performance.now()
|
t1 = performance.now()
|
||||||
console.log('transition-duration took ' + (t1 - t0) + 'ms.')
|
console.log('transition-duration took ' + (t1 - t0) + 'ms.')
|
||||||
})
|
})
|
||||||
|
|
||||||
slowModal.addEventListener('show.bs.modal', function () {
|
slowModal.addEventListener('show.bs.modal', () => {
|
||||||
t0 = performance.now()
|
t0 = performance.now()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@@ -33,10 +33,7 @@
|
|||||||
|
|
||||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var popoverElements = document.querySelectorAll('[data-bs-toggle="popover"]')
|
document.querySelectorAll('[data-bs-toggle="popover"]').forEach(popoverEl => new bootstrap.Popover(popoverEl))
|
||||||
for (const popoverEl of popoverElements) {
|
|
||||||
new bootstrap.Popover(popoverEl)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -52,26 +52,15 @@
|
|||||||
|
|
||||||
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', () => {
|
||||||
var toastElements = document.querySelectorAll('.toast')
|
document.querySelectorAll('.toast').forEach(toastEl => new bootstrap.Toast(toastEl))
|
||||||
for (const toastEl of toastElements) {
|
|
||||||
new bootstrap.Toast(toastEl)
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('btnShowToast').addEventListener('click', function () {
|
document.getElementById('btnShowToast').addEventListener('click', () => {
|
||||||
var toastElements = document.querySelectorAll('.toast')
|
document.querySelectorAll('.toast').forEach(toastEl => bootstrap.Toast.getInstance(toastEl).show())
|
||||||
for (const toastEl of toastElements) {
|
|
||||||
var toast = bootstrap.Toast.getInstance(toastEl)
|
|
||||||
toast.show()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
document.getElementById('btnHideToast').addEventListener('click', function () {
|
document.getElementById('btnHideToast').addEventListener('click', () => {
|
||||||
var toastElements = document.querySelectorAll('.toast')
|
document.querySelectorAll('.toast').forEach(toastEl => bootstrap.Toast.getInstance(toastEl).hide())
|
||||||
for (const toastEl of toastElements) {
|
|
||||||
var toast = bootstrap.Toast.getInstance(toastEl)
|
|
||||||
toast.hide()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user