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
add input id to search <input> if present on ui-select directive as input-id #1220
Merged
Merged
Changes from all commits
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 |
---|---|---|
|
@@ -78,7 +78,7 @@ describe('ui-select tests', function() { | |
{ name: 'Nicole', email: '[email protected]', group: 'bar', age: 43 }, | ||
{ name: 'Natasha', email: '[email protected]', group: 'Baz', age: 54 } | ||
]; | ||
|
||
scope.peopleObj = { | ||
'1' : { name: 'Adam', email: '[email protected]', age: 12, country: 'United States' }, | ||
'2' : { name: 'Amalie', email: '[email protected]', age: 12, country: 'Argentina' }, | ||
|
@@ -127,6 +127,7 @@ describe('ui-select tests', function() { | |
if (attrs.title !== undefined) { attrsHtml += ' title="' + attrs.title + '"'; } | ||
if (attrs.appendToBody !== undefined) { attrsHtml += ' append-to-body="' + attrs.appendToBody + '"'; } | ||
if (attrs.allowClear !== undefined) { matchAttrsHtml += ' allow-clear="' + attrs.allowClear + '"';} | ||
if (attrs.inputId !== undefined) { attrsHtml += ' input-id="' + attrs.inputId + '"'; } | ||
} | ||
|
||
return compileTemplate( | ||
|
@@ -207,7 +208,7 @@ describe('ui-select tests', function() { | |
//uisRepeatParser | ||
|
||
it('should parse simple repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = [{name: 'Wladimir'}, {name: 'Samantha'}]; | ||
locals.person = locals.people[0]; | ||
|
@@ -226,7 +227,7 @@ describe('ui-select tests', function() { | |
}); | ||
|
||
it('should parse simple repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = [{name: 'Wladimir'}, {name: 'Samantha'}]; | ||
locals.person = locals.people[0]; | ||
|
@@ -239,7 +240,7 @@ describe('ui-select tests', function() { | |
}); | ||
|
||
it('should parse simple property binding repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = [{name: 'Wladimir'}, {name: 'Samantha'}]; | ||
locals.person = locals.people[0]; | ||
|
@@ -252,7 +253,7 @@ describe('ui-select tests', function() { | |
}); | ||
|
||
it('should parse (key, value) repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = { 'WC' : {name: 'Wladimir'}, 'SH' : {name: 'Samantha'}}; | ||
locals.person = locals.people[0]; | ||
|
@@ -272,7 +273,7 @@ describe('ui-select tests', function() { | |
}); | ||
|
||
it('should parse simple property binding with (key, value) repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = { 'WC' : {name: 'Wladimir'}, 'SH' : {name: 'Samantha'}}; | ||
locals.person = locals.people['WC']; | ||
|
@@ -286,7 +287,7 @@ describe('ui-select tests', function() { | |
}); | ||
|
||
it('should should accept a "collection expresion" only if its not (key, value) repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = { 'WC' : {name: 'Wladimir'}, 'SH' : {name: 'Samantha'}}; | ||
locals.person = locals.people['WC']; | ||
|
@@ -299,7 +300,7 @@ describe('ui-select tests', function() { | |
}); | ||
|
||
it('should should throw if "collection expresion" used and (key, value) repeat syntax', function() { | ||
|
||
var locals = {}; | ||
locals.people = { 'WC' : {name: 'Wladimir'}, 'SH' : {name: 'Samantha'}}; | ||
locals.person = locals.people['WC']; | ||
|
@@ -339,7 +340,7 @@ describe('ui-select tests', function() { | |
|
||
expect(getMatchLabel(el)).toEqual('Adam'); | ||
}); | ||
|
||
it('should correctly render initial state with track by feature', function() { | ||
var el = compileTemplate( | ||
'<ui-select ng-model="selection.selected"> \ | ||
|
@@ -447,13 +448,13 @@ describe('ui-select tests', function() { | |
it('should toggle allow-clear directive', function() { | ||
scope.selection.selected = scope.people[0]; | ||
scope.isClearAllowed = false; | ||
|
||
var el = createUiSelect({theme : 'select2', allowClear: '{{isClearAllowed}}'}); | ||
var $select = el.scope().$select; | ||
|
||
expect($select.allowClear).toEqual(false); | ||
expect(el.find('.select2-search-choice-close').length).toEqual(0); | ||
|
||
// Turn clear on | ||
scope.isClearAllowed = true; | ||
scope.$digest(); | ||
|
@@ -1506,6 +1507,7 @@ describe('ui-select tests', function() { | |
if (attrs.closeOnSelect !== undefined) { attrsHtml += ' close-on-select="' + attrs.closeOnSelect + '"'; } | ||
if (attrs.tagging !== undefined) { attrsHtml += ' tagging="' + attrs.tagging + '"'; } | ||
if (attrs.taggingTokens !== undefined) { attrsHtml += ' tagging-tokens="' + attrs.taggingTokens + '"'; } | ||
if (attrs.inputId !== undefined) { attrsHtml += ' input-id="' + attrs.inputId + '"'; } | ||
} | ||
|
||
return compileTemplate( | ||
|
@@ -2093,6 +2095,20 @@ describe('ui-select tests', function() { | |
|
||
expect($(el).scope().$select.selected.length).toBe(5); | ||
}); | ||
|
||
it('should add an id to the search input field', function () { | ||
var el = createUiSelectMultiple({inputId: 'inid'}); | ||
var searchEl = $(el).find('input.ui-select-search'); | ||
expect(searchEl.length).toEqual(1); | ||
expect(searchEl[0].id).toEqual('inid'); | ||
}); | ||
}); | ||
|
||
it('should add an id to the search input field', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like same test is repeated twice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to test both single and multiple because they are very different beasts (even though they both have the same text input name right now). The |
||
var el = createUiSelect({inputId: 'inid'}); | ||
var searchEl = $(el).find('input.ui-select-search'); | ||
expect(searchEl.length).toEqual(1); | ||
expect(searchEl[0].id).toEqual('inid'); | ||
}); | ||
|
||
describe('default configuration via uiSelectConfig', function() { | ||
|
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.
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.
Instead of
inputId
what about onlyid
?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.
You can't have two elements with the same id and I felt weird about removing the id from the ui-select because people might be using that to select their css rules.