Permalink
Browse files

Prove that HTML in textareas is handled correctly

  • Loading branch information...
1 parent 11993c2 commit 983acc93dab65a22dea514e89ff1af863542c7e1 @jnicklas jnicklas committed Mar 26, 2013
@@ -51,6 +51,12 @@
extract_results(@session)['password'].should == 'supasikrit'
end
+ it "should handle HTML in a textarea" do
+ @session.fill_in('form_description', :with => 'is <strong>very</strong> secret!')
+ @session.click_button('awesome')
+ extract_results(@session)['description'].should == 'is <strong>very</strong> secret!'
+ end
+
it "should fill in a field with a custom type" do
@session.fill_in('Schmooo', :with => 'Schmooo is the game')
@session.click_button('awesome')
@@ -57,6 +57,11 @@
it "should not swallow extra newlines in textarea" do
@session.find('//textarea[@id="additional_newline"]').value.should == "\nbanana"
end
+
+ it "return any HTML content in textarea", :focus => true do
+ @session.find('//textarea[1]').set("some <em>html</em> here")
+ @session.find('//textarea[1]').value.should == "some <em>html</em> here"
+ end
end
describe "#set" do
@@ -78,7 +78,7 @@ def quietly
end
def extract_results(session)
- YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text.lstrip
+ YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.inner_html.lstrip
end
end
end

0 comments on commit 983acc9

Please sign in to comment.