@@ -52,7 +52,7 @@ describe('uiScroll', function () {
52
52
) ;
53
53
} ) ;
54
54
55
- it ( 'should call get on the datasource 1 time ' , function ( ) {
55
+ it ( 'should call get on the datasource 2 times ' , function ( ) {
56
56
var spy ;
57
57
inject ( function ( myEmptyDatasource ) {
58
58
spy = spyOn ( myEmptyDatasource , 'get' ) . and . callThrough ( ) ;
@@ -74,7 +74,6 @@ describe('uiScroll', function () {
74
74
describe ( 'basic setup (new datasource get signature)' , function ( ) {
75
75
var scrollSettings = { datasource : 'myNewEmptyDatasource' } ;
76
76
77
- // this does not work because spy always return 0 for the number of parameters (spy.length)
78
77
it ( 'should call get on the datasource 2 times ' , function ( ) {
79
78
var spy ;
80
79
inject ( function ( myNewEmptyDatasource ) {
@@ -86,9 +85,15 @@ describe('uiScroll', function () {
86
85
expect ( spy . calls . all ( ) [ 0 ] . args . length ) . toBe ( 2 ) ;
87
86
expect ( spy . calls . all ( ) [ 0 ] . args [ 0 ] . index ) . toBe ( 1 ) ;
88
87
expect ( spy . calls . all ( ) [ 0 ] . args [ 0 ] . count ) . toBe ( 10 ) ;
88
+ expect ( 'append' in spy . calls . all ( ) [ 0 ] . args [ 0 ] ) . toBe ( true ) ;
89
+ expect ( spy . calls . all ( ) [ 0 ] . args [ 0 ] . append ) . toBeUndefined ( ) ;
90
+ expect ( 'prepend' in spy . calls . all ( ) [ 0 ] . args [ 0 ] ) . toBe ( false ) ;
89
91
expect ( spy . calls . all ( ) [ 1 ] . args . length ) . toBe ( 2 ) ;
90
92
expect ( spy . calls . all ( ) [ 1 ] . args [ 0 ] . index ) . toBe ( - 9 ) ;
91
93
expect ( spy . calls . all ( ) [ 1 ] . args [ 0 ] . count ) . toBe ( 10 ) ;
94
+ expect ( 'append' in spy . calls . all ( ) [ 1 ] . args [ 0 ] ) . toBe ( false ) ;
95
+ expect ( 'prepend' in spy . calls . all ( ) [ 1 ] . args [ 0 ] ) . toBe ( true ) ;
96
+ expect ( spy . calls . all ( ) [ 1 ] . args [ 0 ] . prepend ) . toBeUndefined ( ) ;
92
97
}
93
98
) ;
94
99
} ) ;
0 commit comments