diff options
| author | jaceyshome <jaceyshome@gmail.com> | 2015-05-23 11:55:25 +1000 |
|---|---|---|
| committer | jaceyshome <jaceyshome@gmail.com> | 2015-05-23 11:55:25 +1000 |
| commit | 429af29e958c8084d27f39a3c9685c043d1f6df3 (patch) | |
| tree | fe6a557eac40b6a876a3bf64aefaaeb5dd9eb5d3 | |
| parent | 68350464a52e38e3e1b32132195a7b7ea2427b42 (diff) | |
fixed styles reader text case: 'styles names should be null by default'
| -rw-r--r-- | tests/docx/styles-reader.tests.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/docx/styles-reader.tests.js b/tests/docx/styles-reader.tests.js index f76dfc2..bd28673 100644 --- a/tests/docx/styles-reader.tests.js +++ b/tests/docx/styles-reader.tests.js @@ -61,15 +61,16 @@ describe('readStylesXml', function() { }); test('styles names should be null by default', function() { - var styles = readStylesXml({ - root: new XmlElement("w:styles", {}, [ - paragraphStyleElement("Heading1", null), - characterStyleElement("Heading1Char", null) - ]) - }); - assert.equal(styles.findParagraphStyleById("Heading1Char"), null); - assert.equal(styles.findCharacterStyleById("Heading1"), null); + var styles = readStylesXml({ + root: new XmlElement("w:styles", {}, [ + unusualStyleElement("paragraph", "Heading1", "Heading 1"), + unusualStyleElement("character", "Heading1Char", "Heading1Char 1") + ]) + }); + assert.equal(styles.findParagraphStyleById("Heading1").name, null); + assert.equal(styles.findCharacterStyleById("Heading1Char").name, null); }); + }); function paragraphStyleElement(id, name) { @@ -85,3 +86,9 @@ function styleElement(type, id, name) { new XmlElement("w:name", {"w:val": name}, []) ]); } + +function unusualStyleElement(type, id, name) { + return new XmlElement("w:style", {"w:type": type, "w:styleId": id}, [ + new XmlElement("w:notName", {"w:val": name}, []) + ]); +} |
