aboutsummaryrefslogtreecommitdiff
path: root/test/docx/document-matchers.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-02-19 11:08:06 +0000
committerGitHub <noreply@github.com>2017-02-19 11:08:06 +0000
commit2e0d6e07bb8d9ccbd53270a450bd9ee5145f845b (patch)
tree407ef0c07a0d6d567a16f6cc682915b2ee251289 /test/docx/document-matchers.js
parent15f4381cf54901895836551a30f66c0cee974a0c (diff)
parentf89115c9817b4cd4da91c7e3e9882b0eac4ae40d (diff)
Merge pull request #110 from jdlehman/instrText-hyperlinks
Enable hyperlinks that are not defined with w:hyperlink
Diffstat (limited to 'test/docx/document-matchers.js')
-rw-r--r--test/docx/document-matchers.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/docx/document-matchers.js b/test/docx/document-matchers.js
new file mode 100644
index 0000000..b750bed
--- /dev/null
+++ b/test/docx/document-matchers.js
@@ -0,0 +1,27 @@
+var hamjest = require("hamjest");
+var _ = require("underscore");
+
+var documents = require("../../lib/documents");
+
+
+exports.isEmptyRun = isRun({children: []});
+exports.isRun = isRun;
+exports.isText = isText;
+exports.isHyperlink = isHyperlink;
+
+
+function isRun(properties) {
+ return isDocumentElement(documents.types.run, properties);
+}
+
+function isText(text) {
+ return isDocumentElement(documents.types.text, {value: text});
+}
+
+function isHyperlink(properties) {
+ return isDocumentElement(documents.types.hyperlink, properties);
+}
+
+function isDocumentElement(type, properties) {
+ return hamjest.hasProperties(_.extend({type: hamjest.equalTo(type)}, properties));
+}