diff -r 6093dda9fe38 -r a9d04f5f5650 bootstrap-source/bootstrap-3.0.3/js/tests/unit/carousel.js --- a/bootstrap-source/bootstrap-3.0.3/js/tests/unit/carousel.js Sat Jan 18 12:34:36 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -$(function () { - - module("carousel") - - test("should provide no conflict", function () { - var carousel = $.fn.carousel.noConflict() - ok(!$.fn.carousel, 'carousel was set back to undefined (org value)') - $.fn.carousel = 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() - $('
') - .on('slide.bs.carousel', function (e) { - e.preventDefault(); - ok(true); - start(); - }) - .on('slid.bs.carousel', function () { - ok(false); - }) - .carousel('next') - }) - - test("should fire slide event with direction", function () { - var template = ' ' - $.support.transition = false - stop() - $(template).on('slide.bs.carousel', function (e) { - e.preventDefault() - ok(e.direction) - ok(e.direction === 'right' || e.direction === 'left') - start() - }).carousel('next') - }) - - test("should fire slide event with relatedTarget", function () { - var template = ' ' - $.support.transition = false - stop() - $(template) - .on('slide.bs.carousel', function (e) { - e.preventDefault(); - ok(e.relatedTarget); - ok($(e.relatedTarget).hasClass('item')); - start(); - }) - .carousel('next') - }) - - test("should set interval from data attribute", 4, function () { - var template = $(' '); - template.attr("data-interval", 1814); - - template.appendTo("body"); - $('[data-slide]').first().click(); - ok($('#myCarousel').data('bs.carousel').options.interval == 1814); - $('#myCarousel').remove(); - - template.appendTo("body").attr("data-modal", "foobar"); - $('[data-slide]').first().click(); - ok($('#myCarousel').data('bs.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('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(); - }) -})