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

Commit 3d9cc37

Browse files
author
Konstantin Shutkin
committed
added test: 'should allow creating tag on ENTER in multiple select mode with tagging enabled, no labels'
1 parent 3e3bcea commit 3d9cc37

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

test/select.spec.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,17 +1040,43 @@ describe('ui-select tests', function() {
10401040
</ui-select-choices> \
10411041
</ui-select>'
10421042
);
1043+
10431044
clickMatch(el);
10441045

10451046
var searchInput = el.find('.ui-select-search');
10461047

1047-
el.scope().$select.search = 'idontexist';
1048+
setSearchText(el, 'idontexist');
10481049

10491050
triggerKeydown(searchInput, Key.Enter);
10501051

10511052
expect($(el).scope().$select.selected).toEqual('idontexist');
10521053
});
10531054

1055+
it('should allow creating tag on ENTER in multiple select mode with tagging enabled, no labels', function() {
1056+
1057+
scope.taggingFunc = function (name) {
1058+
return name;
1059+
};
1060+
1061+
var el = compileTemplate(
1062+
'<ui-select multiple ng-model="selection.selected" tagging="taggingFunc" tagging-label="false"> \
1063+
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
1064+
<ui-select-choices repeat="person in people | filter: $select.search"> \
1065+
<div ng-bind-html="person.name" | highlight: $select.search"></div> \
1066+
<div ng-bind-html="person.email | highlight: $select.search"></div> \
1067+
</ui-select-choices> \
1068+
</ui-select>'
1069+
);
1070+
1071+
var searchInput = el.find('.ui-select-search');
1072+
1073+
setSearchText(el, 'idontexist');
1074+
1075+
triggerKeydown(searchInput, Key.Enter);
1076+
1077+
expect($(el).scope().$select.selected).toEqual(['idontexist']);
1078+
});
1079+
10541080
it('should append/transclude content (with correct scope) that users add at <match> tag', function () {
10551081

10561082
var el = compileTemplate(

0 commit comments

Comments
 (0)