diff options
author | José Valim <jose.valim@gmail.com> | 2012-02-20 12:19:42 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-02-20 12:19:42 -0800 |
commit | 4b45fcffea4c1943da2284b7abaf4d8a01deaa9d (patch) | |
tree | 7e18228731bc7169ea6301053c367e5efd7f59e3 /actionpack/test/template/form_options_helper_test.rb | |
parent | 4e3c215dcbeb122c59fe7158715c07bd4b1f41fd (diff) | |
parent | decff3f43e5549cbc8b89f974460de3d71407042 (diff) | |
download | rails-4b45fcffea4c1943da2284b7abaf4d8a01deaa9d.tar.gz rails-4b45fcffea4c1943da2284b7abaf4d8a01deaa9d.tar.bz2 rails-4b45fcffea4c1943da2284b7abaf4d8a01deaa9d.zip |
Merge pull request #5102 from nashby/form-option-refactor
form option refactor
Diffstat (limited to 'actionpack/test/template/form_options_helper_test.rb')
-rw-r--r-- | actionpack/test/template/form_options_helper_test.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index bed67e35b3..6b8d62df62 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -182,16 +182,16 @@ class FormOptionsHelperTest < ActionView::TestCase def test_hash_options_for_select assert_dom_equal( - "<option value=\"<Kroner>\"><DKR></option>\n<option value=\"Dollar\">$</option>", - options_for_select("$" => "Dollar", "<DKR>" => "<Kroner>").split("\n").sort.join("\n") + "<option value=\"Dollar\">$</option>\n<option value=\"<Kroner>\"><DKR></option>", + options_for_select("$" => "Dollar", "<DKR>" => "<Kroner>").split("\n").join("\n") ) assert_dom_equal( - "<option value=\"<Kroner>\"><DKR></option>\n<option value=\"Dollar\" selected=\"selected\">$</option>", - options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" }, "Dollar").split("\n").sort.join("\n") + "<option value=\"Dollar\" selected=\"selected\">$</option>\n<option value=\"<Kroner>\"><DKR></option>", + options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" }, "Dollar").split("\n").join("\n") ) assert_dom_equal( - "<option value=\"<Kroner>\" selected=\"selected\"><DKR></option>\n<option value=\"Dollar\" selected=\"selected\">$</option>", - options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" }, [ "Dollar", "<Kroner>" ]).split("\n").sort.join("\n") + "<option value=\"Dollar\" selected=\"selected\">$</option>\n<option value=\"<Kroner>\" selected=\"selected\"><DKR></option>", + options_for_select({ "$" => "Dollar", "<DKR>" => "<Kroner>" }, [ "Dollar", "<Kroner>" ]).split("\n").join("\n") ) end @@ -1056,36 +1056,36 @@ class FormOptionsHelperTest < ActionView::TestCase end def test_option_html_attributes_from_without_hash - assert_dom_equal( - "", + assert_equal( + {}, option_html_attributes([ 'foo', 'bar' ]) ) end def test_option_html_attributes_with_single_element_hash - assert_dom_equal( - " class=\"fancy\"", + assert_equal( + {:class => 'fancy'}, option_html_attributes([ 'foo', 'bar', { :class => 'fancy' } ]) ) end def test_option_html_attributes_with_multiple_element_hash - assert_dom_equal( - " class=\"fancy\" onclick=\"alert('Hello World');\"", + assert_equal( + {:class => 'fancy', 'onclick' => "alert('Hello World');"}, option_html_attributes([ 'foo', 'bar', { :class => 'fancy', 'onclick' => "alert('Hello World');" } ]) ) end def test_option_html_attributes_with_multiple_hashes - assert_dom_equal( - " class=\"fancy\" onclick=\"alert('Hello World');\"", + assert_equal( + {:class => 'fancy', 'onclick' => "alert('Hello World');"}, option_html_attributes([ 'foo', 'bar', { :class => 'fancy' }, { 'onclick' => "alert('Hello World');" } ]) ) end def test_option_html_attributes_with_special_characters - assert_dom_equal( - " onclick=\"alert("<code>")\"", + assert_equal( + {:onclick => "alert("<code>")"}, option_html_attributes([ 'foo', 'bar', { :onclick => %(alert("<code>")) } ]) ) end |