aboutsummaryrefslogtreecommitdiff
path: root/test/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-11-03 15:54:07 +0000
committerMichael Williamson <mike@zwobble.org>2017-11-03 15:54:07 +0000
commitb6514e40cf8a8a84ca7d341465b3e9fe439be24f (patch)
tree44bfdfd19dec3cddb62ca4760d4d5b11a39cf4d5 /test/docx
parenteaefb859906c56e44c6a0ae4efeb407cf92a8e7d (diff)
Read table styles
Diffstat (limited to 'test/docx')
-rw-r--r--test/docx/styles-reader.tests.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/docx/styles-reader.tests.js b/test/docx/styles-reader.tests.js
index 4c5da7e..43cba98 100644
--- a/test/docx/styles-reader.tests.js
+++ b/test/docx/styles-reader.tests.js
@@ -21,6 +21,15 @@ test('paragraph style can be found by ID', function() {
assert.equal(styles.findParagraphStyleById("Heading1").styleId, "Heading1");
});
+test('table style can be found by ID', function() {
+ var styles = readStylesXml(
+ new XmlElement("w:styles", {}, [
+ tableStyleElement("TableNormal", "Normal Table")
+ ])
+ );
+ assert.equal(styles.findTableStyleById("TableNormal").styleId, "TableNormal");
+});
+
test('character style can be found by ID', function() {
var styles = readStylesXml(
new XmlElement("w:styles", {}, [
@@ -44,7 +53,7 @@ test('paragraph and character styles are distinct', function() {
test('character and table styles are distinct', function() {
var styles = readStylesXml(
new XmlElement("w:styles", {}, [
- styleElement("table", "Heading1", "Heading 1")
+ tableStyleElement("Heading1", "Heading 1")
])
);
assert.equal(styles.findCharacterStyleById("Heading1"), null);
@@ -78,6 +87,10 @@ function characterStyleElement(id, name) {
return styleElement("character", id, name);
}
+function tableStyleElement(id, name) {
+ return styleElement("table", id, name);
+}
+
function styleElement(type, id, name) {
return new XmlElement("w:style", {"w:type": type, "w:styleId": id}, [
new XmlElement("w:name", {"w:val": name}, [])