Move tests to the right place and add missing case
This commit is contained in:
parent
b2a8814a72
commit
ad9bf4b9aa
|
@ -141,29 +141,4 @@ class HintTest < ActionView::TestCase
|
||||||
assert_select 'div.omg_hint', "can't be blank"
|
assert_select 'div.omg_hint', "can't be blank"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'optional hint displays when given' do
|
|
||||||
swap_wrapper :default, self.custom_wrapper_with_optional_div do
|
|
||||||
with_form_for @user, :name, hint: "can't be blank"
|
|
||||||
assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "can't be blank"
|
|
||||||
assert_select 'p.omg_hint'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test 'optional hint displays empty wrapper when no hint given' do
|
|
||||||
swap_wrapper :default, self.custom_wrapper_with_optional_div do
|
|
||||||
with_form_for @user, :name
|
|
||||||
assert_select 'section.custom_wrapper div.no_output_wrapper'
|
|
||||||
assert_no_select 'p.omg_hint'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test 'optional hint displays no wrapper or hint when no hint and override is given' do
|
|
||||||
swap_wrapper :default, self.custom_wrapper_with_optional_div_and_override do
|
|
||||||
with_form_for @user, :name
|
|
||||||
assert_no_select 'section.custom_wrapper div.no_output_wrapper'
|
|
||||||
assert_no_select 'div.no_output_wrapper'
|
|
||||||
assert_no_select 'p.omg_hint'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -267,4 +267,38 @@ class WrapperTest < ActionView::TestCase
|
||||||
|
|
||||||
assert_select "div.custom_wrapper input.string[data-modal=true]"
|
assert_select "div.custom_wrapper input.string[data-modal=true]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'inline wrapper displays when there is content' do
|
||||||
|
swap_wrapper :default, self.custom_wrapper_with_optional_div do
|
||||||
|
with_form_for @user, :name, hint: "can't be blank"
|
||||||
|
assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "can't be blank"
|
||||||
|
assert_select 'p.omg_hint'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'inline wrapper does not display when there is no content' do
|
||||||
|
swap_wrapper :default, self.custom_wrapper_with_optional_div do
|
||||||
|
with_form_for @user, :name
|
||||||
|
assert_select 'section.custom_wrapper div.no_output_wrapper'
|
||||||
|
assert_no_select 'p.omg_hint'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'optional wrapper does not display when there is content' do
|
||||||
|
swap_wrapper :default, self.custom_wrapper_with_optional_div_and_override do
|
||||||
|
with_form_for @user, :name, hint: "can't be blank"
|
||||||
|
assert_select 'section.custom_wrapper div.no_output_wrapper'
|
||||||
|
assert_select 'div.no_output_wrapper'
|
||||||
|
assert_select 'p.omg_hint'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'optional wrapper does not display when there is no content' do
|
||||||
|
swap_wrapper :default, self.custom_wrapper_with_optional_div_and_override do
|
||||||
|
with_form_for @user, :name
|
||||||
|
assert_no_select 'section.custom_wrapper div.no_output_wrapper'
|
||||||
|
assert_no_select 'div.no_output_wrapper'
|
||||||
|
assert_no_select 'p.omg_hint'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue