mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Intial move to ES2015
This commit is contained in:
parent
b0944bdff8
commit
353dfa62fd
46 changed files with 16839 additions and 18742 deletions
|
@ -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' );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue