summaryrefslogtreecommitdiff
path: root/lib/epub.js/test/locations.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-09-17 21:53:37 +0300
committerAndrew Dolgov <[email protected]>2021-09-17 21:53:37 +0300
commit4fd9b8f2b5a98bfcde57970b48fed2488a80f356 (patch)
tree51e0ce9cd61c24916b7d5820ee69e74bd3e76aac /lib/epub.js/test/locations.js
parentd0cd10f08286be33306336fe8c4cac26ea7ce637 (diff)
add in master snapshot of epubjs
Diffstat (limited to 'lib/epub.js/test/locations.js')
-rw-r--r--lib/epub.js/test/locations.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/epub.js/test/locations.js b/lib/epub.js/test/locations.js
new file mode 100644
index 0000000..64288eb
--- /dev/null
+++ b/lib/epub.js/test/locations.js
@@ -0,0 +1,31 @@
+import assert from 'assert';
+import Locations from '../src/locations';
+import * as core from '../src/utils/core';
+
+describe('Locations', function() {
+
+ describe('#parse', function() {
+ var chapter = require('./fixtures/locations.xhtml').default;
+
+ it('parse locations from a document', function() {
+ var doc = core.parse(chapter, "application/xhtml+xml");
+ var contents = doc.documentElement;
+ var locations = new Locations();
+ var result = locations.parse(contents, "/6/4[chap01ref]", 100);
+ assert.equal(result.length, 15);
+
+ });
+
+ it('parse locations from xmldom', function() {
+ var doc = core.parse(chapter, "application/xhtml+xml", true);
+ var contents = doc.documentElement;
+
+ var locations = new Locations();
+ var result = locations.parse(contents, "/6/4[chap01ref]", 100);
+ assert.equal(result.length, 15);
+
+ });
+
+ });
+
+});