1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 23:04:32 +02:00

[V4] Throw error when a plugin is in transition (#17823)

* Throw error when a plugin is in transition
* Add unit tests about plugins in transition
This commit is contained in:
Johann
2016-12-02 18:52:19 +01:00
committed by Mark Otto
parent 1fb6d8c46a
commit 297c47c3fd
8 changed files with 144 additions and 23 deletions

View File

@@ -61,5 +61,30 @@
<script src="../vendor/jquery.min.js"></script>
<script src="../../dist/util.js"></script>
<script src="../../dist/collapse.js"></script>
<script>
// JavaScript Test
$(function () {
testCollapseTransitionError()
});
// Should throw an error because carousel is in transition
function testCollapseTransitionError() {
var err = false
$('#collapseOne').on('hidden.bs.collapse', function (e) {
$(this).off('hidden.bs.collapse')
if (!err) {
alert('No error thrown for : testCollapseTransitionError')
}
})
try {
$('#collapseOne').collapse('hide').collapse('show')
}
catch (e) {
err = true
console.error(e.message)
}
}
</script>
</body>
</html>