aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-01-21 21:08:28 +0000
committerMichael Koziarski <michael@koziarski.com>2008-01-21 21:08:28 +0000
commit7701e6466dd5f6ca1b3eb1bfaf73f1d0723bb324 (patch)
tree69e1c6e1c573135b3e460fc90d54ca70f662b219 /actionpack/test/template
parent37f71a77cc92df0960ef857880ccf9749a6eecc1 (diff)
downloadrails-7701e6466dd5f6ca1b3eb1bfaf73f1d0723bb324.tar.gz
rails-7701e6466dd5f6ca1b3eb1bfaf73f1d0723bb324.tar.bz2
rails-7701e6466dd5f6ca1b3eb1bfaf73f1d0723bb324.zip
Add label_tag helper for generating elements. Closes #10802 [DefV]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8685 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/form_tag_helper_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
index 3ca3e743eb..4160c838cc 100644
--- a/actionpack/test/template/form_tag_helper_test.rb
+++ b/actionpack/test/template/form_tag_helper_test.rb
@@ -188,6 +188,24 @@ class FormTagHelperTest < Test::Unit::TestCase
assert_dom_equal expected, actual
end
+ def test_label_tag_without_text
+ actual = label_tag "title"
+ expected = %(<label for="title">Title</label>)
+ assert_dom_equal expected, actual
+ end
+
+ def test_label_tag_with_text
+ actual = label_tag "title", "My Title"
+ expected = %(<label for="title">My Title</label>)
+ assert_dom_equal expected, actual
+ end
+
+ def test_label_tag_class_string
+ actual = label_tag "title", "My Title", "class" => "small_label"
+ expected = %(<label for="title" class="small_label">My Title</label>)
+ assert_dom_equal expected, actual
+ end
+
def test_boolean_optios
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)