diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:38:17 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-08 20:38:35 +0100 |
| commit | 7fca95f97fc56e043a4ac65b1f1187a340ffbce8 (patch) | |
| tree | e3647c1b4a90b16d5c7aeabaf7fa1e13a6b0e72a | |
| parent | 2d74506d84e32c873a8fa34d0ab3ddaf6edc7ed1 (diff) | |
Default styleName to null
| -rw-r--r-- | lib/documents.js | 4 | ||||
| -rw-r--r-- | tests/document-xml-reader.tests.js | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/documents.js b/lib/documents.js index f1ce08b..986cd9c 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -10,7 +10,7 @@ function Paragraph(children, properties) { return { type: "paragraph", children: children, - styleName: properties.styleName + styleName: properties.styleName || null }; } @@ -19,7 +19,7 @@ function Run(children, properties) { return { type: "run", children: children, - styleName: properties.styleName, + styleName: properties.styleName || null, isBold: properties.isBold, isItalic: properties.isItalic }; diff --git a/tests/document-xml-reader.tests.js b/tests/document-xml-reader.tests.js index 9152c01..670a0d7 100644 --- a/tests/document-xml-reader.tests.js +++ b/tests/document-xml-reader.tests.js @@ -22,7 +22,7 @@ describe("readXmlElement: ", function() { test("paragraph has no style if it has no properties", function() { var paragraphXml = new XmlElement("w:p", {}, []); var paragraph = readXmlElementValue(paragraphXml); - assert.deepEqual(paragraph.styleName, undefined); + assert.deepEqual(paragraph.styleName, null); }); test("paragraph has style name read from paragraph properties if present", function() { @@ -36,14 +36,14 @@ describe("readXmlElement: ", function() { test("run has no style if it has no properties", function() { var runXml = runWithProperties([]); var run = readXmlElementValue(runXml); - assert.equal(run.styleName, undefined); + assert.deepEqual(run.styleName, null); }); test("run has style name read from run properties if present", function() { var runStyleXml = new XmlElement("w:rStyle", {"w:val": "Emphasis"}); var runXml = runWithProperties([runStyleXml]); var run = readXmlElementValue(runXml); - assert.equal(run.styleName, "Emphasis"); + assert.deepEqual(run.styleName, "Emphasis"); }); test("isBold is false if bold element is not present", function() { |
