diff options
| author | Marcel Korpel <[email protected]> | 2012-12-01 15:19:41 +0100 |
|---|---|---|
| committer | Marcel Korpel <[email protected]> | 2012-12-02 12:35:33 +0100 |
| commit | 0dece7a71f4f3591c7d1fecb9dea7cba82c9624a (patch) | |
| tree | f3327eb13d18a8a29e077fba6e39e21a9ca8ae51 /js | |
| parent | 3b3dd3ac3c7b69d02406ede69bffcc4ee8a1ed6b (diff) | |
| download | bootstrap-0dece7a71f4f3591c7d1fecb9dea7cba82c9624a.tar.xz bootstrap-0dece7a71f4f3591c7d1fecb9dea7cba82c9624a.zip | |
Set focus back to input field after clicking an item
Test 'focus is still set' added
Fixes issue #5933
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 2f3dc274f..4f333e8c2 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -263,6 +263,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 16bdb9194..5e1183609 100644 --- a/js/tests/unit/bootstrap-typeahead.js +++ b/js/tests/unit/bootstrap-typeahead.js @@ -162,17 +162,22 @@ $(function () { }) , 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') typeahead.$menu.remove() }) |
