diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/rels/tc_relationship.rb | 5 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_worksheet_hyperlink.rb | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb index ef995449..32b9e4a1 100644 --- a/test/rels/tc_relationship.rb +++ b/test/rels/tc_relationship.rb @@ -18,4 +18,9 @@ class TestRelationships < Test::Unit::TestCase assert_nothing_raised { Axlsx::Relationship.new( Axlsx::WORKSHEET_R, 'target', :target_mode => :External) } end + def test_ampersand_escaping_in_target + r = Axlsx::Relationship.new(Axlsx::HYPERLINK_R, "http://example.com?foo=1&bar=2", :target_mod => :External) + doc = Nokogiri::XML(r.to_xml_string(1)) + assert_equal(doc.xpath("//Relationship[@Target='http://example.com?foo=1&bar=2']").size, 1) + end end diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb index ad993e62..278c5add 100644 --- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb +++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb @@ -5,7 +5,7 @@ class TestWorksheetHyperlink < Test::Unit::TestCase p = Axlsx::Package.new wb = p.workbook @ws = wb.add_worksheet - @options = { :location => 'https://github.com/randym/axlsx', :tooltip => 'axlsx', :ref => 'A1', :display => 'AXSLX', :target => :internal } + @options = { :location => 'https://github.com/randym/axlsx?foo=1&bar=2', :tooltip => 'axlsx', :ref => 'A1', :display => 'AXSLX', :target => :internal } @a = @ws.add_hyperlink @options end |
