File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -44,4 +44,24 @@ describe("IAS", function () {
44
44
45
45
return deferred . promise ;
46
46
} ) ;
47
+
48
+ it ( "callbacks should be called when render returns false" , function ( ) {
49
+ var deferred = when . defer ( ) ;
50
+ var spy1 = this . spy ( ) ;
51
+
52
+ jQuery . ias ( ) . on ( 'render' , function ( ) { spy1 ( ) ; return false ; } ) ;
53
+ // If the user uses their own render function (which returns false), then IAS
54
+ // doesn't call other render callbacks such as the one that sets the next URL
55
+ // This is tested by adding our own render callback and then adding checks to
56
+ // confirm the render callback actually did run and the nextUrl has been updated.
57
+ scrollDown ( ) . then ( function ( ) {
58
+ wait ( 2000 ) . then ( function ( ) {
59
+ expect ( spy1 ) . toHaveBeenCalledOnce ( ) ;
60
+ buster . assert . contains ( jQuery . ias ( ) . nextUrl , "page3.html" ) ;
61
+
62
+ deferred . resolve ( ) ;
63
+ } )
64
+ } )
65
+ return deferred . promise ;
66
+ } ) ;
47
67
} ) ;
You can’t perform that action at this time.
0 commit comments