@@ -944,6 +944,36 @@ describe('ngOptions', function() {
944
944
} ) ;
945
945
946
946
947
+ it ( 'should place non-grouped items in the list where they appear' , function ( ) {
948
+ createSelect ( {
949
+ 'ng-model' : 'selected' ,
950
+ 'ng-options' : 'item.name group by item.group for item in values'
951
+ } ) ;
952
+
953
+ scope . $apply ( function ( ) {
954
+ scope . values = [ { name : 'A' } ,
955
+ { name : 'B' , group : 'first' } ,
956
+ { name : 'C' , group : 'second' } ,
957
+ { name : 'D' } ,
958
+ { name : 'E' , group : 'first' } ,
959
+ { name : 'F' } ,
960
+ { name : 'G' } ,
961
+ { name : 'H' , group : 'second' } ] ;
962
+ scope . selected = scope . values [ 0 ] ;
963
+ } ) ;
964
+
965
+ var children = element . children ( ) ;
966
+ expect ( children . length ) . toEqual ( 6 ) ;
967
+
968
+ expect ( nodeName_ ( children [ 0 ] ) ) . toEqual ( 'option' ) ;
969
+ expect ( nodeName_ ( children [ 1 ] ) ) . toEqual ( 'optgroup' ) ;
970
+ expect ( nodeName_ ( children [ 2 ] ) ) . toEqual ( 'optgroup' ) ;
971
+ expect ( nodeName_ ( children [ 3 ] ) ) . toEqual ( 'option' ) ;
972
+ expect ( nodeName_ ( children [ 4 ] ) ) . toEqual ( 'option' ) ;
973
+ expect ( nodeName_ ( children [ 5 ] ) ) . toEqual ( 'option' ) ;
974
+ } ) ;
975
+
976
+
947
977
it ( 'should bind to scope value and track/identify objects' , function ( ) {
948
978
createSelect ( {
949
979
'ng-model' : 'selected' ,
0 commit comments