aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper_test.rb
diff options
context:
space:
mode:
authorRui Onodera <deraru@gmail.com>2016-10-16 21:21:03 +0900
committerRui Onodera <deraru@gmail.com>2018-02-27 11:41:56 +0900
commite579c7430ab94d1bf31b91d3973b26ab69c8503c (patch)
tree88cfe43e1bf902376d19934da4ca90ccf2c98b04 /actionview/test/template/form_helper_test.rb
parentf7157e48ea233eab56844dba4203f5149d910eaa (diff)
downloadrails-e579c7430ab94d1bf31b91d3973b26ab69c8503c.tar.gz
rails-e579c7430ab94d1bf31b91d3973b26ab69c8503c.tar.bz2
rails-e579c7430ab94d1bf31b91d3973b26ab69c8503c.zip
Change translation key of submit_tag from module_name_class_name to module_name/class_name
Currently submit_tag value translation does not support i18n key style locale key. It confuses me a bit because many other components support i18n key style locale key. I added i18n key style locale key support to submit tag.
Diffstat (limited to 'actionview/test/template/form_helper_test.rb')
-rw-r--r--actionview/test/template/form_helper_test.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
index b8fad090c5..a55811b67b 100644
--- a/actionview/test/template/form_helper_test.rb
+++ b/actionview/test/template/form_helper_test.rb
@@ -68,6 +68,9 @@ class FormHelperTest < ActionView::TestCase
submit: "Save changes",
another_post: {
update: "Update your %{model}"
+ },
+ "blog/post": {
+ update: "Update your %{model}"
}
}
}
@@ -2271,7 +2274,7 @@ class FormHelperTest < ActionView::TestCase
end
end
- def test_submit_with_object_and_nested_lookup
+ def test_submit_with_object_which_is_overwritten_by_as_option
with_locale :submit do
form_for(@post, as: :another_post) do |f|
concat f.submit
@@ -2285,6 +2288,21 @@ class FormHelperTest < ActionView::TestCase
end
end
+ def test_submit_with_object_which_is_namespaced
+ blog_post = Blog::Post.new("And his name will be forty and four.", 44)
+ with_locale :submit do
+ form_for(blog_post) do |f|
+ concat f.submit
+ end
+
+ expected = whole_form("/posts/44", "edit_post_44", "edit_post", method: "patch") do
+ "<input name='commit' data-disable-with='Update your Post' type='submit' value='Update your Post' />"
+ end
+
+ assert_dom_equal expected, output_buffer
+ end
+ end
+
def test_nested_fields_for
@comment.body = "Hello World"
form_for(@post) do |f|