1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-29 16:19:53 +02:00

fix(visual-test): remove jquery in them

This commit is contained in:
Johann-S
2018-06-17 23:09:04 +02:00
committed by XhmikosR
parent 0b726de94e
commit 5dcca44fcf
11 changed files with 103 additions and 57 deletions

View File

@@ -51,7 +51,7 @@
</div> </div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script> <script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/dom/selectorEngine.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>

View File

@@ -44,7 +44,7 @@
</div> </div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script> <script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/manipulator.js"></script> <script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/dom/selectorEngine.js"></script>

View File

@@ -45,24 +45,25 @@
</div> </div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script> <script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/dom/selectorEngine.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>
<script src="../../dist/util.js"></script> <script src="../../dist/util.js"></script>
<script src="../../dist/carousel.js"></script> <script src="../../dist/carousel.js"></script>
<script> <script>
$(function() { document.addEventListener('DOMContentLoaded', function () {
var t0, t1; var t0, t1;
var carousel = SelectorEngine.find('#carousel-example-generic') var 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
EventHandler.on(carousel, 'slid.bs.carousel', function (event) { carousel.addEventListener('slid.bs.carousel', function (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)
}) })
EventHandler.on(carousel, 'slide.bs.carousel', function () { carousel.addEventListener('slide.bs.carousel', function () {
t0 = performance.now() t0 = performance.now()
}) })
}) })

View File

@@ -71,7 +71,8 @@
</div> </div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script> <script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/dom/selectorEngine.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>

View File

@@ -209,7 +209,6 @@
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script> <script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script> <script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>

View File

@@ -205,8 +205,8 @@
</button> </button>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script> <script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/manipulator.js"></script> <script src="../../dist/dom/manipulator.js"></script>
@@ -218,53 +218,85 @@
<script src="../../dist/popover.js"></script> <script src="../../dist/popover.js"></script>
<script> <script>
var firefoxTestDone = false var firefoxTestDone = false
function reportFirefoxTestResult(result) { document.addEventListener('DOMContentLoaded', function () {
if (!firefoxTestDone) { var ffBugTestResult = document.getElementById('ff-bug-test-result')
$('#ff-bug-test-result')
.addClass(result ? 'text-success' : 'text-danger') function reportFirefoxTestResult(result) {
.text(result ? 'PASS' : 'FAIL') if (!firefoxTestDone) {
ffBugTestResult.classList
.add(result ? 'text-success' : 'text-danger')
ffBugTestResult.innerHTML = result ? 'PASS' : 'FAIL'
}
} }
}
$(function () { document.querySelectorAll('[data-toggle="popover"]')
$('[data-toggle="popover"]').popover() .forEach(function (popover) {
$('[data-toggle="tooltip"]').tooltip() new Popover(popover)
$('#tall-toggle').click(function () {
$('#tall').toggle()
})
$('#ff-bug-input').one('focus', function () {
$('#firefoxModal').on('focus', reportFirefoxTestResult.bind(false))
$('#ff-bug-input').on('focus', reportFirefoxTestResult.bind(true))
})
$('#btnPreventModal').on('click', function () {
$('#firefoxModal').one('shown.bs.modal', function () {
$(this).modal('hide')
}) })
.one('hide.bs.modal', function (event) {
document.querySelectorAll('[data-toggle="tooltip"]')
.forEach(function (tooltip) {
new Tooltip(tooltip)
})
var tallToggle = document.getElementById('tall-toggle')
var tall = document.getElementById('tall')
tallToggle.addEventListener('click', function () {
if (tall.style.display === 'none') {
tall.style.display = 'block'
} else {
tall.style.display = 'none'
}
})
var ffBugInput = document.getElementById('ff-bug-input')
var firefoxModal = document.getElementById('firefoxModal')
function handlerClickFfBugInput() {
firefoxModal.addEventListener('focus', reportFirefoxTestResult.bind(false))
ffBugInput.addEventListener('focus', reportFirefoxTestResult.bind(true))
ffBugInput.removeEventListener('focus', handlerClickFfBugInput)
}
ffBugInput.addEventListener('focus', handlerClickFfBugInput)
var btnPreventModal = document.getElementById('btnPreventModal')
var modalFf = new Modal(firefoxModal)
btnPreventModal.addEventListener('click', function () {
function shownFirefoxModal() {
modalFf.hide()
firefoxModal.removeEventListener('shown.bs.modal', hideFirefoxModal)
}
function hideFirefoxModal(event) {
event.preventDefault() event.preventDefault()
if ($(this).data('bs.modal')._isTransitioning) { firefoxModal.removeEventListener('hide.bs.modal', hideFirefoxModal)
if (modalFf._isTransitioning) {
console.error('Modal plugin should not set _isTransitioning when hide event is prevented') console.error('Modal plugin should not set _isTransitioning when hide event is prevented')
} else { } else {
console.log('Test passed') console.log('Test passed')
$(this).modal('hide') // work as expected modalFf.hide() // work as expected
} }
}) }
.modal('show')
firefoxModal.addEventListener('shown.bs.modal', shownFirefoxModal)
firefoxModal.addEventListener('hide.bs.modal', hideFirefoxModal)
modalFf.show()
}) })
// Test transition duration // Test transition duration
var t0, t1; var t0, t1;
var slowModal = document.getElementById('slowModal')
$('#slowModal').on('shown.bs.modal', function(){ slowModal.addEventListener('shown.bs.modal', function () {
t1 = performance.now() t1 = performance.now()
console.log('transition-duration took ' + (t1 - t0) + 'ms.') console.log('transition-duration took ' + (t1 - t0) + 'ms.')
}).on('show.bs.modal', function(){
t0 = performance.now()
}) })
slowModal.addEventListener('show.bs.modal', function () {
t0 = performance.now()
})
}) })
</script> </script>
</body> </body>

