Sha256: becaeeeb3f700184b3ed693c17a1d2649efc1223fe51fe1431c6967ee7c6d035
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
require 'helper' class TestSlimTextInterpolation < TestSlim def test_interpolation_in_attribute source = %q{ <p id="a#{id_helper}b">= hello_world } assert_html '<p id="anoticeb">Hello World from @env</p>', source end def test_nested_interpolation_in_attribute source = %q{ <p id="#{"abc#{1+1}" + "("}">= hello_world } assert_html '<p id="abc2(">Hello World from @env</p>', source end def test_interpolation_in_text source = %q{ <p #{hello_world} with "quotes" <p >A message from the compiler: #{hello_world} } assert_html "<p>Hello World from @env with \"quotes\"</p>\n<p>A message from the compiler: Hello World from @env</p>", source end def test_interpolation_in_tag source = %q{ <p>#{hello_world} } assert_html '<p>Hello World from @env</p>', source end def test_escape_interpolation source = %q{ <p>\\#{hello_world} } assert_html '<p>#{hello_world}</p>', source end def test_complex_interpolation source = %q{ <p>Message: #{message('hello', "user #{output_number}")} } assert_html '<p>Message: hello user 1337</p>', source end def test_interpolation_with_escaping source = %q{ #{evil_method} } assert_html '<script>do_something_evil();</script>', source end def test_interpolation_without_escaping source = %q{ #{{evil_method}} } assert_html '<script>do_something_evil();</script>', source end def test_interpolation_with_escaping_and_delimiter source = %q{ #{(evil_method)} } assert_html '<script>do_something_evil();</script>', source end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamlet-0.4.2 | test/slim/test_text_interpolation.rb |