diff options
| author | Mark Otto <[email protected]> | 2012-12-21 18:59:14 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2012-12-21 18:59:14 -0800 |
| commit | d23006a6bd76959db3c1ef2de6451e8905e77046 (patch) | |
| tree | 3852800fb7608efd4a103d6fa83658e71e5a2368 /js | |
| parent | ccafc8a01023d66768b34b2597e50d6f7df4ca58 (diff) | |
| parent | 818c56f078ff3b14fefceca77608d1e95f33a783 (diff) | |
| download | bootstrap-d23006a6bd76959db3c1ef2de6451e8905e77046.tar.xz bootstrap-d23006a6bd76959db3c1ef2de6451e8905e77046.zip | |
Merge branch '2.3.0-wip' of github.com:twitter/bootstrap into 2.3.0-wip
Diffstat (limited to 'js')
| -rw-r--r-- | js/bootstrap-carousel.js | 1 | ||||
| -rw-r--r-- | js/bootstrap-typeahead.js | 1 | ||||
| -rw-r--r-- | js/tests/unit/bootstrap-carousel.js | 12 | ||||
| -rw-r--r-- | js/tests/unit/bootstrap-typeahead.js | 5 |
4 files changed, 19 insertions, 0 deletions
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index 4838a1684..dbea83711 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/bootstrap-typeahead.js b/js/bootstrap-typeahead.js index 8d31954b1..cf9320df4 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -271,6 +271,7 @@ e.stopPropagation() e.preventDefault() this.select() + this.$element.focus() } , mouseenter: function (e) { diff --git a/js/tests/unit/bootstrap-carousel.js b/js/tests/unit/bootstrap-carousel.js index 13b8f721f..80b6e139b 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 = '<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">‹</a><a class="right carousel-control" href="#myCarousel" data-slide="next">›</a></div>' + $.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 = '<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">‹</a><a class="right carousel-control" href="#myCarousel" data-slide="next">›</a></div>' $.support.transition = false diff --git a/js/tests/unit/bootstrap-typeahead.js b/js/tests/unit/bootstrap-typeahead.js index 4bdbce970..0aa2d61b1 100644 --- a/js/tests/unit/bootstrap-typeahead.js +++ b/js/tests/unit/bootstrap-typeahead.js @@ -192,17 +192,22 @@ $(function () { }).appendTo('body') , typeahead = $input.data('typeahead') , changed = false + , focus = false + , blur = false $input.val('a') typeahead.lookup() $input.change(function() { changed = true }); + $input.focus(function() { focus = true; blur = false }); + $input.blur(function() { blur = true; focus = false }); $(typeahead.$menu.find('li')[2]).mouseover().click() equals($input.val(), 'ac', 'input value was correctly set') ok(!typeahead.$menu.is(':visible'), 'the menu was hidden') ok(changed, 'a change event was fired') + ok(focus && !blur, 'focus is still set') $input.remove() typeahead.$menu.remove() |
