From 429af29e958c8084d27f39a3c9685c043d1f6df3 Mon Sep 17 00:00:00 2001 From: jaceyshome Date: Sat, 23 May 2015 11:55:25 +1000 Subject: fixed styles reader text case: 'styles names should be null by default' --- tests/docx/styles-reader.tests.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'tests/docx/styles-reader.tests.js') 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}, []) + ]); +} -- cgit v1.2.3