diff options
Diffstat (limited to 'test/docx/document-matchers.js')
| -rw-r--r-- | test/docx/document-matchers.js | 27 |
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)); +} |
