diff options
| author | Clark Cutler <[email protected]> | 2015-09-22 16:49:03 -0700 |
|---|---|---|
| committer | Clark Cutler <[email protected]> | 2015-09-22 17:07:07 -0700 |
| commit | d85eb0160f3d2ff9ff283a9db4f63925d23694c1 (patch) | |
| tree | b99b98b2fd89e2d31261385158c411ee685d3665 /test/drawing | |
| parent | 58ecbb50a8e569c613e8e7e30c0c241f30fcb812 (diff) | |
| download | caxlsx-d85eb0160f3d2ff9ff283a9db4f63925d23694c1.tar.gz caxlsx-d85eb0160f3d2ff9ff283a9db4f63925d23694c1.zip | |
Escape special characters in chart `StrVal`
So that, for example, pie charts can render with labels
that include an ampersand
Diffstat (limited to 'test/drawing')
| -rw-r--r-- | test/drawing/tc_str_val.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/drawing/tc_str_val.rb b/test/drawing/tc_str_val.rb index 0e4ca835..e4547f62 100644 --- a/test/drawing/tc_str_val.rb +++ b/test/drawing/tc_str_val.rb @@ -4,6 +4,7 @@ class TestStrVal < Test::Unit::TestCase def setup @str_val = Axlsx::StrVal.new :v => "1" + @str_val_with_special_characters = Axlsx::StrVal.new :v => "a & b <c>" end def test_initialize @@ -18,4 +19,12 @@ class TestStrVal < Test::Unit::TestCase assert_equal(doc.xpath("//c:pt/c:v[text()='1']").size, 1) end + def test_to_xml_string_special_characters + str = '<?xml version="1.0" encoding="UTF-8"?>' + str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '">' + str << @str_val_with_special_characters.to_xml_string(0) + doc = Nokogiri::XML(str) + assert_equal(doc.xpath("//c:pt/c:v[text()='a & b <c>']").size, 1) + end + end |
