diff options
| -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 |
