require 'helper' class TestSlimEmbeddedEngines < TestSlim def test_render_with_erb source = %q{

Hello from <%= text.upcase %>! Second Line! <% if true %><%= true %><% end %> } assert_html "

Hello from BEFORE ERB BLOCK!\nSecond Line!\ntrue

", source end def test_render_with_markdown # Keep the trailing spaces. source = %q{ Header\n

Hello from Markdown!

\n\n

3

\n\n\n", source Slim::EmbeddedEngine.default_options[:markdown] = {:auto_ids => false} assert_html "

Header

\n

Hello from Markdown!

\n\n

3

\n\n\n", source Slim::EmbeddedEngine.default_options[:markdown] = nil assert_html "

Header

\n

Hello from Markdown!

\n\n

3

\n\n\n", source end def test_render_with_creole source = %q{ head1

head2

", source end def test_render_with_builder source = %q{ 'test') { xml.text!('Hello') } } assert_html "

\nHello

\n", source end def test_render_with_wiki source = %q{ head1

head2

", source end def test_render_with_javascript # Keep the trailing space behind "javascript: "! source = %q{ Hi } assert_html %{

Hi

}, source end def test_render_with_javascript_including_variable # Keep the trailing space behind "javascript: "! source = %q{ - func = "alert('hello');" $(function() { alert('hello'); });|, source end def test_render_with_ruby source = %q{ body{color:red}", source end def test_disabled_embedded_engine source = %{ %w(javascript) source = %{ %w(javascript) source = %{ %w(ruby) end def test_enabled_embedded_engine source = %q{ $(function() {});', source, :disable_engines => %w(ruby) source = %q{ $(function() {});', source, :enable_engines => %w(javascript) end end