summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/tc_workbook.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-04-28 12:55:46 +0900
committerRandy Morgan <[email protected]>2013-04-28 12:55:46 +0900
commite49aee3e2f700569a519c5346746d239a05383cf (patch)
tree7f449191165a3fbdf05b34c4239dda6ec179d033 /test/workbook/tc_workbook.rb
parenta120fdb2e787986ced4952b6ef3f4b70056960d9 (diff)
downloadcaxlsx-e49aee3e2f700569a519c5346746d239a05383cf.tar.gz
caxlsx-e49aee3e2f700569a519c5346746d239a05383cf.zip
Refactored and renamed space preservation
preserve_spaces has been moved to the workbook and renamed xml_space as that provides a good reference for people trying to figure out what it does, and let's the author specify space preservation for serializations using the shared strings table as well as the default inline serialization in cells.
Diffstat (limited to 'test/workbook/tc_workbook.rb')
-rw-r--r--test/workbook/tc_workbook.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb
index 1a9b9669..591160f4 100644
--- a/test/workbook/tc_workbook.rb
+++ b/test/workbook/tc_workbook.rb
@@ -9,6 +9,23 @@ class TestWorkbook < Test::Unit::TestCase
def teardown
end
+ def test_worksheet_users_xml_space
+ sheet = @wb.add_worksheet(:name => 'foo')
+ ws_xml = Nokogiri::XML(sheet.to_xml_string)
+ assert(ws_xml.xpath("//xmlns:worksheet/@xml:space='preserve'"))
+
+ @wb.xml_space = :default
+ ws_xml = Nokogiri::XML(sheet.to_xml_string)
+ assert(ws_xml.xpath("//xmlns:worksheet/@xml:space='default'"))
+ end
+
+ def test_xml_space
+ assert_equal(:preserve, @wb.xml_space)
+ @wb.xml_space = :default
+ assert_equal(:default, @wb.xml_space)
+ assert_raise(ArgumentError) { @wb.xml_space = :none }
+ end
+
def test_no_autowidth
assert_equal(@wb.use_autowidth, true)
assert_raise(ArgumentError) {@wb.use_autowidth = 0.1}