@@ -168,7 +168,6 @@ describe('ui-select tests', function() {
168
168
if ( attrs . refresh !== undefined ) { choicesAttrsHtml += ' refresh="' + attrs . refresh + '"' ; }
169
169
if ( attrs . refreshDelay !== undefined ) { choicesAttrsHtml += ' refresh-delay="' + attrs . refreshDelay + '"' ; }
170
170
if ( attrs . backspaceReset !== undefined ) { attrsHtml += ' backspace-reset="' + attrs . backspaceReset + '"' ; }
171
- if ( attrs . refreshOnActive !== undefined ) { choicesAttrsHtml += ' refresh-on-active="' + attrs . refreshOnActive + '"' ; }
172
171
173
172
}
174
173
@@ -3123,14 +3122,25 @@ describe('ui-select tests', function() {
3123
3122
} ) ;
3124
3123
3125
3124
describe ( 'With refresh on active' , function ( ) {
3126
- it ( 'should not refresh untill is activated' , function ( ) {
3125
+ it ( 'should refresh when is activated' , function ( ) {
3127
3126
scope . fetchFromServer = function ( ) { } ;
3128
- var el = createUiSelect ( { refresh :"fetchFromServer($select.search)" , refreshOnActive :true , refreshDelay :0 } ) ;
3129
- spyOn ( scope , 'fetchFromServer' ) ;
3130
- $timeout . flush ( ) ;
3131
- expect ( scope . fetchFromServer . calls . any ( ) ) . toEqual ( false ) ;
3127
+ var el = createUiSelect ( { refresh :"fetchFromServer($select.search)" , refreshDelay :0 } ) ;
3128
+ spyOn ( scope , 'fetchFromServer' ) ;
3129
+ expect ( el . scope ( ) . $select . open ) . toEqual ( false ) ;
3132
3130
el . scope ( ) . $select . activate ( ) ;
3133
3131
$timeout . flush ( ) ;
3132
+ expect ( el . scope ( ) . $select . open ) . toEqual ( true ) ;
3133
+ expect ( scope . fetchFromServer . calls . any ( ) ) . toEqual ( true ) ;
3134
+ } ) ;
3135
+
3136
+ it ( 'should refresh when open is set to true' , function ( ) {
3137
+ scope . fetchFromServer = function ( ) { } ;
3138
+ var el = createUiSelect ( { refresh :"fetchFromServer($select.search)" , refreshDelay :0 } ) ;
3139
+ spyOn ( scope , 'fetchFromServer' ) ;
3140
+ expect ( el . scope ( ) . $select . open ) . toEqual ( false ) ;
3141
+ openDropdown ( el ) ;
3142
+ $timeout . flush ( ) ;
3143
+ expect ( el . scope ( ) . $select . open ) . toEqual ( true ) ;
3134
3144
expect ( scope . fetchFromServer . calls . any ( ) ) . toEqual ( true ) ;
3135
3145
} ) ;
3136
3146
} ) ;
0 commit comments