mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Translate the attributes prefixed with _html to keep the html markup.
This commit is contained in:
parent
613cf4bf26
commit
337fce04f3
2 changed files with 13 additions and 0 deletions
|
@ -178,10 +178,14 @@ module SimpleForm
|
|||
model_names.shift
|
||||
|
||||
lookups << :"#{joined_model_names}.#{lookup_action}.#{reflection_or_attribute_name}"
|
||||
lookups << :"#{joined_model_names}.#{lookup_action}.#{reflection_or_attribute_name}_html"
|
||||
lookups << :"#{joined_model_names}.#{reflection_or_attribute_name}"
|
||||
lookups << :"#{joined_model_names}.#{reflection_or_attribute_name}_html"
|
||||
end
|
||||
lookups << :"defaults.#{lookup_action}.#{reflection_or_attribute_name}"
|
||||
lookups << :"defaults.#{lookup_action}.#{reflection_or_attribute_name}_html"
|
||||
lookups << :"defaults.#{reflection_or_attribute_name}"
|
||||
lookups << :"defaults.#{reflection_or_attribute_name}_html"
|
||||
lookups << default
|
||||
|
||||
t(lookups.shift, scope: :"#{i18n_scope}.#{namespace}", default: lookups).presence
|
||||
|
|
|
@ -115,6 +115,15 @@ class StringInputTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test 'input should translate a key prefixed with _html and return the html markup' do
|
||||
store_translations(:en, simple_form: { labels: { user: {
|
||||
name_html: '<b>Name</b>'
|
||||
} } }) do
|
||||
with_input_for @user, :name, :string
|
||||
assert_select 'label b', 'Name'
|
||||
end
|
||||
end
|
||||
|
||||
[:email, :url, :search, :tel].each do |type|
|
||||
test "input should allow type #{type}" do
|
||||
with_input_for @user, :name, type
|
||||
|
|
Loading…
Reference in a new issue