aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfat <[email protected]>2012-12-21 17:19:36 -0800
committerfat <[email protected]>2012-12-21 17:19:36 -0800
commitd5345f806c7e8cd25494967bd371aef7a3fc4a63 (patch)
treefdb84904a8e322ed706fbca987b6b0b0bad0721d
parent9f29785783e58a7ffc6f8779c2ae55edebd54ba2 (diff)
parent0dece7a71f4f3591c7d1fecb9dea7cba82c9624a (diff)
downloadbootstrap-d5345f806c7e8cd25494967bd371aef7a3fc4a63.tar.xz
bootstrap-d5345f806c7e8cd25494967bd371aef7a3fc4a63.zip
Merge branch 'master' of git://github.com/marcelkorpel/bootstrap into marcelkorpel-master
-rw-r--r--js/bootstrap-typeahead.js1
-rw-r--r--js/tests/unit/bootstrap-typeahead.js5
2 files changed, 6 insertions, 0 deletions
diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js
index 088e7ce9b..94319c6a0 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 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()