@@ -567,7 +567,7 @@ describe('ui-select tests', function() {
567
567
var el = createUiSelect ( { tagging : 'taggingFunc' } ) ;
568
568
clickMatch ( el ) ;
569
569
570
- $ ( el ) . scope ( ) . $select . search = 'idontexist' ;
570
+ showChoicesForSearch ( el , 'idontexist' ) ;
571
571
$ ( el ) . scope ( ) . $select . activeIndex = 0 ;
572
572
$ ( el ) . scope ( ) . $select . select ( 'idontexist' ) ;
573
573
@@ -2231,6 +2231,32 @@ describe('ui-select tests', function() {
2231
2231
expect ( scope . slowTaggingFunc . calls . count ( ) ) . not . toBe ( 15 ) ;
2232
2232
} ) ;
2233
2233
2234
+ it ( 'should allow decline tags when tagging function returns null in multiple select mode' , function ( ) {
2235
+ scope . taggingFunc = function ( name ) {
2236
+ if ( name == 'idontexist' ) return null ;
2237
+ return {
2238
+ name : name ,
2239
+ email : name + '@email.com' ,
2240
+ group : 'Foo' ,
2241
+ age : 12
2242
+ } ;
2243
+ } ;
2244
+
2245
+ var el = createUiSelectMultiple ( { tagging : 'taggingFunc' } ) ;
2246
+
2247
+ showChoicesForSearch ( el , 'amalie' ) ;
2248
+ expect ( el . find ( '.ui-select-choices-row-inner' ) . size ( ) ) . toBe ( 2 ) ;
2249
+ expect ( el . scope ( ) . $select . items [ 0 ] ) . toEqual ( jasmine . objectContaining ( { name : 'amalie' , isTag : true } ) ) ;
2250
+ expect ( el . scope ( ) . $select . items [ 1 ] ) . toEqual ( jasmine . objectContaining ( { name : 'Amalie' } ) ) ;
2251
+
2252
+ showChoicesForSearch ( el , 'idoexist' ) ;
2253
+ expect ( el . find ( '.ui-select-choices-row-inner' ) . size ( ) ) . toBe ( 1 ) ;
2254
+ expect ( el . find ( '.ui-select-choices-row-inner' ) . is ( ':contains(idoexist@email.com)' ) ) . toBeTruthy ( ) ;
2255
+
2256
+ showChoicesForSearch ( el , 'idontexist' ) ;
2257
+ expect ( el . find ( '.ui-select-choices-row-inner' ) . size ( ) ) . toBe ( 0 ) ;
2258
+ } ) ;
2259
+
2234
2260
it ( 'should allow paste tag from clipboard' , function ( ) {
2235
2261
scope . taggingFunc = function ( name ) {
2236
2262
return {
0 commit comments