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

Commit c66536e

Browse files
committed
Add tests
1 parent 2e3c6c8 commit c66536e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/select.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ describe('ui-select tests', function () {
165165
if (attrs.tagging !== undefined) {
166166
attrsHtml += ' tagging="' + attrs.tagging + '"';
167167
}
168+
if (attrs.taggingLabel !== undefined) {
169+
attrsHtml += ' tagging-label="' + attrs.taggingLabel + '"';
170+
}
168171
if (attrs.taggingTokens !== undefined) {
169172
attrsHtml += ' tagging-tokens="' + attrs.taggingTokens + '"';
170173
}
@@ -700,6 +703,15 @@ describe('ui-select tests', function () {
700703
expect($(el).scope().$select.selected).toEqual("I don't exist");
701704
});
702705

706+
it('should not include tagging label if the selection is clicked', function () {
707+
var el = createUiSelect({tagging: true, taggingLabel: ' (default)'});
708+
clickMatch(el);
709+
710+
$(el).scope().$select.select("I don't exist (default)", undefined, { type: 'click' });
711+
712+
expect($(el).scope().$select.selected).toEqual("I don't exist");
713+
});
714+
703715
it('should format new items using the tagging function when the attribute is a function', function () {
704716
scope.taggingFunc = function (name) {
705717
return {
@@ -2712,6 +2724,17 @@ describe('ui-select tests', function () {
27122724
.toEqual(jasmine.objectContaining({name: 'Amalie', email: '[email protected]'}));
27132725
});
27142726

2727+
it('should not include tagging label if the selection is clicked', function () {
2728+
var el = createUiSelectMultiple({tagging: true, taggingLabel: ' (default)'});
2729+
clickMatch(el);
2730+
2731+
$(el).scope().$select.select("I don't exist (default)", undefined, { type: 'click' });
2732+
$(el).scope().$select.select("I also don't exist (default)", undefined, { type: 'click' });
2733+
2734+
expect($(el).scope().$select.selected[0]).toEqual("I don't exist");
2735+
expect($(el).scope().$select.selected[1]).toEqual("I also don't exist");
2736+
});
2737+
27152738

27162739
it('should have tolerance for undefined values', function () {
27172740

0 commit comments

Comments
 (0)