mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Added webpack build, karma test runner, travis config
This commit is contained in:
parent
5c49e4f4b6
commit
5e6c268e83
63 changed files with 15811 additions and 12986 deletions
31
test/epub.js
31
test/epub.js
|
@ -1,14 +1,16 @@
|
|||
var assert = require('assert');
|
||||
var sinon = require('sinon');
|
||||
var fs = require('fs');
|
||||
// var sinon = require('sinon');
|
||||
|
||||
|
||||
describe('ePub', function() {
|
||||
var ePub = require('../src/epub');
|
||||
var server;
|
||||
before(function(){
|
||||
var packageContents = fs.readFileSync(__dirname + '/../books/moby-dick/OPS/package.opf', 'utf8');
|
||||
var tocContents = fs.readFileSync(__dirname + '/../books/moby-dick/OPS/toc.xhtml', 'utf8');
|
||||
/*
|
||||
// var packageContents = fs.readFileSync(__dirname + '/../books/moby-dick/OPS/package.opf', 'utf8');
|
||||
// var tocContents = fs.readFileSync(__dirname + '/../books/moby-dick/OPS/toc.xhtml', 'utf8');
|
||||
var packageContents = require('raw!./fixtures/moby-dick/OPS/package.opf');
|
||||
var tocContents = require('raw!./fixtures/moby-dick/OPS/toc.xhtml');
|
||||
|
||||
server = sinon.fakeServer.create();
|
||||
server.autoRespond = true;
|
||||
|
@ -20,20 +22,33 @@ describe('ePub', function() {
|
|||
server.respondWith("moby-dick/OPS/toc.xhtml", [200, {
|
||||
"Content-Type": "application/xhtml+xml"
|
||||
}, tocContents]);
|
||||
|
||||
*/
|
||||
|
||||
});
|
||||
after(function(){
|
||||
server.restore();
|
||||
// server.restore();
|
||||
});
|
||||
|
||||
it('should open a epub', function(done) {
|
||||
var book = ePub("moby-dick/OPS/package.opf");
|
||||
var book = ePub("/fixtures/alice/OPS/package.opf");
|
||||
|
||||
book.opened.then(function(){
|
||||
assert.equal( book.isOpen, true, "book is opened" );
|
||||
assert.equal( book.url, "moby-dick/OPS/package.opf", "book url is passed to new Book" );
|
||||
assert.equal( book.url, "http://localhost:9876/fixtures/alice/OPS/package.opf", "book url is passed to new Book" );
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should open a archived epub', function(done) {
|
||||
var book = ePub("/fixtures/alice.epub");
|
||||
|
||||
assert(typeof (JSZip) !== "undefined", "JSZip is present" );
|
||||
|
||||
book.opened.then(function(){
|
||||
assert.equal( book.isOpen, true, "book is opened" );
|
||||
assert.equal( book.url, "/", "book url is empty as book is archived" );
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue