diff options
| author | Randy Morgan <[email protected]> | 2012-05-15 11:23:59 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-05-15 11:23:59 +0900 |
| commit | 2d744ba77906d460b608859c945a5741ec725e42 (patch) | |
| tree | 0366b619ea15909d230a2fa485a95d395486d6cf /test/stylesheet | |
| parent | 2e1e14dd8f91e8a1416faae9501fdf04638104c7 (diff) | |
| download | caxlsx-2d744ba77906d460b608859c945a5741ec725e42.tar.gz caxlsx-2d744ba77906d460b608859c945a5741ec725e42.zip | |
bring coverage up to 100% and patch a few minor bugs in cell style overrides and misnamed app attributes.
Diffstat (limited to 'test/stylesheet')
| -rw-r--r-- | test/stylesheet/tc_table_style.rb | 8 | ||||
| -rw-r--r-- | test/stylesheet/tc_table_style_element.rb | 11 |
2 files changed, 18 insertions, 1 deletions
diff --git a/test/stylesheet/tc_table_style.rb b/test/stylesheet/tc_table_style.rb index 8b219a93..f58a7a0d 100644 --- a/test/stylesheet/tc_table_style.rb +++ b/test/stylesheet/tc_table_style.rb @@ -13,6 +13,10 @@ class TestTableStyle < Test::Unit::TestCase assert_equal(@item.name, "fisher") assert_equal(@item.pivot, nil) assert_equal(@item.table, nil) + ts = Axlsx::TableStyle.new 'price', :pivot => true, :table => true + assert_equal(ts.name, 'price') + assert_equal(ts.pivot, true) + assert_equal(ts.table, true) end def test_name @@ -33,4 +37,8 @@ class TestTableStyle < Test::Unit::TestCase assert_equal(@item.table, true) end + def test_to_xml_string + doc = Nokogiri::XML(@item.to_xml_string) + assert(doc.xpath("//tableStyle[@name='#{@item.name}']")) + end end diff --git a/test/stylesheet/tc_table_style_element.rb b/test/stylesheet/tc_table_style_element.rb index 2e6e763f..9ef54e2f 100644 --- a/test/stylesheet/tc_table_style_element.rb +++ b/test/stylesheet/tc_table_style_element.rb @@ -13,6 +13,10 @@ class TestTableStyleElement < Test::Unit::TestCase assert_equal(@item.type, nil) assert_equal(@item.size, nil) assert_equal(@item.dxfId, nil) + options = { :type => :headerRow, :size => 10, :dxfId => 1 } + + tse = Axlsx::TableStyleElement.new options + options.each { |key, value| assert_equal(tse.send(key.to_sym), value) } end def test_type @@ -32,5 +36,10 @@ class TestTableStyleElement < Test::Unit::TestCase assert_nothing_raised { @item.dxfId = 7 } assert_equal(@item.dxfId, 7) end - + + def test_to_xml_string + doc = Nokogiri::XML(@item.to_xml_string) + @item.type = :headerRow + assert(doc.xpath("//tableStyleElement[@type='#{@item.type.to_s}']")) + end end |
