File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments