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

Commit 852f874

Browse files
Asimov4wesleycho
authored andcommitted
test(tagging): add test for preserving model
- Add test for preserving model when tagging is enabled on multiselect Closes #540 Closes #683
1 parent 569d012 commit 852f874

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/select.spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -2213,6 +2213,26 @@ describe('ui-select tests', function() {
22132213

22142214
expect(el.scope().$select.multiple).toBe(true);
22152215
});
2216+
2217+
it('should preserve the model if tagging is enabled on select multiple', function() {
2218+
scope.selection.selectedMultiple = ["I am not on the list of choices"];
2219+
2220+
var el = compileTemplate(
2221+
'<ui-select multiple="multiple" tagging ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
2222+
<ui-select-match placeholder="Pick one...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> \
2223+
<ui-select-choices repeat="person.email as person in people | filter: $select.search"> \
2224+
<div ng-bind-html="person.name | highlight: $select.search"></div> \
2225+
<div ng-bind-html="person.email | highlight: $select.search"></div> \
2226+
</ui-select-choices> \
2227+
</ui-select> \
2228+
'
2229+
);
2230+
2231+
scope.$digest();
2232+
2233+
expect(scope.selection.selectedMultiple)
2234+
.toEqual(["I am not on the list of choices"]);
2235+
});
22162236

22172237
it('should not call tagging function needlessly', function() {
22182238
scope.slowTaggingFunc = function (name) {

0 commit comments

Comments
 (0)