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

Commit 866bc5c

Browse files
committed
If tagging mode is activated, do not check values
Motivation: Fix #540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view. Conflicts: src/uiSelectMultipleDirective.js
1 parent 0ac10b0 commit 866bc5c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/select.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,26 @@ describe('ui-select tests', function() {
17251725

17261726
expect(el.scope().$select.multiple).toBe(true);
17271727
});
1728+
1729+
it('should preserve the model if tagging is enabled on select multiple', function() {
1730+
scope.selection.selectedMultiple = ["I am not on the list of choices"];
1731+
1732+
var el = compileTemplate(
1733+
'<ui-select multiple="multiple" tagging ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
1734+
<ui-select-match placeholder="Pick one...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> \
1735+
<ui-select-choices repeat="person.email as person in people | filter: $select.search"> \
1736+
<div ng-bind-html="person.name | highlight: $select.search"></div> \
1737+
<div ng-bind-html="person.email | highlight: $select.search"></div> \
1738+
</ui-select-choices> \
1739+
</ui-select> \
1740+
'
1741+
);
1742+
1743+
scope.$digest();
1744+
1745+
expect(scope.selection.selectedMultiple)
1746+
.toEqual(["I am not on the list of choices"]);
1747+
});
17281748

17291749
it('should allow paste tag from clipboard', function() {
17301750
scope.taggingFunc = function (name) {

0 commit comments

Comments
 (0)