summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-05-20 15:25:18 +0100
committerMichael Williamson <mike@zwobble.org>2017-05-20 15:25:18 +0100
commit9a4da2889ceaaed5351e4bb50d9f1660c5e3ee27 (patch)
tree4fcc18bad50b14751d0fb162879f6cd92d200635
parent76dbec2efb57f87118069427158c15f7bb59c82d (diff)
Move isTable and isRow into matchers module
-rw-r--r--test/docx/body-reader.tests.js10
-rw-r--r--test/docx/document-matchers.js10
2 files changed, 12 insertions, 8 deletions
diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js
index aaac22d..1eb229f 100644
--- a/test/docx/body-reader.tests.js
+++ b/test/docx/body-reader.tests.js
@@ -16,6 +16,8 @@ var isEmptyRun = documentMatchers.isEmptyRun;
var isHyperlink = documentMatchers.isHyperlink;
var isRun = documentMatchers.isRun;
var isText = documentMatchers.isText;
+var isTable = documentMatchers.isTable;
+var isRow = documentMatchers.isRow;
var createBodyReader = require("../../lib/docx/body-reader").createBodyReader;
var _readNumberingProperties = require("../../lib/docx/body-reader")._readNumberingProperties;
@@ -666,14 +668,6 @@ function docEmptyCell(properties) {
return new documents.TableCell([], properties);
}
-function isTable(options) {
- return hasProperties(_.extend({type: documents.types.table}, options));
-}
-
-function isRow(options) {
- return hasProperties(_.extend({type: documents.types.tableRow}, options));
-}
-
test("w:bookmarkStart is read as a bookmarkStart", function() {
var bookmarkStart = new XmlElement("w:bookmarkStart", {"w:name": "_Peter", "w:id": "42"});
var result = readXmlElement(bookmarkStart);
diff --git a/test/docx/document-matchers.js b/test/docx/document-matchers.js
index b750bed..83c4486 100644
--- a/test/docx/document-matchers.js
+++ b/test/docx/document-matchers.js
@@ -8,6 +8,8 @@ exports.isEmptyRun = isRun({children: []});
exports.isRun = isRun;
exports.isText = isText;
exports.isHyperlink = isHyperlink;
+exports.isTable = isTable;
+exports.isRow = isRow;
function isRun(properties) {
@@ -22,6 +24,14 @@ function isHyperlink(properties) {
return isDocumentElement(documents.types.hyperlink, properties);
}
+function isTable(options) {
+ return isDocumentElement(documents.types.table, options);
+}
+
+function isRow(options) {
+ return isDocumentElement(documents.types.tableRow, options);
+}
+
function isDocumentElement(type, properties) {
return hamjest.hasProperties(_.extend({type: hamjest.equalTo(type)}, properties));
}