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

Commit 47ab073

Browse files
committed
Add tests
1 parent a636c2a commit 47ab073

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/select.spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ describe('ui-select tests', function () {
161161
if (attrs.theme !== undefined) { attrsHtml += ' theme="' + attrs.theme + '"'; }
162162
if (attrs.tabindex !== undefined) { attrsHtml += ' tabindex="' + attrs.tabindex + '"'; }
163163
if (attrs.tagging !== undefined) { attrsHtml += ' tagging="' + attrs.tagging + '"'; }
164+
if (attrs.taggingLabel !== undefined) { attrsHtml += ' tagging-label="' + attrs.taggingLabel + '"'; }
164165
if (attrs.taggingTokens !== undefined) { attrsHtml += ' tagging-tokens="' + attrs.taggingTokens + '"'; }
165166
if (attrs.title !== undefined) { attrsHtml += ' title="' + attrs.title + '"'; }
166167
if (attrs.appendToBody !== undefined) { attrsHtml += ' append-to-body="' + attrs.appendToBody + '"'; }
@@ -682,6 +683,15 @@ describe('ui-select tests', function () {
682683
expect($(el).scope().$select.selected).toEqual("I don't exist");
683684
});
684685

686+
it('should not include tagging label if the selection is clicked', function () {
687+
var el = createUiSelect({tagging: true, taggingLabel: ' (default)'});
688+
clickMatch(el);
689+
690+
$(el).scope().$select.select("I don't exist (default)", undefined, { type: 'click' });
691+
692+
expect($(el).scope().$select.selected).toEqual("I don't exist");
693+
});
694+
685695
it('should format new items using the tagging function when the attribute is a function', function () {
686696
scope.taggingFunc = function (name) {
687697
return {
@@ -2730,6 +2740,17 @@ describe('ui-select tests', function () {
27302740
expect(el.scope().$select.items[1]).toEqual(jasmine.objectContaining({ name: 'Amalie', email: '[email protected]' }));
27312741
});
27322742

2743+
it('should not include tagging label if the selection is clicked', function () {
2744+
var el = createUiSelectMultiple({tagging: true, taggingLabel: ' (default)'});
2745+
clickMatch(el);
2746+
2747+
$(el).scope().$select.select("I don't exist (default)", undefined, { type: 'click' });
2748+
$(el).scope().$select.select("I also don't exist (default)", undefined, { type: 'click' });
2749+
2750+
expect($(el).scope().$select.selected[0]).toEqual("I don't exist");
2751+
expect($(el).scope().$select.selected[1]).toEqual("I also don't exist");
2752+
});
2753+
27332754

27342755
it('should have tolerance for undefined values', function () {
27352756

0 commit comments

Comments
 (0)