Permalink
Browse files

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

  • Loading branch information...
jnicklas committed Mar 26, 2013
1 parent af85687 commit ca4781f186831f46b0549220389c95357d0863db
@@ -74,7 +74,7 @@ def path
#
def value
if tag_name == 'textarea'
- native.content.sub(/\A\n/, '')
+ native.inner_html.sub(/\A\n/, '')
elsif tag_name == 'select'
if native['multiple'] == 'multiple'
native.xpath(".//option[@selected='selected']").map { |option| option[:value] || option.content }
@@ -60,7 +60,7 @@ def params(button)
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.text.to_s)
+ merge_param!(params, field['name'].to_s, field.inner_html.to_s)
end
end
merge_param!(params, button[:name], button[:value] || "") if button[:name]
@@ -27,7 +27,7 @@ def set(value)
elsif input_field?
set_input(value)
elsif textarea?
- native.content = value.to_s unless self[:readonly]
+ native.inner_html = value.to_s unless self[:readonly]
end
end
@@ -58,10 +58,14 @@
@session.find('//textarea[@id="additional_newline"]').value.should == "\nbanana"
end
- it "return any HTML content in textarea" do
+ it "return any HTML content added to 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", :focus => true do
+ @session.find(:css, 'textarea#with-html').value.should == "contains <em>html</em>"
+ end
end
describe "#set" do
@@ -35,6 +35,7 @@ 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>

0 comments on commit ca4781f

Please sign in to comment.