Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/typeahead/test/typeahead.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,16 @@ describe('typeahead tests', function () {

expect(element).toBeOpenWithActive(2, 0);
});

it('should set \'parse\' key as valid when selecting a perfect match and not editable', function () {
var element = prepareInputEl('<div ng-form="test"><input name="typeahead" ng-model="result" typeahead="state as state.name for state in states | filter:$viewValue" typeahead-editable="false"></div>');
var inputEl = findInput(element);

changeInputValueTo(element, 'Alaska');
triggerKeyDown(element, 13);

expect($scope.test.typeahead.$error.parse).toBeUndefined();
});
});

describe('input formatting', function () {
Expand Down
1 change: 1 addition & 0 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ angular.module('mm.foundation.typeahead', ['mm.foundation.position', 'mm.foundat
model = parserResult.modelMapper(originalScope, locals);
$setModelValue(originalScope, model);
modelCtrl.$setValidity('editable', true);
modelCtrl.$setValidity('parse', true);

onSelectCallback(originalScope, {
$item: item,
Expand Down