aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfat <[email protected]>2012-12-21 17:24:45 -0800
committerfat <[email protected]>2012-12-21 17:24:45 -0800
commit5da30ee5fb60ca29b7810368a13dd792b8337c7e (patch)
tree22bd40fd1f66b140963317e5a4063d4e3935ac9f
parentdc32555f5b3b574087916529d58d3afac059d196 (diff)
parentd5345f806c7e8cd25494967bd371aef7a3fc4a63 (diff)
downloadbootstrap-5da30ee5fb60ca29b7810368a13dd792b8337c7e.tar.xz
bootstrap-5da30ee5fb60ca29b7810368a13dd792b8337c7e.zip
Merge branch 'marcelkorpel-master' into 2.3.0-wip
-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 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-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()