@@ -260,6 +260,13 @@ describe('ui-select tests', function() {
260
260
scope . $digest ( ) ;
261
261
}
262
262
263
+ it ( 'should initialize selected choices with an array if choices source is undefined' , function ( ) {
264
+ var el = createUiSelect ( ) ,
265
+ ctrl = el . scope ( ) . $select ;
266
+
267
+ ctrl . setItemsFn ( ) ; // setPlainItems
268
+ expect ( ctrl . items ) . toEqual ( [ ] ) ;
269
+ } ) ;
263
270
264
271
// Tests
265
272
//uisRepeatParser
@@ -1864,6 +1871,14 @@ describe('ui-select tests', function() {
1864
1871
) ;
1865
1872
}
1866
1873
1874
+ it ( 'should initialize selected choices with an empty array when choices source is undefined' , function ( ) {
1875
+ var el = createUiSelectMultiple ( { groupBy : "'age'" } ) ,
1876
+ ctrl = el . scope ( ) . $select ;
1877
+
1878
+ ctrl . setItemsFn ( ) ; // updateGroups
1879
+ expect ( ctrl . items ) . toEqual ( [ ] ) ;
1880
+ } ) ;
1881
+
1867
1882
it ( 'should render initial state' , function ( ) {
1868
1883
var el = createUiSelectMultiple ( ) ;
1869
1884
expect ( el ) . toHaveClass ( 'ui-select-multiple' ) ;
@@ -3231,12 +3246,12 @@ describe('ui-select tests', function() {
3231
3246
expect ( el . scope ( ) . $select . spinnerClass ) . toBe ( 'randomclass' ) ;
3232
3247
} ) ;
3233
3248
} ) ;
3234
-
3249
+
3235
3250
describe ( 'With refresh on active' , function ( ) {
3236
3251
it ( 'should refresh when is activated' , function ( ) {
3237
3252
scope . fetchFromServer = function ( ) { } ;
3238
3253
var el = createUiSelect ( { refresh :"fetchFromServer($select.search)" , refreshDelay :0 } ) ;
3239
- spyOn ( scope , 'fetchFromServer' ) ;
3254
+ spyOn ( scope , 'fetchFromServer' ) ;
3240
3255
expect ( el . scope ( ) . $select . open ) . toEqual ( false ) ;
3241
3256
el . scope ( ) . $select . activate ( ) ;
3242
3257
$timeout . flush ( ) ;
@@ -3248,7 +3263,7 @@ describe('ui-select tests', function() {
3248
3263
it ( 'should refresh when open is set to true' , function ( ) {
3249
3264
scope . fetchFromServer = function ( ) { } ;
3250
3265
var el = createUiSelect ( { refresh :"fetchFromServer($select.search)" , refreshDelay :0 } ) ;
3251
- spyOn ( scope , 'fetchFromServer' ) ;
3266
+ spyOn ( scope , 'fetchFromServer' ) ;
3252
3267
expect ( el . scope ( ) . $select . open ) . toEqual ( false ) ;
3253
3268
openDropdown ( el ) ;
3254
3269
$timeout . flush ( ) ;
0 commit comments