diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js
index 894f78ab51..cef4615761 100644
--- a/js/tests/unit/carousel.js
+++ b/js/tests/unit/carousel.js
@@ -842,4 +842,41 @@ $(function () {
})
$textArea.trigger(eventKeyDown)
})
+
+ QUnit.test('Should not go to the next item when the carousel is not visible', function (assert) {
+ assert.expect(2)
+ var done = assert.async()
+ var html = '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + '
‹'
+ + '
›'
+ + '
'
+ var $html = $(html)
+ $html
+ .appendTo('#qunit-fixture')
+ .bootstrapCarousel()
+
+ var $firstItem = $('#firstItem')
+ setTimeout(function () {
+ assert.ok($firstItem.hasClass('active'))
+ $html
+ .bootstrapCarousel('dispose')
+ .attr('style', 'visibility: hidden;')
+ .bootstrapCarousel()
+
+ setTimeout(function () {
+ assert.ok($firstItem.hasClass('active'))
+ done()
+ }, 80)
+ }, 80)
+ })
})