summaryrefslogtreecommitdiff
path: root/test/text_test.rb
diff options
context:
space:
mode:
authorDan Allen <dallen@redhat.com>2013-06-26 15:27:03 -0600
committerDan Allen <dallen@redhat.com>2013-06-27 20:01:31 -0600
commitb8a2f21bf51eaee8bf9951621ee6bcb99dd55839 (patch)
treeee9e92c2499ffe43caf1ee0c5b14285edd36a60e /test/text_test.rb
parentf620bfd8e6fe8c483bf47fe69e52dc6608927f78 (diff)
resolves #455 add Markdown-style horizontal rules (w/ restriction)
Diffstat (limited to 'test/text_test.rb')
-rw-r--r--test/text_test.rb41
1 files changed, 38 insertions, 3 deletions
diff --git a/test/text_test.rb b/test/text_test.rb
index a77e01b3..3bf81c73 100644
--- a/test/text_test.rb
+++ b/test/text_test.rb
@@ -63,9 +63,44 @@ include::fixtures/encoding.asciidoc[tags=romé]
assert_match(/&#8216;The New Yorker.&#8217;/, rendered)
end
- test "separator" do
- # for some reason, the html enclosure breaks the xpath //*[@id='content']//hr
- assert_xpath "//*[@id='content']//hr", render_string("This is separated.\n\n'''\n\n...from this!"), 1
+ test 'horizontal rule' do
+ input = <<-EOS
+This line is separated by a horizontal rule...
+
+'''
+
+...from this line.
+ EOS
+ output = render_embedded_string input
+ assert_xpath "//hr", output, 1
+ assert_xpath "/*[@class='paragraph']", output, 2
+ assert_xpath "(/*[@class='paragraph'])[1]/following-sibling::hr", output, 1
+ assert_xpath "/hr/following-sibling::*[@class='paragraph']", output, 1
+ end
+
+ test 'markdown horizontal rules' do
+ variants = [
+ '---',
+ '- - -',
+ '***',
+ '* * *',
+ '\' \' \''
+ ]
+
+ variants.each do |variant|
+ input = <<-EOS
+This line is separated by a horizontal rule...
+
+#{variant}
+
+...from this line.
+ EOS
+ output = render_embedded_string input
+ assert_xpath "//hr", output, 1
+ assert_xpath "/*[@class='paragraph']", output, 2
+ assert_xpath "(/*[@class='paragraph'])[1]/following-sibling::hr", output, 1
+ assert_xpath "/hr/following-sibling::*[@class='paragraph']", output, 1
+ end
end
test "emphasized text" do