diff options
author | fat <jacobthornton@gmail.com> | 2012-12-22 05:19:36 +0400 |
---|---|---|
committer | fat <jacobthornton@gmail.com> | 2012-12-22 05:19:36 +0400 |
commit | d5345f806c7e8cd25494967bd371aef7a3fc4a63 (patch) | |
tree | fdb84904a8e322ed706fbca987b6b0b0bad0721d /js | |
parent | 9f29785783e58a7ffc6f8779c2ae55edebd54ba2 (diff) | |
parent | 0dece7a71f4f3591c7d1fecb9dea7cba82c9624a (diff) |
Merge branch 'master' of git://github.com/marcelkorpel/bootstrap into marcelkorpel-master
Diffstat (limited to 'js')
-rw-r--r-- | js/bootstrap-typeahead.js | 1 | ||||
-rw-r--r-- | js/tests/unit/bootstrap-typeahead.js | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js index 088e7ce9b9..94319c6a05 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -265,6 +265,7 @@ e.stopPropagation() e.preventDefault() this.select() + this.$element.focus() } , mouseenter: function (e) { diff --git a/js/tests/unit/bootstrap-typeahead.js b/js/tests/unit/bootstrap-typeahead.js index 4bdbce9709..0aa2d61b17 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() |