aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper/form_with_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/form_with_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/form_with_test.rb')
-rw-r--r--actionview/test/template/form_helper/form_with_test.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb
index 0d224d0c46..42905b1ec5 100644
--- a/actionview/test/template/form_helper/form_with_test.rb
+++ b/actionview/test/template/form_helper/form_with_test.rb
@@ -190,6 +190,9 @@ class FormWithActsLikeFormForTest < FormWithTest
submit: "Save changes",
another_post: {
update: "Update your %{model}"
+ },
+ "blog/post": {
+ update: "Update your %{model}"
}
}
}
@@ -962,7 +965,7 @@ class FormWithActsLikeFormForTest < FormWithTest
end
end
- def test_submit_with_object_and_nested_lookup
+ def test_submit_with_object_which_is_overwritten_by_scope_option
with_locale :submit do
form_with(model: @post, scope: :another_post) do |f|
concat f.submit
@@ -976,6 +979,21 @@ class FormWithActsLikeFormForTest < FormWithTest
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_with(model: blog_post) do |f|
+ concat f.submit
+ end
+
+ expected = whole_form("/posts/44", 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_fields_with_attributes_not_on_model
form_with(model: @post) do |f|
concat f.fields(:comment) { |c|