From 624fd5f5659cb75fee5f51c23c15753f413e06c8 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Sat, 6 Jul 2013 17:29:26 +0200 Subject: [PATCH] fix(typeahead): correctly close popup on match selection --- src/typeahead/test/typeahead.spec.js | 3 +++ src/typeahead/typeahead.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js index 8f1bd3fdf7..89c893dea8 100644 --- a/src/typeahead/test/typeahead.spec.js +++ b/src/typeahead/test/typeahead.spec.js @@ -232,6 +232,7 @@ describe('typeahead tests', function () { expect($scope.result).toEqual('bar'); expect(inputEl.val()).toEqual('bar'); + expect(element).toBeClosed(); }); it('should select a match on tab', function () { @@ -244,6 +245,7 @@ describe('typeahead tests', function () { expect($scope.result).toEqual('bar'); expect(inputEl.val()).toEqual('bar'); + expect(element).toBeClosed(); }); it('should select match on click', function () { @@ -259,6 +261,7 @@ describe('typeahead tests', function () { expect($scope.result).toEqual('baz'); expect(inputEl.val()).toEqual('baz'); + expect(element).toBeClosed(); }); it('should invoke select callback on select', function () { diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index b4541def17..8a128fce14 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -195,6 +195,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position']) }); //return focus to the input element if a mach was selected via a mouse click event + resetMatches(); element[0].focus(); };