mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 17:14:04 +02:00
carousel should not cycle when there is no data-ride on init (#27968)
This commit is contained in:
@@ -1270,4 +1270,51 @@ $(function () {
|
||||
assert.strictEqual(spy.called, true)
|
||||
sandbox.restore()
|
||||
})
|
||||
|
||||
QUnit.test('should not cycle when there is no attribute data-ride', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var spy = sinon.spy(Carousel.prototype, 'cycle')
|
||||
|
||||
var carouselHTML = '<div class="carousel"></div>'
|
||||
var $carousel = $(carouselHTML)
|
||||
$carousel.appendTo('#qunit-fixture')
|
||||
$carousel.bootstrapCarousel()
|
||||
|
||||
assert.strictEqual(spy.called, false)
|
||||
spy.restore()
|
||||
})
|
||||
|
||||
QUnit.test('should cycle when there is data-ride attribute', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var spy = sinon.spy(Carousel.prototype, 'cycle')
|
||||
|
||||
var carouselHTML = '<div class="carousel" data-ride="carousel"></div>'
|
||||
var $carousel = $(carouselHTML)
|
||||
$carousel.appendTo('#qunit-fixture')
|
||||
$carousel.bootstrapCarousel()
|
||||
|
||||
assert.strictEqual(spy.called, true)
|
||||
spy.restore()
|
||||
})
|
||||
|
||||
QUnit.test('should init carousels with data-ride on load event', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
var done = assert.async()
|
||||
var spy = sinon.spy(Carousel, '_jQueryInterface')
|
||||
|
||||
var carouselHTML = '<div class="carousel" data-ride="carousel"></div>'
|
||||
var $carousel = $(carouselHTML)
|
||||
$carousel.appendTo('#qunit-fixture')
|
||||
|
||||
$(window).trigger($.Event('load'))
|
||||
|
||||
setTimeout(function () {
|
||||
assert.strictEqual(spy.called, true)
|
||||
spy.restore()
|
||||
done()
|
||||
}, 5)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user