Revert "Return html inside textareas when page is loaded. Closes #1025"

It seems like textareas must not contain HTML content according to the
HTML spec.

This reverts commit ca4781f186.

Conflicts:
	lib/capybara/spec/session/node_spec.rb
This commit is contained in:
Jonas Nicklas 2013-03-27 14:54:16 +01:00
parent 6ce45f2efb
commit 2d5c8e066f
5 changed files with 4 additions and 9 deletions

View File

@ -74,7 +74,7 @@ module Capybara
#
def value
if tag_name == 'textarea'
native.inner_html.sub(/\A\n/, '')
native.content.sub(/\A\n/, '')
elsif tag_name == 'select'
if native['multiple'] == 'multiple'
native.xpath(".//option[@selected='selected']").map { |option| option[:value] || option.content }

View File

@ -60,7 +60,7 @@ class Capybara::RackTest::Form < Capybara::RackTest::Node
merge_param!(params, field['name'].to_s, (option['value'] || option.text).to_s) if option
end
when 'textarea'
merge_param!(params, field['name'].to_s, field.inner_html.to_s)
merge_param!(params, field['name'].to_s, field.text.to_s)
end
end
merge_param!(params, button[:name], button[:value] || "") if button[:name]

View File

@ -27,7 +27,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
elsif input_field?
set_input(value)
elsif textarea?
native.inner_html = value.to_s unless self[:readonly]
native.content = value.to_s unless self[:readonly]
end
end

View File

@ -58,14 +58,10 @@ Capybara::SpecHelper.spec "node" do
@session.find('//textarea[@id="additional_newline"]').value.should == "\nbanana"
end
it "return any HTML content added to textarea" do
it "return any HTML content in textarea" do
@session.find('//textarea[1]').set("some <em>html</em> here")
@session.find('//textarea[1]').value.should == "some <em>html</em> here"
end
it "return any HTML content in textarea" do
@session.find(:css, 'textarea#with-html').value.should == "contains <em>html</em>"
end
end
describe "#set" do

View File

@ -37,7 +37,6 @@ banana</textarea>
banana</textarea>
<textarea readonly="readonly">textarea should not change</textarea>
<textarea id="with-html">contains <em>html</em></textarea>
<a href="/redirect_back">BackToMyself</a>
<a title="twas a fine link" href="/redirect">A link came first</a>
<a title="a fine link" href="/with_simple_html">A link</a>