diff options
| -rw-r--r-- | test/workbook/worksheet/tc_worksheet_hyperlink.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb index 1d9b4e20..6c2b1003 100644 --- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb +++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb @@ -37,12 +37,23 @@ class TestWorksheetHyperlink < Test::Unit::TestCase end - def test_to_xml_string - doc = Nokogiri::XML(@a.to_xml_string) - # TODO find a way to add in the namespace or test this in worksheet as r (relation) namespace is not defined - # assert_equal(doc.xpath("//hyperlink[@ref='#{@a.ref}']").size, 1) - # assert_equal(doc.xpath("//hyperlink[@tooltip='#{@a.tooltip}']").size, 1) - # assert_equal(doc.xpath("//hyperlink[@display='#{@a.display}']").size, 1) + def test_to_xml_string_with_non_external + doc = Nokogiri::XML(@ws.to_xml_string) + assert_equal(doc.xpath("//xmlns:hyperlink[@ref='#{@a.ref}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@tooltip='#{@a.tooltip}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@location='#{@a.location}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@display='#{@a.display}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@r:id='#{@a.id}']").size, 0) + end + + def test_to_xml_stirng_with_external + @a.target = :external + doc = Nokogiri::XML(@ws.to_xml_string) + assert_equal(doc.xpath("//xmlns:hyperlink[@ref='#{@a.ref}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@tooltip='#{@a.tooltip}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@display='#{@a.display}']").size, 1) + assert_equal(doc.xpath("//xmlns:hyperlink[@location='#{@a.location}']").size, 0) + assert_equal(doc.xpath("//xmlns:hyperlink[@r:id='#{@a.id}']").size, 1) end end |
