Test all the things
This commit is contained in:
parent
acb2263f51
commit
ddf640e6bd
|
@ -1,8 +1,8 @@
|
|||
class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
|
||||
def initialize(source, options)
|
||||
super
|
||||
@block_parsers = []
|
||||
@span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :escaped_chars]
|
||||
@block_parsers = [:block_html]
|
||||
@span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -31,9 +31,32 @@ class TestFilters < JekyllUnitTest
|
|||
assert_equal "<p>something <strong>really</strong> simple</p>\n", @filter.markdownify("something **really** simple")
|
||||
end
|
||||
|
||||
should "smartify with simple string" do
|
||||
assert_equal "SmartyPants is *not* Markdown", @filter.smartify("SmartyPants is *not* Markdown")
|
||||
assert_equal "“This filter’s test…”", @filter.smartify(%q{"This filter's test..."})
|
||||
context "smartify filter" do
|
||||
should "convert quotes and typographic characters" do
|
||||
assert_equal "SmartyPants is *not* Markdown", @filter.smartify("SmartyPants is *not* Markdown")
|
||||
assert_equal "“This filter’s test…”", @filter.smartify(%q{"This filter's test..."})
|
||||
end
|
||||
|
||||
should "escapes special characters when configured to do so" do
|
||||
kramdown = JekyllFilter.new({:kramdown => {:entity_output => :symbolic}})
|
||||
assert_equal "“This filter’s test…”", kramdown.smartify(%q{"This filter's test..."})
|
||||
end
|
||||
|
||||
should "convert HTML entities to unicode characters" do
|
||||
assert_equal "’", @filter.smartify("’")
|
||||
assert_equal "“", @filter.smartify("“")
|
||||
end
|
||||
|
||||
should "allow raw HTML passthrough" do
|
||||
assert_equal "Span HTML is <em>not</em> escaped", @filter.smartify("Span HTML is <em>not</em> escaped")
|
||||
assert_equal "<div>Block HTML is not escaped</div>", @filter.smartify("<div>Block HTML is not escaped</div>")
|
||||
end
|
||||
|
||||
should "escape special characters" do
|
||||
assert_equal "3 < 4", @filter.smartify("3 < 4")
|
||||
assert_equal "5 > 4", @filter.smartify("5 > 4")
|
||||
assert_equal "This & that", @filter.smartify("This & that")
|
||||
end
|
||||
end
|
||||
|
||||
should "sassify with simple string" do
|
||||
|
|
Loading…
Reference in New Issue