@@ -1587,7 +1587,8 @@ describe('ui-select tests', function() {
1587
1587
describe ( 'multi selection' , function ( ) {
1588
1588
1589
1589
function createUiSelectMultiple ( attrs ) {
1590
- var attrsHtml = '' ;
1590
+ var attrsHtml = '' ,
1591
+ choicesAttrsHtml = '' ;
1591
1592
if ( attrs !== undefined ) {
1592
1593
if ( attrs . disabled !== undefined ) { attrsHtml += ' ng-disabled="' + attrs . disabled + '"' ; }
1593
1594
if ( attrs . required !== undefined ) { attrsHtml += ' ng-required="' + attrs . required + '"' ; }
@@ -1596,12 +1597,13 @@ describe('ui-select tests', function() {
1596
1597
if ( attrs . tagging !== undefined ) { attrsHtml += ' tagging="' + attrs . tagging + '"' ; }
1597
1598
if ( attrs . taggingTokens !== undefined ) { attrsHtml += ' tagging-tokens="' + attrs . taggingTokens + '"' ; }
1598
1599
if ( attrs . inputId !== undefined ) { attrsHtml += ' input-id="' + attrs . inputId + '"' ; }
1600
+ if ( attrs . groupBy !== undefined ) { choicesAttrsHtml += ' group-by="' + attrs . groupBy + '"' ; }
1599
1601
}
1600
1602
1601
1603
return compileTemplate (
1602
1604
'<ui-select multiple ng-model="selection.selectedMultiple"' + attrsHtml + ' theme="bootstrap" style="width: 800px;"> \
1603
1605
<ui-select-match placeholder="Pick one...">{{$item.name}} <{{$item.email}}></ui-select-match> \
1604
- <ui-select-choices repeat="person in people | filter: $select.search"> \
1606
+ <ui-select-choices repeat="person in people | filter: $select.search"' + choicesAttrsHtml + ' > \
1605
1607
<div ng-bind-html="person.name | highlight: $select.search"></div> \
1606
1608
<div ng-bind-html="person.email | highlight: $select.search"></div> \
1607
1609
</ui-select-choices> \
@@ -2257,6 +2259,24 @@ describe('ui-select tests', function() {
2257
2259
expect ( el . find ( '.ui-select-choices-row-inner' ) . size ( ) ) . toBe ( 0 ) ;
2258
2260
} ) ;
2259
2261
2262
+ it ( 'should allow creating tag in multi select mode with tagging and group-by enabled' , function ( ) {
2263
+ scope . taggingFunc = function ( name ) {
2264
+ return {
2265
+ name : name ,
2266
+ email : name + '@email.com' ,
2267
+ group : 'Foo' ,
2268
+ age : 12
2269
+ } ;
2270
+ } ;
2271
+
2272
+ var el = createUiSelectMultiple ( { tagging : 'taggingFunc' , groupBy : "'age'" } ) ;
2273
+
2274
+ showChoicesForSearch ( el , 'amal' ) ;
2275
+ expect ( el . find ( '.ui-select-choices-row-inner' ) . size ( ) ) . toBe ( 2 ) ;
2276
+ expect ( el . scope ( ) . $select . items [ 0 ] ) . toEqual ( jasmine . objectContaining ( { name : 'amal' , email : 'amal@email.com' , isTag : true } ) ) ;
2277
+ expect ( el . scope ( ) . $select . items [ 1 ] ) . toEqual ( jasmine . objectContaining ( { name : 'Amalie' , email : 'amalie@email.com' } ) ) ;
2278
+ } ) ;
2279
+
2260
2280
it ( 'should allow paste tag from clipboard' , function ( ) {
2261
2281
scope . taggingFunc = function ( name ) {
2262
2282
return {
0 commit comments