aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-10-01 09:48:57 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2015-10-01 09:48:57 +0200
commit7db7b287ecd616d61dd09147888d02b74d219dd1 (patch)
treea4f0493d187942c6c20cbe508f06768ef7f670b1
parent0ecb32c838b853c35d7939cacde9e5fe715419f9 (diff)
parent0c5c88243bc007f5a4573b3fc39e6e4e6d95b3ae (diff)
downloadrails-7db7b287ecd616d61dd09147888d02b74d219dd1.tar.gz
rails-7db7b287ecd616d61dd09147888d02b74d219dd1.tar.bz2
rails-7db7b287ecd616d61dd09147888d02b74d219dd1.zip
Merge pull request #21823 from prakashlaxkar/test_cases
Added test cases for checkbox_tag
-rw-r--r--actionview/test/template/form_tag_helper_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb
index 643ec15b94..de1eb89dc5 100644
--- a/actionview/test/template/form_tag_helper_test.rb
+++ b/actionview/test/template/form_tag_helper_test.rb
@@ -64,6 +64,18 @@ class FormTagHelperTest < ActionView::TestCase
assert_dom_equal expected, actual
end
+ def test_check_box_tag_disabled
+ actual = check_box_tag "admin","1", false, disabled: true
+ expected = %(<input id="admin" disabled="disabled" name="admin" type="checkbox" value="1" />)
+ assert_dom_equal expected, actual
+ end
+
+ def test_check_box_tag_default_checked
+ actual = check_box_tag "admin","1", true
+ expected = %(<input id="admin" checked="checked" name="admin" type="checkbox" value="1" />)
+ assert_dom_equal expected, actual
+ end
+
def test_check_box_tag_id_sanitized
label_elem = root_elem(check_box_tag("project[2][admin]"))
assert_match VALID_HTML_ID, label_elem['id']