Sha256: 72b8f959bb36e93fd060bb220d2fef9c26f3ecdc79d33b309c053fbfbfa3179a

Contents?: true

Size: 762 Bytes

Versions: 4

Compression:

Stored size: 762 Bytes

Contents

require 'helper'

class TestSlimHtmlEscaping < TestSlim
  def test_html_will_not_be_escaped
    source = %q{
<p> <Hello> World, meet "Slim".
}

    assert_html '<p> <Hello> World, meet "Slim".</p>', source
  end

  def test_html_with_newline_will_not_be_escaped
    source = %q{
<p>
  ><Hello> World,
  > meet "Slim".
}

    assert_html "<p><Hello> World,\n meet \"Slim\".</p>", source
  end

  def test_html_with_escaped_interpolation
    source = %q{
- x = '"'
- content = '<x>'
<p class="#{x}">test #{content}
}

    assert_html '<p class="&quot;">test &lt;x&gt;</p>', source
  end

  def test_html_nested_escaping
    source = %q{
= hello_world do
  | escaped &
}
    assert_html 'Hello World from @env escaped &amp; Hello World from @env', source
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hamlet-0.4.2 test/slim/test_html_escaping.rb
hamlet-0.4.1 test/slim/test_html_escaping.rb
hamlet-0.4.0 test/slim/test_html_escaping.rb
hamlet-0.3.0 test/slim/test_html_escaping.rb