aboutsummaryrefslogtreecommitdiff
path: root/tests/document-xml-reader.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-04-08 20:24:01 +0100
committerMichael Williamson <mike@zwobble.org>2013-04-08 20:24:01 +0100
commitc21137ab994f5bdacf70dbfb3a6dc703afc6faee (patch)
treef1e32057be98c814740b6c9a915f19219c681d44 /tests/document-xml-reader.tests.js
parent2f72e903f5f8bb7ac00c69778be4cb199017617d (diff)
Add a couple of tests for paragraph styles to document-xml-reader.tests.js
Diffstat (limited to 'tests/document-xml-reader.tests.js')
-rw-r--r--tests/document-xml-reader.tests.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/document-xml-reader.tests.js b/tests/document-xml-reader.tests.js
index 2f406f8..a45ea29 100644
--- a/tests/document-xml-reader.tests.js
+++ b/tests/document-xml-reader.tests.js
@@ -12,7 +12,21 @@ function readXmlElement(element) {
return new DocumentXmlReader({}).readXmlElement(element);
}
-describe("readElement", function() {
+describe("readXmlElement: ", function() {
+ test("paragraph has no style if it has no properties", function() {
+ var paragraphXml = new XmlElement("w:p", {}, []);
+ var result = readXmlElement(paragraphXml);
+ assert.deepEqual(result.value.properties.styleName, undefined);
+ });
+
+ test("paragraph has style name read from paragraph properties if present", function() {
+ var styleXml = new XmlElement("w:pStyle", {"w:val": "Heading1"}, []);
+ var propertiesXml = new XmlElement("w:pPr", {}, [styleXml]);
+ var paragraphXml = new XmlElement("w:p", {}, [propertiesXml]);
+ var result = readXmlElement(paragraphXml);
+ assert.deepEqual(result.value.properties.styleName, "Heading1");
+ });
+
test("reads styles from run properties", function() {
var runStyleXml = new XmlElement("w:rStyle", {"w:val": "Emphasis"});
var runPropertiesXml = createRunPropertiesXml([runStyleXml]);