test/workbook/worksheet/tc_col.rb in axlsx-1.3.1 vs test/workbook/worksheet/tc_col.rb in axlsx-1.3.2
- old
+ new
@@ -5,11 +5,11 @@
def setup
@col = Axlsx::Col.new 1, 1
end
def test_initialize
- options = { :width => 12, :collapsed => true, :hidden => true, :outlineLevel => 1, :phonetic => true, :style => 1}
+ options = { :width => 12, :collapsed => true, :hidden => true, :outline_level => 1, :phonetic => true, :style => 1}
col = Axlsx::Col.new 0, 0, options
options.each{ |key, value| assert_equal(col.send(key.to_sym), value) }
end
@@ -54,9 +54,19 @@
def test_phonetic
assert_equal(@col.phonetic, nil)
assert_raise(ArgumentError, 'phonetic must be boolean(ish)') { @col.phonetic = 'bob' }
assert_nothing_raised(ArgumentError, 'phonetic must be boolean(ish)') { @col.phonetic = true }
+ end
+
+ def test_to_xml_string
+ @col.width = 100
+ doc = Nokogiri::XML(@col.to_xml_string)
+ assert_equal(1, doc.xpath("//col [@bestFit='#{@col.best_fit}']").size)
+ assert_equal(1, doc.xpath("//col [@max=#{@col.max}]").size)
+ assert_equal(1, doc.xpath("//col [@min=#{@col.min}]").size)
+ assert_equal(1, doc.xpath("//col [@width=#{@col.width}]").size)
+ assert_equal(1, doc.xpath("//col [@customWidth='#{@col.custom_width}']").size)
end
def test_style
assert_equal(@col.style, nil)
@col.style = 1