diff options
author | Johann <johann.servoire@gmail.com> | 2016-12-02 20:52:19 +0300 |
---|---|---|
committer | Mark Otto <markd.otto@gmail.com> | 2016-12-02 20:52:19 +0300 |
commit | 297c47c3fdbb58e3d9824afdee83ef3c4b9d141a (patch) | |
tree | ca90559ff2025eca6400b6b88b3d609d91f9653f /js/tests/visual/carousel.html | |
parent | 1fb6d8c46a560e2e35295440721ba2929f9721b6 (diff) |
[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
Diffstat (limited to 'js/tests/visual/carousel.html')
-rw-r--r-- | js/tests/visual/carousel.html | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/js/tests/visual/carousel.html b/js/tests/visual/carousel.html index 2017f338b2..b26fb4a0d4 100644 --- a/js/tests/visual/carousel.html +++ b/js/tests/visual/carousel.html @@ -46,11 +46,31 @@ <script src="../../dist/carousel.js"></script> <script> - $(function() { + // Should throw an error because carousel is in transition + function testCarouselTransitionError() { + var err = false + var $carousel = $('#carousel-example-generic') + $carousel.on('slid.bs.carousel', function () { + $carousel.off('slid.bs.carousel') + if (!err) { + alert('No error thrown for : testCarouselTransitionError') + } + }) + try { + $carousel.carousel('next').carousel('prev') + } + catch (e) { + err = true + console.error(e.message) + } + } + + $(function () { // Test to show that the carousel doesn't slide when the current tab isn't visible - $('#carousel-example-generic').on('slid.bs.carousel', function(event) { + $('#carousel-example-generic').on('slid.bs.carousel', function (event) { console.log('slid at ', event.timeStamp) }) + testCarouselTransitionError() }) </script> </body> |