Skip to content

Commit

Permalink
add another test for #9461: carousel next/prev should ignore non-items
Browse files Browse the repository at this point in the history
  • Loading branch information
cvrebert committed Jul 8, 2014
1 parent 4f5efb8 commit ba8a688
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion js/tests/unit/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ $(function () {
$carousel.remove()
})

test('should skip over non-items', function () {
test('should skip over non-items when using item indices', function () {
var templateHTML = '<div id="myCarousel" class="carousel" data-interval="1814">'
+ '<div class="carousel-inner">'
+ '<div class="item active">'
Expand All @@ -373,4 +373,29 @@ $(function () {

strictEqual($template.find('.item')[1], $template.find('.active')[0], 'second item active')
})

test('should skip over non-items when using next/prev methods', function () {
var templateHTML = '<div id="myCarousel" class="carousel" data-interval="1814">'
+ '<div class="carousel-inner">'
+ '<div class="item active">'
+ '<img alt="">'
+ '</div>'
+ '<script type="text/x-metamorph" id="thingy"/>'
+ '<div class="item">'
+ '<img alt="">'
+ '</div>'
+ '<div class="item">'
+ '</div>'
+ '</div>'
+ '</div>'
var $template = $(templateHTML)

$template.bootstrapCarousel()

strictEqual($template.find('.item')[0], $template.find('.active')[0], 'first item active')

$template.bootstrapCarousel('next')

strictEqual($template.find('.item')[1], $template.find('.active')[0], 'second item active')
})
})

0 comments on commit ba8a688

Please sign in to comment.