Skip to content

Commit 919d3d1

Browse files
committed
Testcase: search AutoScroll
1 parent 7c7e47a commit 919d3d1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test/search/autoscroll.spec.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
describe('Autoscroll', function () {
2+
var expect = window.expect;
3+
4+
before(function(){
5+
fixture.setBase('mock');
6+
var searchTest = fixture.load('searchTestResponse.json');
7+
//setup document to hold search results
8+
document.body.innerHTML = __html__['index.html'];
9+
10+
window.config.isAutoScroll = true;
11+
window.config.isPagination = false;
12+
window.config.isClickNScroll = false;
13+
14+
//initialize search
15+
window.searchobj = new window.Unbxd.setSearch(window.config);
16+
17+
//stub search ajax call with mock response
18+
this.stub = sinon.stub(jQuery, 'ajax').yieldsTo('success',searchTest);
19+
});
20+
21+
after(function(){
22+
this.stub.restore();
23+
});
24+
25+
beforeEach(function(){
26+
//reset filters applied
27+
window.searchobj.clearFilters(true);
28+
window.searchobj.callResults(window.searchobj.paintResultSet);
29+
});
30+
31+
it('Should load Next page on scroll trigger', function(){
32+
var beforeAtPage = window.searchobj.getPage();
33+
var AfterAtPage;
34+
jQuery(window).trigger('scroll');
35+
// expect(this.spyOnPageLoad.called).to.be.true;
36+
AfterAtPage = window.searchobj.getPage();
37+
expect(beforeAtPage + 1).to.be.equal(AfterAtPage);
38+
});
39+
});

0 commit comments

Comments
 (0)