aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorcolorfulfool <t0ny.hamster@gmail.com>2017-07-28 17:18:10 +0300
committercolorfulfool <t0ny.hamster@gmail.com>2017-08-02 16:28:35 +0300
commitd656097734928e1f6b3c3bd884e128c4e299f2ec (patch)
tree0ceb0c2f8f5f5a031c07d0fb9f8841e82e592fad /actionview/test
parentac6cd6800a1eb7dc86ff3897cca7434af636ea48 (diff)
downloadrails-d656097734928e1f6b3c3bd884e128c4e299f2ec.tar.gz
rails-d656097734928e1f6b3c3bd884e128c4e299f2ec.tar.bz2
rails-d656097734928e1f6b3c3bd884e128c4e299f2ec.zip
Allow non-English values for collection_radio_buttons/check_boxes
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/form_collections_helper_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb
index aa72621c7d..bba529a98a 100644
--- a/actionview/test/template/form_collections_helper_test.rb
+++ b/actionview/test/template/form_collections_helper_test.rb
@@ -39,6 +39,13 @@ class FormCollectionsHelperTest < ActionView::TestCase
assert_select "label[for=user_active_no]", "No"
end
+ test "collection radio generates labels for non-English values correctly" do
+ with_collection_radio_buttons :user, :title, ["Господин", "Госпожа"], :to_s, :to_s
+
+ assert_select "input[type=radio]#user_title_господин"
+ assert_select "label[for=user_title_господин]", "Господин"
+ end
+
test "collection radio should sanitize collection values for labels correctly" do
with_collection_radio_buttons :user, :name, ["$0.99", "$1.99"], :to_s, :to_s
assert_select "label[for=user_name_099]", "$0.99"
@@ -299,6 +306,13 @@ class FormCollectionsHelperTest < ActionView::TestCase
assert_select "label[for=user_name_199]", "$1.99"
end
+ test "collection check boxes generates labels for non-English values correctly" do
+ with_collection_check_boxes :user, :title, ["Господин", "Госпожа"], :to_s, :to_s
+
+ assert_select "input[type=checkbox]#user_title_господин"
+ assert_select "label[for=user_title_господин]", "Господин"
+ end
+
test "collection check boxes accepts html options as the last element of array" do
collection = [[1, "Category 1", { class: "foo" }], [2, "Category 2", { class: "bar" }]]
with_collection_check_boxes :user, :active, collection, :first, :second