diff options
author | Christopher Morrissey <morrissey@ingenious.org> | 2018-09-18 15:55:48 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-09-18 15:55:48 +0300 |
commit | ea0faadde5c222cdd8127332b62a6d565a055d80 (patch) | |
tree | 6292c56e10eb63ae2a8b42491aee6aedbd879504 /js/tests | |
parent | e6049586413f663ae99ec660d6378306833e2223 (diff) |
feature(carousel): carousel-item interval (#26667)
adds the ability to assign data-interval to an individual carousel-item
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/unit/carousel.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index baabcf426f..20b12f4b06 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -445,6 +445,54 @@ $(function () { $carousel.remove() }) + QUnit.test('should set interval from data attribute on individual carousel-item', function (assert) { + assert.expect(2) + var templateHTML = '<div id="myCarousel" class="carousel slide" data-interval="1814">' + + '<div class="carousel-inner">' + + '<div class="carousel-item active" data-interval="2814">' + + '<img alt="">' + + '<div class="carousel-caption">' + + '<h4>First Thumbnail label</h4>' + + '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' + + 'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' + + 'ultricies vehicula ut id elit.</p>' + + '</div>' + + '</div>' + + '<div class="carousel-item" data-interval="3814">' + + '<img alt="">' + + '<div class="carousel-caption">' + + '<h4>Second Thumbnail label</h4>' + + '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' + + 'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' + + 'ultricies vehicula ut id elit.</p>' + + '</div>' + + '</div>' + + '<div class="carousel-item">' + + '<img alt="">' + + '<div class="carousel-caption">' + + '<h4>Third Thumbnail label</h4>' + + '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' + + 'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' + + 'ultricies vehicula ut id elit.</p>' + + '</div>' + + '</div>' + + '</div>' + + '<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>' + + '<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>' + + '</div>' + var $carousel = $(templateHTML) + + $carousel.appendTo('body') + $carousel.bootstrapCarousel(1) + assert.strictEqual($carousel.data('bs.carousel')._config.interval, 3814) + $carousel.remove() + + $carousel.appendTo('body') + $carousel.bootstrapCarousel(2) + assert.strictEqual($carousel.data('bs.carousel')._config.interval, 1814, 'reverts to default interval if no data-interval is set') + $carousel.remove() + }) + QUnit.test('should skip over non-items when using item indices', function (assert) { assert.expect(2) var templateHTML = '<div id="myCarousel" class="carousel" data-interval="1814">' + |