Skip to content

Commit ae3dd2c

Browse files
committed
🐞 do not proceed if no getPath
Ref #691 βœ… bad path test
1 parent 46ba683 commit ae3dd2c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

β€Žjs/core.jsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ proto.create = function() {
9292
// bail if getPath not set
9393
if ( !this.getPath ) {
9494
console.error('Disabling InfiniteScroll');
95+
return;
9596
}
9697
this.updateGetAbsolutePath();
9798
this.log( 'initialized', [ this.element.className ] );

β€Žtest/unit/path.jsβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,13 @@ QUnit.test( 'path', function( assert ) {
3333
'path option set with selector string' );
3434
infScroll.destroy();
3535

36+
// path: bad
37+
infScroll = new InfiniteScroll( '.demo--path', {
38+
path: '.bad-path',
39+
scrollThreshold: false,
40+
history: false,
41+
});
42+
assert.ok( true, 'bad path does not throw error' );
43+
infScroll.destroy();
44+
3645
});

0 commit comments

Comments
Β (0)