View File

@@ -31,8 +31,9 @@
</button> </button>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script> <script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/dom/selectorEngine.js"></script>
@@ -40,8 +41,11 @@
<script src="../../dist/tooltip.js"></script> <script src="../../dist/tooltip.js"></script>
<script src="../../dist/popover.js"></script> <script src="../../dist/popover.js"></script>
<script> <script>
$(function () { document.addEventListener('DOMContentLoaded', function () {
$('[data-toggle="popover"]').popover() document.querySelectorAll('[data-toggle="popover"]')
.forEach(function (popover) {
new Popover(popover)
})
}) })
</script> </script>
</body> </body>

View File

@@ -86,8 +86,8 @@
<p>Ad leggings keytar, brunch id art party dolor labore.</p> <p>Ad leggings keytar, brunch id art party dolor labore.</p>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../../site/docs/4.2/assets/js/vendor/popper.min.js"></script> <script src="../../../site/docs/4.2/assets/js/vendor/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/manipulator.js"></script> <script src="../../dist/dom/manipulator.js"></script>

View File

@@ -225,8 +225,8 @@
</div> </div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script> <script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/manipulator.js"></script> <script src="../../dist/dom/manipulator.js"></script>

View File

@@ -52,7 +52,6 @@
</div> </div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../dist/util.js"></script> <script src="../../dist/util.js"></script>
<script src="../../dist/toast.js"></script> <script src="../../dist/toast.js"></script>
<script> <script>

View File

@@ -71,17 +71,18 @@
<div id="customContainer"></div> <div id="customContainer"></div>
</div> </div>
<script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script> <script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/eventHandler.js"></script> <script src="../../dist/dom/eventHandler.js"></script>
<script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/dom/selectorEngine.js"></script>
<script src="../../dist/util.js"></script> <script src="../../dist/util.js"></script>
<script src="../../dist/tooltip.js"></script> <script src="../../dist/tooltip.js"></script>
<script> <script>
$(function () { document.addEventListener('DOMContentLoaded', function () {
if (typeof document.body.attachShadow === 'function') { if (typeof document.body.attachShadow === 'function') {
var shadowRoot = $('#shadow')[0].attachShadow({ mode: 'open' }) var shadowRoot = document.getElementById('shadow').attachShadow({ mode: 'open' })
shadowRoot.innerHTML = shadowRoot.innerHTML =
'<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top in a shadow dom">' + '<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top in a shadow dom">' +
' Tooltip on top in a shadow dom' + ' Tooltip on top in a shadow dom' +
@@ -90,19 +91,28 @@
' Tooltip on top in a shadow dom' + ' Tooltip on top in a shadow dom' +
'</button>' '</button>'
$(shadowRoot.firstChild).tooltip() var firstChildTooltip = new Tooltip(shadowRoot.firstChild)
$(shadowRoot.getElementById('secondTooltip')).tooltip({ var secondChildTooltip = new Tooltip(shadowRoot.getElementById('secondTooltip'), {
container: shadowRoot container: shadowRoot
}) })
} }
$('[data-toggle="tooltip"]').tooltip()
$('#tooltipElement').tooltip({ document.querySelectorAll('[data-toggle="tooltip"]')
container: $('#customContainer')[0] .forEach(function (tooltip) {
new Tooltip(tooltip)
})
var tooltipElement = document.getElementById('tooltipElement')
var tooltipElementInstance = new Tooltip(tooltipElement, {
container: document.getElementById('customContainer')
}) })
$('#target').tooltip({
var target = document.getElementById('target')
var targetTooltip = new Tooltip(target, {
placement : 'top', placement : 'top',
trigger : 'manual' trigger : 'manual'
}).tooltip('show') })
targetTooltip.show()
}) })
</script> </script>
</body> </body>