summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_comment.rb
diff options
context:
space:
mode:
authorStefan Daschek <[email protected]>2013-07-03 16:49:34 +0200
committerStefan Daschek <[email protected]>2013-07-03 16:49:34 +0200
commita60d1889744205dbc86ce0e23f8ed04ba7093d23 (patch)
tree4ff6990a0c95a0ce1f7307466c1ae54e40349a7a /test/workbook/worksheet/tc_comment.rb
parent7bb62e8870ae369a9b2423c87d5e0875873c3834 (diff)
downloadcaxlsx-a60d1889744205dbc86ce0e23f8ed04ba7093d23.tar.gz
caxlsx-a60d1889744205dbc86ce0e23f8ed04ba7093d23.zip
Do not start comment text with stray colon if author is blank
Diffstat (limited to 'test/workbook/worksheet/tc_comment.rb')
-rw-r--r--test/workbook/worksheet/tc_comment.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb
index 9f30436d..e66abb9a 100644
--- a/test/workbook/worksheet/tc_comment.rb
+++ b/test/workbook/worksheet/tc_comment.rb
@@ -57,5 +57,16 @@ class TestComment < Test::Unit::TestCase
assert_equal(doc.xpath("//t[text()='#{@c1.text}']").size, 1)
end
+ def test_comment_text_contain_author_and_text
+ comment = @ws.add_comment :ref => 'C4', :text => 'some text', :author => 'Bob'
+ doc = Nokogiri::XML(comment.to_xml_string)
+ assert_equal("Bob:\nsome text", doc.xpath("//comment/text").text)
+ end
+
+ def test_comment_text_does_not_contain_stray_colon_if_author_blank
+ comment = @ws.add_comment :ref => 'C5', :text => 'some text', :author => ''
+ doc = Nokogiri::XML(comment.to_xml_string)
+ assert_equal("some text", doc.xpath("//comment/text").text)
+ end
end