1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
require 'helper'
class TestRedCloth < Test::Unit::TestCase
context "RedCloth default (no explicit config) hard_breaks enabled" do
setup do
@textile = Converters::Textile.new
end
should "preserve single line breaks in HTML output" do
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
end
end
context "Default hard_breaks enabled w/ redcloth section, no hard_breaks value" do
setup do
config = {
'redcloth' => {}
}
@textile = Converters::Textile.new config
end
should "preserve single line breaks in HTML output" do
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
end
end
context "RedCloth with hard_breaks enabled" do
setup do
config = {
'redcloth' => {
'hard_breaks' => true # default
}
}
@textile = Converters::Textile.new config
end
should "preserve single line breaks in HTML output" do
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
end
end
context "RedCloth with hard_breaks disabled" do
setup do
config = {
'redcloth' => {
'hard_breaks' => false
}
}
@textile = Converters::Textile.new config
end
should "not generate break tags in HTML output" do
assert_equal "<p>line1\nline2</p>", @textile.convert("p. line1\nline2").strip
end
end
context "RedCloth w/no_span_caps set to false" do
setup do
config = {
'redcloth' => {
'no_span_caps' => false
}
}
@textile = Converters::Textile.new config
end
should "generate span tags around capitalized words" do
assert_equal "<p><span class=\"caps\">NSC</span></p>", @textile.convert("NSC").strip
end
end
context "RedCloth w/no_span_caps set to true" do
setup do
config = {
'redcloth' => {
'no_span_caps' => true
}
}
@textile = Converters::Textile.new config
end
should "not generate span tags around capitalized words" do
assert_equal "<p>NSC</p>", @textile.convert("NSC").strip
end
end
end
|