]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fixed copy/paste caused typo
authordmitriybudnik <dmitriy.budnik@gmail.com>
Mon, 15 Oct 2012 18:55:32 +0000 (21:55 +0300)
committerdmitriybudnik <dmitriy.budnik@gmail.com>
Mon, 15 Oct 2012 19:35:32 +0000 (22:35 +0300)
js/bootstrap-carousel.js
js/tests/unit/bootstrap-carousel.js

index 0d7167e1c23f7d3001f3940945a81b847077b536..0852cf3f43801937f4de8f8fe01564336d1c469b 100644 (file)
     $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
       var $this = $(this), href
         , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
-        , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
+        , options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
       $target.carousel(options)
       e.preventDefault()
     })
index 5ac9fb2d81b29211f9c92b284b8f4fef34f2477e..fbcbb5b17e3d553987f0e8ad2be1afa76606279a 100644 (file)
@@ -37,6 +37,26 @@ $(function () {
             start();
           })
           .carousel('next')
-      })
 
+      test("should set interval from data attribute", 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">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>');
+        template.attr("data-interval", 1814);
+        
+        template.appendTo("body");
+        $('[data-slide]').first().click();
+        ok($('#myCarousel').data('carousel').options.interval == 1814);
+        $('#myCarousel').remove();
+
+        template.appendTo("body").attr("data-modal", "foobar");
+        $('[data-slide]').first().click();
+        ok($('#myCarousel').data('carousel').options.interval == 1814, "even if there is an data-modal attribute set");
+        $('#myCarousel').remove();
+        
+        template.appendTo("body");
+        $('[data-slide]').first().click();
+        $('#myCarousel').attr('data-interval', 1860);
+        $('[data-slide]').first().click();
+        ok($('#myCarousel').data('carousel').options.interval == 1814, "attributes should be read only on intitialization");
+        $('#myCarousel').remove();
+      })
 })
\ No newline at end of file