summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorRandy Morgan (@morgan_randy) <[email protected]>2013-04-27 19:24:01 -0700
committerRandy Morgan (@morgan_randy) <[email protected]>2013-04-27 19:24:01 -0700
commita120fdb2e787986ced4952b6ef3f4b70056960d9 (patch)
tree48a6240020faa05b8b6a7904652ebe291abfa6d4 /test
parent077a9d56728b4a235c4f07a854801a298220c55c (diff)
parentd68df9e5088c7ce23f550968df1280a31f6a8d48 (diff)
downloadcaxlsx-a120fdb2e787986ced4952b6ef3f4b70056960d9.tar.gz
caxlsx-a120fdb2e787986ced4952b6ef3f4b70056960d9.zip
Merge pull request #185 from agardiner/preserve-spaces
Add support for preserving leading and trailing spaces in cell values
Diffstat (limited to 'test')
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index ed8c7cab..c2bb0faa 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -352,6 +352,15 @@ class TestWorksheet < Test::Unit::TestCase
assert(schema.validate(doc).map{ |e| puts e.message; e }.empty?, "error free validation")
end
+ def test_to_xml_string_with_preserve_spaces
+ # Check that xml:space="preserve" has been added when preserve_spaces is set
+ ws_xml = Nokogiri::XML(@ws.to_xml_string)
+ assert(ws_xml.xpath("//xmlns:worksheet/@xml:space='preserve'"))
+ @ws.preserve_spaces = false
+ ws_xml = Nokogiri::XML(@ws.to_xml_string)
+ assert(!ws_xml.xpath("//xmlns:worksheet/@xml:space='preserve'"))
+ end
+
def test_styles
assert(@ws.styles.is_a?(Axlsx::Styles), 'worksheet provides access to styles')
end