From 3a875e79c03731cb761e040e0647348a8df0a67f Mon Sep 17 00:00:00 2001 From: Craig Leinoff Date: Tue, 7 Jan 2014 11:51:59 -0500 Subject: Adding test for style applicator. --- tests/style-applicator.tests.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/style-applicator.tests.js (limited to 'tests') 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 -- cgit v1.2.3