Assert the absent of tags not the escaped text
Nokogiri doesn't escape the output
This commit is contained in:
parent
1f17d5768d
commit
914b58cb9d
|
@ -82,7 +82,7 @@ class ErrorTest < ActionView::TestCase
|
|||
|
||||
test 'error escapes error prefix text' do
|
||||
with_error_for @user, :name, error_prefix: '<b>Name</b>'
|
||||
assert_select 'span.error', "<b>Name</b> can't be blank"
|
||||
assert_no_select 'span.error b'
|
||||
end
|
||||
|
||||
test 'error generates an error message with raw HTML tags' do
|
||||
|
|
|
@ -50,7 +50,7 @@ class HintTest < ActionView::TestCase
|
|||
|
||||
test 'builder escapes hint text' do
|
||||
with_hint_for @user, :name, hint: '<script>alert(1337)</script>'
|
||||
assert_select 'span.hint', "<script>alert(1337)</script>"
|
||||
assert_no_select 'span.hint script'
|
||||
end
|
||||
|
||||
# Without attribute name
|
||||
|
@ -137,8 +137,8 @@ class HintTest < ActionView::TestCase
|
|||
|
||||
test 'hint with custom wrappers works' do
|
||||
swap_wrapper do
|
||||
with_hint_for @user, :name, hint: "can't be blank"
|
||||
assert_select 'div.omg_hint', "can't be blank"
|
||||
with_hint_for @user, :name, hint: "cannot be blank"
|
||||
assert_select 'div.omg_hint', "cannot be blank"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ class LabelTest < ActionView::TestCase
|
|||
|
||||
test 'builder escapes label text' do
|
||||
with_label_for @user, :name, label: '<script>alert(1337)</script>', required: false
|
||||
assert_select 'label.string', "<script>alert(1337)</script>"
|
||||
assert_no_select 'label.string script'
|
||||
end
|
||||
|
||||
test 'builder does not escape label text if it is safe' do
|
||||
|
|
|
@ -270,8 +270,8 @@ class WrapperTest < ActionView::TestCase
|
|||
|
||||
test 'inline wrapper displays when there is content' do
|
||||
swap_wrapper :default, self.custom_wrapper_with_wrapped_optional_component 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"
|
||||
with_form_for @user, :name, hint: "cannot be blank"
|
||||
assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "cannot be blank"
|
||||
assert_select 'p.omg_hint'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -57,7 +57,7 @@ class BooleanInputTest < ActionView::TestCase
|
|||
test 'input boolean with nested escapes :inline_label with HTML' do
|
||||
swap SimpleForm, boolean_style: :nested do
|
||||
with_input_for @user, :active, :boolean, inline_label: '<b>I am so inline.</b>'
|
||||
assert_select 'label.checkbox', text: ' <b>I am so inline.</b>'
|
||||
assert_no_select 'label.checkbox b'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue