Skip to content

Commit dae1879

Browse files
author
Brian Thompson
committed
Add test to make sure the render callback is called, even if a custom render callback returned false to not execute IAS default render code.
1 parent 96c576b commit dae1879

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/04-paging-extension-test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,24 @@ describe("IAS", function () {
4444

4545
return deferred.promise;
4646
});
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+
});
4767
});

0 commit comments

Comments
 (0)