diff options
| author | Craig Leinoff <leinoff@un.org> | 2014-01-07 11:51:59 -0500 |
|---|---|---|
| committer | Craig Leinoff <leinoff@un.org> | 2014-01-07 11:51:59 -0500 |
| commit | 3a875e79c03731cb761e040e0647348a8df0a67f (patch) | |
| tree | db157db690b9fb88fa3c51268b1a4f8d4d0c3488 | |
| parent | b688f825e40c4bd20d645a9f145e4e445a4f66f0 (diff) | |
Adding test for style applicator.
| -rw-r--r-- | tests/style-applicator.tests.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/style-applicator.tests.js b/tests/style-applicator.tests.js new file mode 100644 index 0000000..26e00e0 --- /dev/null +++ b/tests/style-applicator.tests.js @@ -0,0 +1,39 @@ +var assert = require("assert");
+
+var StyleApplicator = require("../lib/style-applicator").StyleApplicator;
+var documents = require("../lib/documents");
+
+var testing = require("./testing");
+var test = testing.test;
+var testData = testing.testData;
+
+
+describe("style-applicator", function() {
+ test("can process styleless document with single, center-aligned paragraph", function() {
+ var testOptions = {
+ styleMap: [],
+ styleApplicator: {
+ alignment: true
+ }
+ };
+ var testDocument = documents.Document([
+ documents.Paragraph([
+ documents.Run([
+ documents.Text("Test document with centered paragraph.")
+ ])
+ ], {alignment: 'center'})
+ ]);
+ var expectedDocument = documents.Document([
+ documents.Paragraph([
+ documents.Run([
+ documents.Text("Test document with centered paragraph.")
+ ])
+ ], {styleName: 'centerAligned', alignment: 'center'})
+ ]);
+
+ var styleApplicator = new StyleApplicator(testOptions);
+ return styleApplicator.processDocumentStyles(testDocument).then(function(result) {
+ assert.deepEqual(expectedDocument, result);
+ });
+ });
+});
\ No newline at end of file |
