diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index 065354451f..a4008bb0c7 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -66,6 +66,18 @@ $(function () { }).carousel('next') }) + test('should fire slid event with direction', function () { + var template = '' + $.support.transition = false + stop() + $(template).on('slid.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 @@ -80,6 +92,20 @@ $(function () { .carousel('next') }) + test('should fire slid event with relatedTarget', function () { + var template = '' + $.support.transition = false + stop() + $(template) + .on('slid.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)