$(function () { module("bootstrap-carousel") test("should be defined on jquery object", function () { ok($(document.body).carousel, 'carousel method is defined') }) test("should return element", function () { ok($(document.body).carousel()[0] == document.body, 'document.body returned') }) test("should not fire sliden when slide is prevented", function () { $.support.transition = false stop() $('
') .bind('slide', function (e) { e.preventDefault(); ok(true); start(); }) .bind('slid', function () { ok(false); }) .carousel('next') }) test("should fire slide event with relatedTarget", function () { var template = ' ' $.support.transition = false stop() $(template) .on('slide', function (e) { e.preventDefault(); ok(e.relatedTarget); ok($(e.relatedTarget).hasClass('item')); start(); }) .carousel('next') }) test("should set interval from data attribute", function () { var template = $(' '); 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(); }) })