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

Commit 9acaa63

Browse files
author
Konstantin Shutkin
committed
added test : 'should allow creating tag in single select mode with tagging enabled'
1 parent 48a08e3 commit 9acaa63

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/select.spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,32 @@ describe('ui-select tests', function() {
10251025
expect(scope.$model).toBe(scope.$item);
10261026
});
10271027

1028+
it('should allow creating tag in single select mode with tagging enabled', function() {
1029+
1030+
scope.taggingFunc = function (name) {
1031+
return name;
1032+
};
1033+
1034+
var el = compileTemplate(
1035+
'<ui-select ng-model="selection.selected" tagging="taggingFunc" tagging-label="false"> \
1036+
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
1037+
<ui-select-choices repeat="person in people | filter: $select.search"> \
1038+
<div ng-bind-html="person.name" | highlight: $select.search"></div> \
1039+
<div ng-bind-html="person.email | highlight: $select.search"></div> \
1040+
</ui-select-choices> \
1041+
</ui-select>'
1042+
);
1043+
clickMatch(el);
1044+
1045+
var searchInput = el.find('.ui-select-search');
1046+
1047+
el.scope().$select.search = 'idontexist';
1048+
1049+
triggerKeydown(searchInput, Key.Enter);
1050+
1051+
expect($(el).scope().$select.selected).toEqual('idontexist');
1052+
});
1053+
10281054
it('should append/transclude content (with correct scope) that users add at <match> tag', function () {
10291055

10301056
var el = compileTemplate(

0 commit comments

Comments
 (0)