test/slim/test_code_evaluation.rb in hamlet-0.4.2 vs test/slim/test_code_evaluation.rb in hamlet-0.5.0

- old
+ new

@@ -9,11 +9,11 @@ assert_html '<p class="hello world" id="notice">Hello World from @env</p>', source end def test_render_with_call_to_set_custom_attributes source = %q{ -<p data-id="#{id_helper}" data-class>="hello world" +<p data-id="#{id_helper}" data-class="hello world"> = hello_world } assert_html '<p data-class="hello world" data-id="notice">Hello World from @env</p>', source end @@ -98,11 +98,11 @@ assert_html '<form action="&#47;action-page-save" method="post"></form>', source end def test_bypassing_escape_in_attribute source = %q{ -<form action==#{action_path(:page, :save)} method='post'> +<form action=#{{action_path(:page, :save)}} method='post'> } assert_html '<form action="/action-page-save" method="post"></form>', source end @@ -117,11 +117,11 @@ def test_hash_call_in_delimited_attribute source = %q{ <p id=#{hash[:a]}> Test it } - assert_html '<p id="The letter a">Test it</p>', source + assert_html '<p id="The letter a"> Test it</p>', source end def test_hash_call_in_attribute_with_ruby_evaluation source = %q{ <p id=#{hash[:a] + hash[:a]}>Test it @@ -133,19 +133,19 @@ def test_hash_call_in_delimited_attribute_with_ruby_evaluation source = %q{ <p id=#{hash[:a] + hash[:a]}> Test it } - assert_html '<p id="The letter aThe letter a">Test it</p>', source + assert_html '<p id="The letter aThe letter a"> Test it</p>', source end def test_hash_call_in_delimited_attribute_with_ruby_evaluation_2 source = %q{ <p id=#{hash[:a] + hash[:a]}> Test it } - assert_html '<p id="The letter aThe letter a">Test it</p>', source + assert_html '<p id="The letter aThe letter a"> Test it</p>', source end def test_hash_call_in_delimited_attribute_with_ruby_evaluation_3 source = %q{ <p id=#{hash[:a] + hash[:a]}>Test it @@ -203,11 +203,11 @@ def test_class_attribute_merging_with_nil source = %{ <.alpha class="beta" class=nil class="gamma">Test it } - assert_html '<div class="alpha beta gamma">Test it</div>', source + assert_html '<div class="alpha beta nil gamma">Test it</div>', source end def test_id_attribute_merging source = %{ <#alpha id="beta">Test it @@ -222,27 +222,27 @@ assert_html '<div id="alpha-beta">Test it</div>', source, :attr_delimiter => {'class' => ' ', 'id' => '-' } end def test_boolean_attribute_false source = %{ -<option selected=false>Text +<option selected=>Text } assert_html '<option>Text</option>', source end def test_boolean_attribute_true source = %{ -<option selected=true>Text +<option selected=selected>Text } assert_html '<option selected="selected">Text</option>', source end def test_boolean_attribute_dynamic source = %{ -<option selected=#{method_which_returns_true}>Text +<option selected=selected>Text } assert_html '<option selected="selected">Text</option>', source end @@ -266,14 +266,14 @@ source = %{ <option class="clazz" selected>Text <option selected class="clazz">Text } - assert_html '<option class="clazz" selected="selected">Text</option><option class="clazz" selected="selected">Text</option>', source + assert_html '<option class="clazz" selected="selected">Text</option> <option class="clazz" selected="selected">Text</option>', source end def test_array_attribute - source = %{ + source = %q{ <.alpha class="beta" class=#{[:gamma, nil, :delta, [true, false]]} } assert_html '<div class="alpha beta gamma delta true false"></div>', source end