mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
add additional carousel test
This commit is contained in:
parent
68e87183a0
commit
faa00629c4
3 changed files with 9 additions and 3 deletions
2
dist/js/bootstrap.js
vendored
2
dist/js/bootstrap.js
vendored
|
@ -422,7 +422,7 @@
|
|||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.carousel')
|
||||
var options = $.extend({}, Carousel.DEFAULTS, typeof option == 'object' && option)
|
||||
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
var action = typeof option == 'string' ? option : options.slide
|
||||
|
||||
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
|
||||
|
|
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -57,7 +57,7 @@ $(function () {
|
|||
.carousel('next')
|
||||
})
|
||||
|
||||
test("should set interval from data attribute", 3,function () {
|
||||
test("should set interval from data attribute", 4, function () {
|
||||
var template = $('<div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</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="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</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="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</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>');
|
||||
template.attr("data-interval", 1814);
|
||||
|
||||
|
@ -77,5 +77,11 @@ $(function () {
|
|||
$('[data-slide]').first().click();
|
||||
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "attributes should be read only on intitialization");
|
||||
$('#myCarousel').remove();
|
||||
|
||||
template.attr("data-interval", false);
|
||||
template.appendTo("body");
|
||||
$('#myCarousel').carousel(1);
|
||||
ok($('#myCarousel').data('bs.carousel').options.interval === false, "data attribute has higher priority than default options");
|
||||
$('#myCarousel').remove();
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue