mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
Bugfix calling coverUrl throws error on book without cover
When calling coverUrl on a book that has no cover a error is thrown > TypeError: Cannot read property 'substr' of undefined This is because Archive.getBlob is called with this.cover which is undefined.
This commit is contained in:
parent
08a069555f
commit
0b0f2e1b2d
3 changed files with 16 additions and 2 deletions
14
test/book.js
14
test/book.js
|
@ -50,4 +50,18 @@ describe('Book', function() {
|
|||
assert( /^blob:http:\/\/localhost:9876\/[^\/]+$/.test(coverUrl), "cover url is available and a blob: url" );
|
||||
});
|
||||
});
|
||||
|
||||
describe('Archived epub without cover', function() {
|
||||
var book = new Book("/fixtures/alice_without_cover.epub");
|
||||
|
||||
it('should open a archived epub', async function() {
|
||||
await book.opened
|
||||
assert.equal(book.isOpen, true, "book is opened");
|
||||
assert(book.archive, "book is unarchived");
|
||||
});
|
||||
it('should have a empty coverUrl', async function() {
|
||||
let coverUrl = await book.coverUrl()
|
||||
assert.equal(coverUrl, undefined, "cover url should be undefined" );
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue