Add test cases for default values with no explicit config. for `hard_breaks`.
This commit is contained in:
parent
a78f86f1ac
commit
69e7f4abef
|
@ -28,7 +28,11 @@ module Jekyll
|
||||||
def convert(content)
|
def convert(content)
|
||||||
setup
|
setup
|
||||||
r = RedCloth.new(content)
|
r = RedCloth.new(content)
|
||||||
r.hard_breaks = @config['redcloth']['hard_breaks']
|
|
||||||
|
if !@config['redcloth'].nil? and !@config['redcloth']['hard_breaks'].nil?
|
||||||
|
r.hard_breaks = @config['redcloth']['hard_breaks']
|
||||||
|
end
|
||||||
|
|
||||||
r.to_html
|
r.to_html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,30 @@
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestRedCloth < Test::Unit::TestCase
|
class TestRedCloth < Test::Unit::TestCase
|
||||||
|
|
||||||
|
context "RedCloth default (no explicit config) hard_breaks enabled" do
|
||||||
|
setup do
|
||||||
|
@textile = TextileConverter.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 = TextileConverter.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
|
context "RedCloth with hard_breaks enabled" do
|
||||||
setup do
|
setup do
|
||||||
config = {
|
config = {
|
||||||
|
|
Loading…
Reference in New Issue