Failing test for lazy translation in partial with block

This commit is contained in:
Marek Kasztelnik 2020-12-30 12:50:03 +01:00
parent be0ab856fc
commit 9e15560191
4 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,2 @@
<%= t('.foo') %>
<%= yield %>

View File

@ -0,0 +1 @@
<%= render("translations/templates/partial") %>

View File

@ -0,0 +1,2 @@
<%= render("translations/templates/partial") do %>
<% end %>

View File

@ -23,7 +23,8 @@ class TranslationHelperTest < ActiveSupport::TestCase
found_yield_single_argument: { foo: "Foo" },
found_yield_block: { foo: "Foo" },
array: { foo: { bar: "Foo Bar" } },
default: { foo: "Foo" }
default: { foo: "Foo" },
partial: { foo: "Partial foo" }
},
foo: "Foo",
hello: "<a>Hello World</a>",
@ -176,6 +177,14 @@ class TranslationHelperTest < ActiveSupport::TestCase
assert_equal "Foo", view.render(template: "translations/templates/found_yield_single_argument").strip
end
def test_finds_lazy_translation_scoped_by_partial
assert_equal "Partial foo", view.render(template: "translations/templates/partial_lazy_translation").strip
end
def test_finds_lazy_translation_scoped_by_partial_with_block
assert_equal "Partial foo", view.render(template: "translations/templates/partial_lazy_translation_block").strip
end
def test_finds_translation_scoped_by_partial_yielding_translation_and_key
assert_equal "translations.templates.found_yield_block.foo: Foo", view.render(template: "translations/templates/found_yield_block").strip
end