Skip to content

Commit

Permalink
Revert "Ensure generated components are html safe."
Browse files Browse the repository at this point in the history
This reverts commit 3dbdb0a.
  • Loading branch information
josevalim committed Jan 10, 2010
1 parent 3dbdb0a commit 81fe28c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 27 deletions.
4 changes: 1 addition & 3 deletions lib/simple_form/components/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def initialize(builder, component)
# component is invalid it will be skipped.
def call
return @component.call unless valid?
safe_content = content.html_safe! + @component.call
safe_content.html_safe! if safe_content.respond_to?(:html_safe!)
safe_content
content + @component.call
end

def valid?
Expand Down
6 changes: 0 additions & 6 deletions test/components/error_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ def with_error_for(object, attribute_name, type, options={}, &block)
end
end

test 'error should be html safe' do
with_error_for @user, :name, :string do |error|
assert error.call.html_safe?
end
end

test 'error should generate messages for attribute with single error' do
with_error_for @user, :name, :string
assert_select 'span.error', "can't be blank"
Expand Down
6 changes: 0 additions & 6 deletions test/components/hint_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ def with_hint_for(object, attribute_name, type, options={}, &block)
end
end

test 'hint should be html safe' do
with_hint_for @user, :name, :string, :hint => 'Use with care...' do |hint|
assert hint.call.html_safe?
end
end

test 'hint should be generated with input text' do
with_hint_for @user, :name, :string, :hint => 'Use with care...'
assert_select 'span.hint', 'Use with care...'
Expand Down
6 changes: 0 additions & 6 deletions test/components/input_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ def with_input_for(object, attribute_name, type, options={})
end
end

test 'input should be html safe' do
with_input_for @user, :name, :string do |input|
assert input.call.html_safe?
end
end

test 'input should map text field to string attribute' do
with_input_for @user, :name, :string
assert_select 'input[name=\'user[name]\'][id=user_name][value=New in Simple Form!]'
Expand Down
6 changes: 0 additions & 6 deletions test/components/label_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ def with_label_for(object, attribute_name, type, options={})
end
end

test 'label should be html safe' do
with_label_for @user, :name, :string do |label|
assert label.call.html_safe?
end
end

test 'label should not be generated for hidden inputs' do
with_label_for @user, :name, :hidden do |label|
assert label.call.blank?
Expand Down

0 comments on commit 81fe28c

Please sign in to comment.