summaryrefslogtreecommitdiff
path: root/lib/epub.js/test/locations.js
blob: 64288eb29bb8247107b3f3659bdf281281cbfaf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);

		});

	});

});