aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2014-07-07 19:05:48 -0700
committerChris Rebert <[email protected]>2014-07-31 11:36:24 -0700
commitcbba8e53df2cfea3273072d94408fd2981dce460 (patch)
tree9fe9c305122e2c980e666bddbf79979e18d25bf2 /js/tests/unit
parentfc1db2e74b16b355656512eafd39f667f383a8a9 (diff)
downloadbootstrap-cbba8e53df2cfea3273072d94408fd2981dce460.tar.xz
bootstrap-cbba8e53df2cfea3273072d94408fd2981dce460.zip
Fix #13818 by using more robust "find next carousel item" logic
Also adds another test for #9461: carousel next/prev should ignore non-items
Diffstat (limited to 'js/tests/unit')
-rw-r--r--js/tests/unit/carousel.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js
index 51872c57b..3f9e61a34 100644
--- a/js/tests/unit/carousel.js
+++ b/js/tests/unit/carousel.js
@@ -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">'
@@ -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')
+ })
})