@@ -7,31 +7,39 @@ $(function () {
77 */
88 QUnit . test ( 'iterateOptions' , function ( assert ) {
99 var output ;
10- function callback ( a , b ) {
11- output . push ( a , b ) ;
10+ function callback ( a , b , c ) {
11+ output . push ( a , b , c ) ;
1212 }
1313
1414 output = [ ] ;
1515 Utils . iterateOptions ( [ 'one' , 'foo' , 'bar' ] , callback ) ;
1616 assert . deepEqual (
1717 output ,
18- [ 'one' , 'one' , 'foo' , 'foo' , 'bar' , 'bar' ] ,
18+ [ 'one' , 'one' , undefined , 'foo' , 'foo' , undefined , 'bar' , 'bar' , undefined ] ,
1919 'Should iterate simple array'
2020 ) ;
2121
2222 output = [ ] ;
2323 Utils . iterateOptions ( { 1 : 'one' , 2 : 'foo' , 3 : 'bar' } , callback ) ;
2424 assert . deepEqual (
2525 output ,
26- [ '1' , 'one' , '2' , 'foo' , '3' , 'bar' ] ,
26+ [ '1' , 'one' , undefined , '2' , 'foo' , undefined , '3' , 'bar' , undefined ] ,
2727 'Should iterate simple hash-map'
2828 ) ;
2929
3030 output = [ ] ;
3131 Utils . iterateOptions ( [ { 1 : 'one' } , { 2 : 'foo' } , { 3 : 'bar' } ] , callback ) ;
3232 assert . deepEqual (
3333 output ,
34- [ '1' , 'one' , '2' , 'foo' , '3' , 'bar' ] ,
34+ [ '1' , 'one' , undefined , '2' , 'foo' , undefined , '3' , 'bar' , undefined ] ,
35+ 'Should iterate array of one element hash-maps'
36+ ) ;
37+
38+ output = [ ] ;
39+ Utils . iterateOptions ( [ { value : 1 , label : 'one' , optgroup : 'group' } , { value : 2 , label : 'foo' } , { value : 3 , label : 'bar' , optgroup : 'group' } ] , callback ) ;
40+ assert . deepEqual (
41+ output ,
42+ [ 1 , 'one' , 'group' , 2 , 'foo' , undefined , 3 , 'bar' , 'group' ] ,
3543 'Should iterate array of hash-maps'
3644 ) ;
3745 } ) ;
0 commit comments