@@ -14,14 +14,14 @@ describe('ui-select tests', function() {
14
14
} ;
15
15
16
16
scope . people = [
17
- { name :
'Adam' , email :
'[email protected] ' , age :
12 } ,
18
- { name :
'Amalie' , email :
'[email protected] ' , age :
12 } ,
19
- { name :
'Estefanía' , email :
'estefaní[email protected] ' , age :
21 } ,
20
- { name :
'Adrian' , email :
'[email protected] ' , age :
21 } ,
21
- { name :
'Wladimir' , email :
'[email protected] ' , age :
30 } ,
22
- { name :
'Samantha' , email :
'[email protected] ' , age :
30 } ,
23
- { name :
'Nicole' , email :
'[email protected] ' , age :
43 } ,
24
- { name :
'Natasha' , email :
'[email protected] ' , age :
54 }
17
+ { name :
'Adam' , email :
'[email protected] ' , group : 'Foo' , age :
12 } ,
18
+ { name :
'Amalie' , email :
'[email protected] ' , group : 'Foo' , age :
12 } ,
19
+ { name :
'Estefanía' , email :
'estefaní[email protected] ' , group : 'Foo' , age :
21 } ,
20
+ { name :
'Adrian' , email :
'[email protected] ' , group : 'Foo' , age :
21 } ,
21
+ { name :
'Wladimir' , email :
'[email protected] ' , group : 'Foo' , age :
30 } ,
22
+ { name :
'Samantha' , email :
'[email protected] ' , group : 'bar' , age :
30 } ,
23
+ { name :
'Nicole' , email :
'[email protected] ' , group : 'bar' , age :
43 } ,
24
+ { name :
'Natasha' , email :
'[email protected] ' , group : 'Baz' , age :
54 }
25
25
] ;
26
26
} ) ) ;
27
27
@@ -201,7 +201,7 @@ describe('ui-select tests', function() {
201
201
return compileTemplate (
202
202
'<ui-select ng-model="selection"> \
203
203
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
204
- <ui-select-choices group-by="\'age \'" repeat="person in people | filter: $select.search"> \
204
+ <ui-select-choices group-by="\'group \'" repeat="person in people | filter: $select.search"> \
205
205
<div ng-bind-html="person.name | highlight: $select.search"></div> \
206
206
<div ng-bind-html="person.email | highlight: $select.search"></div> \
207
207
</ui-select-choices> \
@@ -211,14 +211,14 @@ describe('ui-select tests', function() {
211
211
212
212
it ( 'should create items group' , function ( ) {
213
213
var el = createUiSelect ( ) ;
214
- expect ( el . find ( '.ui-select-choices-group' ) . length ) . toBe ( 5 ) ;
214
+ expect ( el . find ( '.ui-select-choices-group' ) . length ) . toBe ( 3 ) ;
215
215
} ) ;
216
216
217
217
it ( 'should show label before each group' , function ( ) {
218
218
var el = createUiSelect ( ) ;
219
219
expect ( el . find ( '.ui-select-choices-group .ui-select-choices-group-label' ) . map ( function ( ) {
220
220
return this . textContent ;
221
- } ) . toArray ( ) ) . toEqual ( [ '12 ' , '21 ' , '30' , '43' , '54 '] ) ;
221
+ } ) . toArray ( ) ) . toEqual ( [ 'Baz ' , 'Foo ' , 'bar ' ] ) ;
222
222
} ) ;
223
223
224
224
it ( 'should hide empty groups' , function ( ) {
@@ -228,21 +228,21 @@ describe('ui-select tests', function() {
228
228
229
229
expect ( el . find ( '.ui-select-choices-group .ui-select-choices-group-label' ) . map ( function ( ) {
230
230
return this . textContent ;
231
- } ) . toArray ( ) ) . toEqual ( [ '12' , '21' , '30 '] ) ;
231
+ } ) . toArray ( ) ) . toEqual ( [ 'Foo ' ] ) ;
232
232
} ) ;
233
233
234
234
it ( 'should change activeItem through groups' , function ( ) {
235
235
var el = createUiSelect ( ) ;
236
- el . scope ( ) . $select . search = 'd ' ;
236
+ el . scope ( ) . $select . search = 'n ' ;
237
237
scope . $digest ( ) ;
238
238
var choices = el . find ( '.ui-select-choices-row' ) ;
239
239
expect ( choices . eq ( 0 ) ) . toHaveClass ( 'active' ) ;
240
- expect ( getGroupLabel ( choices . eq ( 0 ) ) . text ( ) ) . toBe ( '12 ' ) ;
240
+ expect ( getGroupLabel ( choices . eq ( 0 ) ) . text ( ) ) . toBe ( 'Baz ' ) ;
241
241
242
242
triggerKeydown ( el . find ( 'input' ) , 40 /*Down*/ ) ;
243
243
scope . $digest ( ) ;
244
244
expect ( choices . eq ( 1 ) ) . toHaveClass ( 'active' ) ;
245
- expect ( getGroupLabel ( choices . eq ( 1 ) ) . text ( ) ) . toBe ( '21 ' ) ;
245
+ expect ( getGroupLabel ( choices . eq ( 1 ) ) . text ( ) ) . toBe ( 'Foo ' ) ;
246
246
} ) ;
247
247
} ) ;
248
248
0 commit comments