@@ -78,7 +78,7 @@ describe('ui-select tests', function() {
78
78
{ name :
'Nicole' , email :
'[email protected] ' , group :
'bar' , age :
43 } ,
79
79
{ name :
'Natasha' , email :
'[email protected] ' , group :
'Baz' , age :
54 }
80
80
] ;
81
-
81
+
82
82
scope . peopleObj = {
83
83
'1' :
{ name :
'Adam' , email :
'[email protected] ' , age :
12 , country :
'United States' } ,
84
84
'2' :
{ name :
'Amalie' , email :
'[email protected] ' , age :
12 , country :
'Argentina' } ,
@@ -127,6 +127,7 @@ describe('ui-select tests', function() {
127
127
if ( attrs . title !== undefined ) { attrsHtml += ' title="' + attrs . title + '"' ; }
128
128
if ( attrs . appendToBody !== undefined ) { attrsHtml += ' append-to-body="' + attrs . appendToBody + '"' ; }
129
129
if ( attrs . allowClear !== undefined ) { matchAttrsHtml += ' allow-clear="' + attrs . allowClear + '"' ; }
130
+ if ( attrs . inputId !== undefined ) { attrsHtml += ' input-id="' + attrs . inputId + '"' ; }
130
131
}
131
132
132
133
return compileTemplate (
@@ -207,7 +208,7 @@ describe('ui-select tests', function() {
207
208
//uisRepeatParser
208
209
209
210
it ( 'should parse simple repeat syntax' , function ( ) {
210
-
211
+
211
212
var locals = { } ;
212
213
locals . people = [ { name : 'Wladimir' } , { name : 'Samantha' } ] ;
213
214
locals . person = locals . people [ 0 ] ;
@@ -226,7 +227,7 @@ describe('ui-select tests', function() {
226
227
} ) ;
227
228
228
229
it ( 'should parse simple repeat syntax' , function ( ) {
229
-
230
+
230
231
var locals = { } ;
231
232
locals . people = [ { name : 'Wladimir' } , { name : 'Samantha' } ] ;
232
233
locals . person = locals . people [ 0 ] ;
@@ -239,7 +240,7 @@ describe('ui-select tests', function() {
239
240
} ) ;
240
241
241
242
it ( 'should parse simple property binding repeat syntax' , function ( ) {
242
-
243
+
243
244
var locals = { } ;
244
245
locals . people = [ { name : 'Wladimir' } , { name : 'Samantha' } ] ;
245
246
locals . person = locals . people [ 0 ] ;
@@ -252,7 +253,7 @@ describe('ui-select tests', function() {
252
253
} ) ;
253
254
254
255
it ( 'should parse (key, value) repeat syntax' , function ( ) {
255
-
256
+
256
257
var locals = { } ;
257
258
locals . people = { 'WC' : { name : 'Wladimir' } , 'SH' : { name : 'Samantha' } } ;
258
259
locals . person = locals . people [ 0 ] ;
@@ -272,7 +273,7 @@ describe('ui-select tests', function() {
272
273
} ) ;
273
274
274
275
it ( 'should parse simple property binding with (key, value) repeat syntax' , function ( ) {
275
-
276
+
276
277
var locals = { } ;
277
278
locals . people = { 'WC' : { name : 'Wladimir' } , 'SH' : { name : 'Samantha' } } ;
278
279
locals . person = locals . people [ 'WC' ] ;
@@ -286,7 +287,7 @@ describe('ui-select tests', function() {
286
287
} ) ;
287
288
288
289
it ( 'should should accept a "collection expresion" only if its not (key, value) repeat syntax' , function ( ) {
289
-
290
+
290
291
var locals = { } ;
291
292
locals . people = { 'WC' : { name : 'Wladimir' } , 'SH' : { name : 'Samantha' } } ;
292
293
locals . person = locals . people [ 'WC' ] ;
@@ -299,7 +300,7 @@ describe('ui-select tests', function() {
299
300
} ) ;
300
301
301
302
it ( 'should should throw if "collection expresion" used and (key, value) repeat syntax' , function ( ) {
302
-
303
+
303
304
var locals = { } ;
304
305
locals . people = { 'WC' : { name : 'Wladimir' } , 'SH' : { name : 'Samantha' } } ;
305
306
locals . person = locals . people [ 'WC' ] ;
@@ -339,7 +340,7 @@ describe('ui-select tests', function() {
339
340
340
341
expect ( getMatchLabel ( el ) ) . toEqual ( 'Adam' ) ;
341
342
} ) ;
342
-
343
+
343
344
it ( 'should correctly render initial state with track by feature' , function ( ) {
344
345
var el = compileTemplate (
345
346
'<ui-select ng-model="selection.selected"> \
@@ -447,13 +448,13 @@ describe('ui-select tests', function() {
447
448
it ( 'should toggle allow-clear directive' , function ( ) {
448
449
scope . selection . selected = scope . people [ 0 ] ;
449
450
scope . isClearAllowed = false ;
450
-
451
+
451
452
var el = createUiSelect ( { theme : 'select2' , allowClear : '{{isClearAllowed}}' } ) ;
452
453
var $select = el . scope ( ) . $select ;
453
454
454
455
expect ( $select . allowClear ) . toEqual ( false ) ;
455
456
expect ( el . find ( '.select2-search-choice-close' ) . length ) . toEqual ( 0 ) ;
456
-
457
+
457
458
// Turn clear on
458
459
scope . isClearAllowed = true ;
459
460
scope . $digest ( ) ;
@@ -1506,6 +1507,7 @@ describe('ui-select tests', function() {
1506
1507
if ( attrs . closeOnSelect !== undefined ) { attrsHtml += ' close-on-select="' + attrs . closeOnSelect + '"' ; }
1507
1508
if ( attrs . tagging !== undefined ) { attrsHtml += ' tagging="' + attrs . tagging + '"' ; }
1508
1509
if ( attrs . taggingTokens !== undefined ) { attrsHtml += ' tagging-tokens="' + attrs . taggingTokens + '"' ; }
1510
+ if ( attrs . inputId !== undefined ) { attrsHtml += ' input-id="' + attrs . inputId + '"' ; }
1509
1511
}
1510
1512
1511
1513
return compileTemplate (
@@ -2093,6 +2095,20 @@ describe('ui-select tests', function() {
2093
2095
2094
2096
expect ( $ ( el ) . scope ( ) . $select . selected . length ) . toBe ( 5 ) ;
2095
2097
} ) ;
2098
+
2099
+ it ( 'should add an id to the search input field' , function ( ) {
2100
+ var el = createUiSelectMultiple ( { inputId : 'inid' } ) ;
2101
+ var searchEl = $ ( el ) . find ( 'input.ui-select-search' ) ;
2102
+ expect ( searchEl . length ) . toEqual ( 1 ) ;
2103
+ expect ( searchEl [ 0 ] . id ) . toEqual ( 'inid' ) ;
2104
+ } ) ;
2105
+ } ) ;
2106
+
2107
+ it ( 'should add an id to the search input field' , function ( ) {
2108
+ var el = createUiSelect ( { inputId : 'inid' } ) ;
2109
+ var searchEl = $ ( el ) . find ( 'input.ui-select-search' ) ;
2110
+ expect ( searchEl . length ) . toEqual ( 1 ) ;
2111
+ expect ( searchEl [ 0 ] . id ) . toEqual ( 'inid' ) ;
2096
2112
} ) ;
2097
2113
2098
2114
describe ( 'default configuration via uiSelectConfig' , function ( ) {
0 commit comments