Skip to content

Commit

Permalink
Add test select_tag escapes prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Aug 3, 2012
1 parent 8f8d8eb commit c8a613b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions actionpack/test/template/form_tag_helper_test.rb
Expand Up @@ -213,6 +213,12 @@ def test_select_tag_with_prompt
assert_dom_equal expected, actual
end

def test_select_tag_escapes_prompt
actual = select_tag "places", "<option>Home</option><option>Work</option><option>Pub</option>".html_safe, :prompt => "<script>alert(1337)</script>"
expected = %(<select id="places" name="places"><option value="">&lt;script&gt;alert(1337)&lt;/script&gt;</option><option>Home</option><option>Work</option><option>Pub</option></select>)
assert_dom_equal expected, actual
end

def test_select_tag_with_prompt_and_include_blank
actual = select_tag "places", "<option>Home</option><option>Work</option><option>Pub</option>".html_safe, :prompt => "string", :include_blank => true
expected = %(<select name="places" id="places"><option value="">string</option><option value=""></option><option>Home</option><option>Work</option><option>Pub</option></select>)
Expand Down

0 comments on commit c8a613b

Please sign in to comment.