This repository was archived by the owner on Oct 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(uiSelectController): Select by click on non-multiple tagging (bis) #1727
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1427,6 +1427,31 @@ describe('ui-select tests', function() { | |
expect($(el).scope().$select.selected).toEqual(['idontexist']); | ||
}); | ||
|
||
it('should allow selecting an item (click) in single select mode with tagging enabled', function() { | ||
|
||
scope.taggingFunc = function (name) { | ||
return name; | ||
}; | ||
|
||
var el = compileTemplate( | ||
'<ui-select ng-model="selection.selected" tagging="taggingFunc" tagging-label="false"> \ | ||
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \ | ||
<ui-select-choices repeat="person in people | filter: $select.search"> \ | ||
<div ng-bind-html="person.name" | highlight: $select.search"></div> \ | ||
<div ng-bind-html="person.email | highlight: $select.search"></div> \ | ||
</ui-select-choices> \ | ||
</ui-select>' | ||
); | ||
|
||
clickMatch(el); | ||
setSearchText(el, 'Sam'); | ||
clickItem(el, 'Samantha'); | ||
|
||
expect(scope.selection.selected).toBe(scope.people[5]); | ||
expect(getMatchLabel(el)).toEqual('Samantha'); | ||
}); | ||
|
||
|
||
it('should remove a choice when multiple and remove-selected is not given (default is true)', function () { | ||
|
||
var el = compileTemplate( | ||
|
@@ -2527,7 +2552,7 @@ describe('ui-select tests', function() { | |
expect(el.scope().$select.items[1]).toEqual(jasmine.objectContaining({name: 'Amalie', email: '[email protected]'})); | ||
}); | ||
|
||
|
||
it('should have tolerance for undefined values', function () { | ||
|
||
scope.modelValue = undefined; | ||
|
@@ -2563,7 +2588,7 @@ describe('ui-select tests', function() { | |
|
||
expect($(el).scope().$select.selected).toEqual([]); | ||
}); | ||
|
||
it('should allow paste tag from clipboard', function() { | ||
scope.taggingFunc = function (name) { | ||
return { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a check down below already... (L438)
Can you combine this/assignment into one and then just check for item?