diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index 4838a16847..dbea837116 100644 --- a/js/bootstrap-carousel.js +++ b/js/bootstrap-carousel.js @@ -108,6 +108,7 @@ e = $.Event('slide', { relatedTarget: $next[0] + , direction: direction }) if ($next.hasClass('active')) return diff --git a/js/tests/unit/bootstrap-carousel.js b/js/tests/unit/bootstrap-carousel.js index 13b8f721fc..80b6e139b6 100644 --- a/js/tests/unit/bootstrap-carousel.js +++ b/js/tests/unit/bootstrap-carousel.js @@ -31,6 +31,18 @@ $(function () { .carousel('next') }) + test("should fire slide event with direction", function () { + var template = '' + $.support.transition = false + stop() + $(template).on('slide', 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