File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -74,21 +74,20 @@ describe('uiScroll', function () {
74
74
describe ( 'basic setup (new datasource get signature)' , function ( ) {
75
75
var scrollSettings = { datasource : 'myNewEmptyDatasource' } ;
76
76
77
- return ;
78
77
// this does not work because spy always return 0 for the number of parameters (spy.length)
79
78
it ( 'should call get on the datasource 2 times ' , function ( ) {
80
79
var spy ;
81
80
inject ( function ( myNewEmptyDatasource ) {
82
- spy = spyOn ( myNewEmptyDatasource , 'get ' ) . and . callThrough ( ) ;
81
+ spy = spyOn ( myNewEmptyDatasource , 'actualGet ' ) . and . callThrough ( ) ;
83
82
} ) ;
84
83
runTest ( scrollSettings ,
85
84
function ( ) {
86
85
expect ( spy . calls . all ( ) . length ) . toBe ( 2 ) ;
87
86
expect ( spy . calls . all ( ) [ 0 ] . args . length ) . toBe ( 2 ) ;
88
87
expect ( spy . calls . all ( ) [ 0 ] . args [ 0 ] . index ) . toBe ( 1 ) ;
89
88
expect ( spy . calls . all ( ) [ 0 ] . args [ 0 ] . count ) . toBe ( 10 ) ;
90
- expect ( spy . calls . all ( ) [ 0 ] . args . length ) . toBe ( 2 ) ;
91
- expect ( spy . calls . all ( ) [ 1 ] . args [ 0 ] ) . index . toBe ( - 9 ) ;
89
+ expect ( spy . calls . all ( ) [ 1 ] . args . length ) . toBe ( 2 ) ;
90
+ expect ( spy . calls . all ( ) [ 1 ] . args [ 0 ] . index ) . toBe ( - 9 ) ;
92
91
expect ( spy . calls . all ( ) [ 1 ] . args [ 0 ] . count ) . toBe ( 10 ) ;
93
92
}
94
93
) ;
Original file line number Diff line number Diff line change @@ -12,11 +12,20 @@ angular.module('ui.scroll.test.datasources', [])
12
12
13
13
. factory ( 'myNewEmptyDatasource' , [
14
14
'$log' , '$timeout' , '$rootScope' , function ( ) {
15
- return {
15
+
16
+ // another layer of indirection introduced by the actualGet
17
+ // is a workaround for the jasmine issue #1007 https://github.com/jasmine/jasmine/issues/1007
18
+ result = {
16
19
get : function ( descriptor , success ) {
20
+ result . actualGet ( descriptor , success ) ;
21
+ } ,
22
+ actualGet : function ( descriptor , success ) {
17
23
success ( [ ] ) ;
18
24
}
19
25
} ;
26
+
27
+ return result ;
28
+
20
29
}
21
30
] )
22
31
You can’t perform that action at this time.
0 commit comments