mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
fix error on empty :javascript and :css filter blocks (#986)
Fixes #985.
This commit is contained in:
parent
985668470b
commit
c32fa3c335
2 changed files with 13 additions and 1 deletions
|
@ -182,7 +182,7 @@ RUBY
|
|||
return
|
||||
end
|
||||
|
||||
rendered = Haml::Helpers::find_and_preserve(filter.render_with_options(text, compiler.options), compiler.options[:preserve])
|
||||
rendered = Haml::Helpers::find_and_preserve(filter.render_with_options(text.to_s, compiler.options), compiler.options[:preserve])
|
||||
push_text("#{rendered.rstrip}\n")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -185,6 +185,12 @@ class JavascriptFilterTest < Haml::TestCase
|
|||
refute_match('//<![CDATA[', out)
|
||||
refute_match('//]]>', out)
|
||||
end
|
||||
|
||||
test "should emit tag on empty block" do
|
||||
html = "<script>\n \n</script>\n"
|
||||
haml = ":javascript"
|
||||
assert_equal(html, render(haml))
|
||||
end
|
||||
end
|
||||
|
||||
class CSSFilterTest < Haml::TestCase
|
||||
|
@ -224,6 +230,12 @@ class CSSFilterTest < Haml::TestCase
|
|||
refute_match('<![CDATA[', out)
|
||||
refute_match(']]>', out)
|
||||
end
|
||||
|
||||
test "should emit tag on empty block" do
|
||||
html = "<style>\n \n</style>\n"
|
||||
haml = ":css"
|
||||
assert_equal(html, render(haml))
|
||||
end
|
||||
end
|
||||
|
||||
class CDATAFilterTest < Haml::TestCase
|
||||
|
|
Loading…
Add table
Reference in a new issue