-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π stop prefilling on last or error
π checkLastPage on append β add test for prefilling on error Ref #690
- Loading branch information
Showing
4 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
QUnit.test( 'prefill element last', function( assert ) { | ||
|
||
// expected load count, each post is 200px tall | ||
var expLoadCount = 2; | ||
|
||
var done = assert.async( expLoadCount ); | ||
|
||
var infScroll = new InfiniteScroll( '.demo--prefill-element-last', { | ||
path: function() { | ||
return this.loadCount < 2 ? 'page/prefill.html' : false; | ||
}, | ||
append: '.post', | ||
prefill: true, | ||
elementScroll: true, | ||
history: false, | ||
scrollThreshold: false, | ||
debug: true, | ||
onInit: function() { | ||
this.on( 'append', onAppend ); | ||
this.on( 'error', onError ); | ||
}, | ||
}); | ||
|
||
function onAppend() { | ||
assert.ok( true, 'prefill element appended post ' + infScroll.loadCount ); | ||
if ( infScroll.loadCount == expLoadCount ) { | ||
assert.equal( infScroll.loadCount, expLoadCount, | ||
expLoadCount + ' pages appended' ); | ||
} | ||
done(); | ||
} | ||
|
||
function onError() { | ||
assert.ok( false, 'error should not trigger' ); | ||
} | ||
|
||
}); |