aboutsummaryrefslogtreecommitdiff
path: root/tests/mammoth.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-01-25 17:17:34 +0000
committerMichael Williamson <mike@zwobble.org>2015-01-25 17:17:34 +0000
commit52c4d01e4a0e35738e8c1db35a5a4a7ab981803d (patch)
tree0cce833e77942311d25a7c92828d7f5802be14b5 /tests/mammoth.tests.js
parent2de4641bed73f04d0c1ac345e132c1a79fc48f14 (diff)
Use prefix to generate IDs
Diffstat (limited to 'tests/mammoth.tests.js')
-rw-r--r--tests/mammoth.tests.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index 48ce680..985dd99 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -150,14 +150,14 @@ describe('mammoth', function() {
// TODO: don't duplicate footnotes with multiple references
var docxPath = path.join(__dirname, "test-data/footnotes.docx");
var options = {
- generateUniquifier: function() { return 42; }
+ idPrefix: "doc-42"
};
return mammoth.convertToHtml({path: docxPath}, options).then(function(result) {
var expectedOutput = '<p>Ouch' +
- '<sup><a href="#footnote-42-1" id="footnote-ref-42-1">[1]</a></sup>.' +
- '<sup><a href="#footnote-42-2" id="footnote-ref-42-2">[2]</a></sup></p>' +
- '<ol><li id="footnote-42-1"><p> A tachyon walks into a bar. <a href="#footnote-ref-42-1">↑</a></p></li>' +
- '<li id="footnote-42-2"><p> Fin. <a href="#footnote-ref-42-2">↑</a></p></li></ol>';
+ '<sup><a href="#doc-42-footnote-1" id="doc-42-footnote-ref-1">[1]</a></sup>.' +
+ '<sup><a href="#doc-42-footnote-2" id="doc-42-footnote-ref-2">[2]</a></sup></p>' +
+ '<ol><li id="doc-42-footnote-1"><p> A tachyon walks into a bar. <a href="#doc-42-footnote-ref-1">↑</a></p></li>' +
+ '<li id="doc-42-footnote-2"><p> Fin. <a href="#doc-42-footnote-ref-2">↑</a></p></li></ol>';
assert.equal(result.value, expectedOutput);
assert.deepEqual(result.messages, []);
});
@@ -166,14 +166,14 @@ describe('mammoth', function() {
test('endnotes are appended to text', function() {
var docxPath = path.join(__dirname, "test-data/endnotes.docx");
var options = {
- generateUniquifier: function() { return 42; }
+ idPrefix: "doc-42"
};
return mammoth.convertToHtml({path: docxPath}, options).then(function(result) {
var expectedOutput = '<p>Ouch' +
- '<sup><a href="#endnote-42-2" id="endnote-ref-42-2">[1]</a></sup>.' +
- '<sup><a href="#endnote-42-3" id="endnote-ref-42-3">[2]</a></sup></p>' +
- '<ol><li id="endnote-42-2"><p> A tachyon walks into a bar. <a href="#endnote-ref-42-2">↑</a></p></li>' +
- '<li id="endnote-42-3"><p> Fin. <a href="#endnote-ref-42-3">↑</a></p></li></ol>';
+ '<sup><a href="#doc-42-endnote-2" id="doc-42-endnote-ref-2">[1]</a></sup>.' +
+ '<sup><a href="#doc-42-endnote-3" id="doc-42-endnote-ref-3">[2]</a></sup></p>' +
+ '<ol><li id="doc-42-endnote-2"><p> A tachyon walks into a bar. <a href="#doc-42-endnote-ref-2">↑</a></p></li>' +
+ '<li id="doc-42-endnote-3"><p> Fin. <a href="#doc-42-endnote-ref-3">↑</a></p></li></ol>';
assert.equal(result.value, expectedOutput);
assert.deepEqual(result.messages, []);
});