summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_worksheet.rb
diff options
context:
space:
mode:
authorAdam Gardiner <[email protected]>2013-04-27 18:01:29 +0100
committerAdam Gardiner <[email protected]>2013-04-27 18:01:29 +0100
commitd68df9e5088c7ce23f550968df1280a31f6a8d48 (patch)
treec6675b34b3524904691b4d23f5704c733d9c717d /test/workbook/worksheet/tc_worksheet.rb
parente76c93bcbf842f01a02a2485873c5eeed3838bf4 (diff)
downloadcaxlsx-d68df9e5088c7ce23f550968df1280a31f6a8d48.tar.gz
caxlsx-d68df9e5088c7ce23f550968df1280a31f6a8d48.zip
Add a preserve_spaces option to worksheet, defaults to true
Diffstat (limited to 'test/workbook/worksheet/tc_worksheet.rb')
-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