Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

If tagging mode is activated, do not check values #682

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions src/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@
return false;
};
if (!inputValue) return resultMultiple; //If ngModel was undefined
if ($select.tagging.isActivated) return inputValue;
for (var k = inputValue.length - 1; k >= 0; k--) {
if (!checkFnMultiple($select.selected, inputValue[k])){
checkFnMultiple(data, inputValue[k]);
Expand Down
8 changes: 8 additions & 0 deletions test/select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ describe('ui-select tests', function() {

expect($(el).scope().$select.selected).toEqual("I don't exist");
});

it('should keep the model intact when the tagging attribute is defined', function() {
scope.selection.selected.push("I am not on the list of choices");
var el = createUiSelect({tagging: true});
clickMatch(el);

expect($(el).scope().$select.selected).toEqual("I am not on the list of choices");
});

it('should format new items using the tagging function when the attribute is a function', function() {
scope.taggingFunc = function (name) {
Expand Down