aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_tag_helper_test.rb
diff options
context:
space:
mode:
authorStephen Celis <stephen@stephencelis.com>2010-04-20 23:16:18 -0500
committerJosé Valim <jose.valim@gmail.com>2010-05-15 08:59:08 +0200
commit6e69b42b21d8e76c4d87b6fbc4222f55d3b11a06 (patch)
treef3c036e8d4cfe261984bdba8d14cae2612dc9fd0 /actionpack/test/template/form_tag_helper_test.rb
parent35a114a8941cb22d29a536f1215a23a8cf7c4756 (diff)
downloadrails-6e69b42b21d8e76c4d87b6fbc4222f55d3b11a06.tar.gz
rails-6e69b42b21d8e76c4d87b6fbc4222f55d3b11a06.tar.bz2
rails-6e69b42b21d8e76c4d87b6fbc4222f55d3b11a06.zip
Let label helpers accept blocks.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/template/form_tag_helper_test.rb')
-rw-r--r--actionpack/test/template/form_tag_helper_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
index abb0e1df93..1e116c041f 100644
--- a/actionpack/test/template/form_tag_helper_test.rb
+++ b/actionpack/test/template/form_tag_helper_test.rb
@@ -288,6 +288,15 @@ class FormTagHelperTest < ActionView::TestCase
assert_match VALID_HTML_ID, label_elem['for']
end
+ def test_label_tag_with_block
+ assert_dom_equal('<label>Blocked</label>', label_tag { "Blocked" })
+ end
+
+ def test_label_tag_with_block_and_argument
+ output = label_tag("clock") { "Grandfather" }
+ assert_dom_equal('<label for="clock">Grandfather</label>', output)
+ end
+
def test_boolean_options
assert_dom_equal %(<input checked="checked" disabled="disabled" id="admin" name="admin" readonly="readonly" type="checkbox" value="1" />), check_box_tag("admin", 1, true, 'disabled' => true, :readonly => "yes")
assert_dom_equal %(<input checked="checked" id="admin" name="admin" type="checkbox" value="1" />), check_box_tag("admin", 1, true, :disabled => false, :readonly => nil)