1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Adding test to cover the broken placeholder code

This test will expose the situation where i18n.t() is run twice on the placeholder - resulting in :placeholder => "raw" becoming placeholder="Raw" for many users.
This commit is contained in:
Andrew Jacobs 2015-01-05 15:32:46 -08:00
parent c679153ee9
commit 8f992f1185

View file

@ -12,6 +12,13 @@ class TextInputTest < ActionView::TestCase
assert_select 'textarea.text[placeholder="Put in some text"]'
end
test 'input generates a placeholder from the translations' do
store_translations(:en, simple_form: { placeholders: { user: { name: "placeholder from i18n en.simple_form.placeholders.user.name" } } }) do
with_input_for @user, :name, :text
assert_select 'textarea.text[placeholder="placeholder from i18n en.simple_form.placeholders.user.name"]'
end
end
test 'input gets maxlength from column definition for text attributes' do
with_input_for @user, :description, :text
assert_select 'textarea.text[maxlength="200"]'