Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
revert(typeahead): prevent accidental form submission on ENTER
Browse files Browse the repository at this point in the history
Closes #1298
This reverts commit 253c49f.
  • Loading branch information
pkozlowski-opensource committed Dec 20, 2013
1 parent dd415a9 commit ea053b1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/typeahead/test/typeahead.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ describe('typeahead tests', function () {
var e = $.Event("keydown");
e.which = keyCode;
inputEl.trigger(e);
return e;
};

//custom matchers
Expand Down Expand Up @@ -439,13 +438,6 @@ describe('typeahead tests', function () {
expect($scope.isLoading).toBeFalsy();
});

it('pr 1165 - prevent default on ENTER to avoid accidental form submission', function () {
var element = prepareInputEl("<div><input ng-model='result' typeahead='item for item in source | filter:$viewValue'></div>");
var e = triggerKeyDown(element, 13);

expect(e.isDefaultPrevented()).toBeTruthy();
});

it('does not close matches popup on click in input', function () {
var element = prepareInputEl("<div><input ng-model='result' typeahead='item for item in source | filter:$viewValue'></div>");
var inputEl = findInput(element);
Expand Down
3 changes: 0 additions & 3 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap

//typeahead is open and an "interesting" key was pressed
if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) {
if (evt.which === 13) {
evt.preventDefault();
}
return;
}

Expand Down

0 comments on commit ea053b1

Please sign in to comment.