diff options
| author | Randy Morgan <[email protected]> | 2012-08-12 23:24:45 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-08-12 23:24:45 +0900 |
| commit | 7db5855fa050a18fad0de842f6cb04a71398bbb7 (patch) | |
| tree | 80c903b443a39dea0ce361f5dd3162c75b656e56 /test/workbook/worksheet/tc_worksheet_hyperlink.rb | |
| parent | 2d1ca60fc6c4f2bf3e55844725073cca74ab1e9d (diff) | |
| download | caxlsx-7db5855fa050a18fad0de842f6cb04a71398bbb7.tar.gz caxlsx-7db5855fa050a18fad0de842f6cb04a71398bbb7.zip | |
finish specs for worksheet hyperlink to_xml_string
Diffstat (limited to 'test/workbook/worksheet/tc_worksheet_hyperlink.rb')
| -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 |
