mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Intial move to ES2015
This commit is contained in:
parent
b0944bdff8
commit
353dfa62fd
46 changed files with 16839 additions and 18742 deletions
|
@ -9,7 +9,7 @@ describe('Core', function() {
|
|||
|
||||
describe('Url', function () {
|
||||
|
||||
var Url = require('../src/core').Url;
|
||||
var Url = require('../src/utils/url');
|
||||
|
||||
it("Url()", function() {
|
||||
var url = new Url("http://example.com/fred/chasen/derf.html");
|
||||
|
@ -61,7 +61,7 @@ describe('Core', function() {
|
|||
|
||||
describe('Path', function () {
|
||||
|
||||
var Path = require('../src/core').Path;
|
||||
var Path = require('../src/utils/path');
|
||||
|
||||
it("Path()", function() {
|
||||
var path = new Path("/fred/chasen/derf.html");
|
||||
|
|
|
@ -8,13 +8,13 @@ describe('EpubCFI', function() {
|
|||
var EpubCFI = require('../src/epubcfi.js');
|
||||
|
||||
it('parse a cfi on init', function() {
|
||||
var cfi = EpubCFI("epubcfi(/6/2[cover]!/6)");
|
||||
var cfi = new EpubCFI("epubcfi(/6/2[cover]!/6)");
|
||||
|
||||
assert.equal( cfi.spinePos, 0, "spinePos is parsed as the first item" );
|
||||
});
|
||||
|
||||
it('parse a cfi and ignore the base if present', function() {
|
||||
var cfi = EpubCFI("epubcfi(/6/2[cover]!/6)", "/6/6[end]");
|
||||
var cfi = new EpubCFI("epubcfi(/6/2[cover]!/6)", "/6/6[end]");
|
||||
|
||||
assert.equal( cfi.spinePos, 0, "base is ignored and spinePos is parsed as the first item" );
|
||||
});
|
||||
|
@ -56,9 +56,9 @@ describe('EpubCFI', function() {
|
|||
describe('#toString()', function() {
|
||||
it('parse a cfi and write it back', function() {
|
||||
|
||||
assert.equal(EpubCFI("epubcfi(/6/2[cover]!/6)").toString(), "epubcfi(/6/2[cover]!/6)", "output cfi string is same as input" );
|
||||
assert.equal(EpubCFI("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)").toString(), "epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)", "output cfi string is same as input" );
|
||||
assert.equal(EpubCFI("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)").toString(), "epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)", "output cfi string is same as input" );
|
||||
assert.equal(new EpubCFI("epubcfi(/6/2[cover]!/6)").toString(), "epubcfi(/6/2[cover]!/6)", "output cfi string is same as input" );
|
||||
assert.equal(new EpubCFI("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)").toString(), "epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)", "output cfi string is same as input" );
|
||||
assert.equal(new EpubCFI("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)").toString(), "epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)", "output cfi string is same as input" );
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -73,7 +73,7 @@ describe('EpubCFI', function() {
|
|||
});
|
||||
|
||||
it('determine the type of a cfi', function() {
|
||||
var ogcfi = EpubCFI("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)");
|
||||
var ogcfi = new EpubCFI("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)");
|
||||
var cfi = new EpubCFI();
|
||||
|
||||
assert.equal( cfi.checkType(ogcfi), 'EpubCFI' );
|
||||
|
|
|
@ -2,12 +2,10 @@ var assert = require('assert');
|
|||
|
||||
describe('Locations', function() {
|
||||
var Locations = require('../src/locations');
|
||||
var core = require('../src/core');
|
||||
var chapter = require('raw-loader!./fixtures/locations.xhtml');
|
||||
var core = require('../src/utils/core');
|
||||
|
||||
describe('#parse', function() {
|
||||
var Locations = require('../src/locations');
|
||||
var core = require('../src/core');
|
||||
var chapter = require('raw-loader!./fixtures/locations.xhtml');
|
||||
|
||||
it('parse locations from a document', function() {
|
||||
|
@ -25,7 +23,6 @@ describe('Locations', function() {
|
|||
|
||||
var locations = new Locations();
|
||||
var result = locations.parse(contents, "/6/4[chap01ref]", 100);
|
||||
console.log(result);
|
||||
assert.equal(result.length, 15);
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue