@@ -60,7 +60,6 @@ describe('ui-select tests', function() {
60
60
return person . age % 2 ? 'even' : 'odd' ;
61
61
} ;
62
62
63
-
64
63
scope . filterInvertOrder = function ( groups ) {
65
64
debugger ;
66
65
var results = groups . sort ( function ( groupA , groupB ) {
@@ -69,12 +68,6 @@ describe('ui-select tests', function() {
69
68
return results ;
70
69
} ;
71
70
72
- scope . filterBarAndBaz = function ( groups ) {
73
- debugger ;
74
- return groups . sort ( function ( groupA , groupB ) {
75
- return groupA . name . toLocaleLowerCase ( ) < groupB . name . toLocaleLowerCase ( ) ;
76
- } ) ;
77
- } ;
78
71
79
72
scope . people = [
80
73
{ name : 'Adam' , email : 'adam@email.com' , group : 'Foo' , age : 12 } ,
@@ -699,6 +692,25 @@ describe('ui-select tests', function() {
699
692
} ) ;
700
693
} ) ;
701
694
695
+ describe ( 'choices group by function' , function ( ) {
696
+ function createUiSelect ( ) {
697
+ return compileTemplate (
698
+ '<ui-select ng-model="selection.selected"> \
699
+ <ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
700
+ <ui-select-choices group-by="getGroupLabel" repeat="person in people | filter: $select.search"> \
701
+ <div ng-bind-html="person.name | highlight: $select.search"></div> \
702
+ </ui-select-choices> \
703
+ </ui-select>'
704
+ ) ;
705
+ }
706
+ it ( "should extract group value through function" , function ( ) {
707
+ var el = createUiSelect ( ) ;
708
+ expect ( el . find ( '.ui-select-choices-group .ui-select-choices-group-label' ) . map ( function ( ) {
709
+ return this . textContent ;
710
+ } ) . toArray ( ) ) . toEqual ( [ 'odd' , 'even' ] ) ;
711
+ } ) ;
712
+ } ) ;
713
+
702
714
describe ( 'choices group filter function' , function ( ) {
703
715
function createUiSelect ( ) {
704
716
return compileTemplate ( '\
0 commit comments