mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Add URL polyfill for phantomjs, fix archived test
This commit is contained in:
parent
52da64d723
commit
15b368d912
5 changed files with 11 additions and 5 deletions
|
@ -15,14 +15,18 @@ module.exports = function(config) {
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
// list of files / patterns to load in the browser
|
||||||
files: [
|
files: [
|
||||||
|
|
||||||
|
{pattern: 'src/*.js', watched: true, included: false, served: false},
|
||||||
|
|
||||||
{pattern: 'test/*.js', watched: false},
|
{pattern: 'test/*.js', watched: false},
|
||||||
// {pattern: 'test/**/*.js', watched: false}
|
// {pattern: 'test/**/*.js', watched: false}
|
||||||
{pattern: 'test/fixtures/**/*', watched: false, included: false, served: true},
|
{pattern: 'test/fixtures/**/*', watched: false, included: false, served: true},
|
||||||
|
|
||||||
{pattern: 'node_modules/jszip/dist/jszip.js', watched: false, included: true, served: true},
|
{pattern: 'node_modules/jszip/dist/jszip.js', watched: false, included: true, served: true},
|
||||||
|
|
||||||
{pattern: 'node_modules/es6-promise/dist/es6-promise.auto.js', watched: false, included: true, served: true}
|
{pattern: 'node_modules/es6-promise/dist/es6-promise.auto.js', watched: false, included: true, served: true},
|
||||||
|
|
||||||
|
{pattern: 'node_modules/js-polyfills/url.js', watched: false, included: true, served: true}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -66,7 +70,7 @@ module.exports = function(config) {
|
||||||
|
|
||||||
// level of logging
|
// level of logging
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
logLevel: config.LOG_ERROR,
|
logLevel: config.LOG_DEBUG,
|
||||||
|
|
||||||
|
|
||||||
// enable / disable watching file and executing tests whenever any file changes
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es6-promise": "^4.0.5",
|
"es6-promise": "^4.0.5",
|
||||||
"event-emitter": "^0.3.4",
|
"event-emitter": "^0.3.4",
|
||||||
|
"js-polyfills": "^0.1.27",
|
||||||
"jszip": "^3.1.1",
|
"jszip": "^3.1.1",
|
||||||
"xmldom": "^0.1.22"
|
"xmldom": "^0.1.22"
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ Book.prototype.open = function(_url, options){
|
||||||
|
|
||||||
if(url.origin) {
|
if(url.origin) {
|
||||||
// this.baseUrl = uri.origin() + uri.directory() + "/";
|
// this.baseUrl = uri.origin() + uri.directory() + "/";
|
||||||
this.baseUrl = url.origin + "/" + path.dirname(pathname) + "/";
|
this.baseUrl = url.origin + path.dirname(pathname) + "/";
|
||||||
// } else if(absoluteUri){
|
// } else if(absoluteUri){
|
||||||
// this.baseUrl = absoluteUri.origin();
|
// this.baseUrl = absoluteUri.origin();
|
||||||
// this.baseUrl += absoluteUri.directory() + "/";
|
// this.baseUrl += absoluteUri.directory() + "/";
|
||||||
|
@ -241,6 +241,7 @@ Book.prototype.unpack = function(packageXml){
|
||||||
|
|
||||||
book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
|
book.package.baseUrl = book.baseUrl; // Provides a url base for resolving paths
|
||||||
book.package.basePath = book.basePath; // Provides a url base for resolving paths
|
book.package.basePath = book.basePath; // Provides a url base for resolving paths
|
||||||
|
console.log("book.baseUrl", book.baseUrl );
|
||||||
|
|
||||||
this.spine.load(book.package);
|
this.spine.load(book.package);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ describe('ePub', function() {
|
||||||
|
|
||||||
book.opened.then(function(){
|
book.opened.then(function(){
|
||||||
assert.equal( book.isOpen, true, "book is opened" );
|
assert.equal( book.isOpen, true, "book is opened" );
|
||||||
assert.equal( book.url, "/", "book url is empty as book is archived" );
|
assert.equal( book.url, "", "book url is empty as book is archived" );
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ var port = "8080";
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
epub: "./src/epub.js",
|
epub: "./src/epub.js",
|
||||||
polyfills: ["./node_modules/es6-promise/dist/es6-promise.auto.js"]
|
polyfills: ["./node_modules/es6-promise/dist/es6-promise.auto.js", "./node_modules/js-polyfills/url.js"]
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
output: {
|
output: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue