File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1151,6 +1151,27 @@ describe('ngOptions', function() {
1151
1151
} ) ;
1152
1152
1153
1153
1154
+ it ( 'should not insert a blank option if one of the options maps to null' , function ( ) {
1155
+ createSelect ( {
1156
+ 'ng-model' : 'myColor' ,
1157
+ 'ng-options' : 'color.shade as color.name for color in colors'
1158
+ } ) ;
1159
+
1160
+ scope . $apply ( function ( ) {
1161
+ scope . colors = [
1162
+ { name :'nothing' , shade :null } ,
1163
+ { name :'red' , shade :'dark' }
1164
+ ] ;
1165
+ scope . myColor = null ;
1166
+ } ) ;
1167
+
1168
+ expect ( element . find ( 'option' ) . length ) . toEqual ( 2 ) ;
1169
+ expect ( element . find ( 'option' ) . eq ( 0 ) ) . toEqualOption ( null ) ;
1170
+ expect ( element . val ( ) ) . not . toEqualUnknownValue ( null ) ;
1171
+ expect ( element . find ( 'option' ) . eq ( 0 ) ) . not . toEqualUnknownOption ( null ) ;
1172
+ } ) ;
1173
+
1174
+
1154
1175
it ( 'should insert a unknown option if bound to something not in the list' , function ( ) {
1155
1176
createSingleSelect ( ) ;
1156
1177
You can’t perform that action at this time.
0 commit comments