Skip to content
Browse files

Support Textareas#value

  • Loading branch information...
1 parent 32c1502 commit c621e651c9ba45bb4be06f32677321fc74b49175 @halogenandtoast halogenandtoast committed Jul 22, 2011
Showing with 14 additions and 8 deletions.
  1. +5 −5 spec/integration/session_spec.rb
  2. +9 −3 src/capybara.js
View
10 spec/integration/session_spec.rb
@@ -86,11 +86,11 @@
@session = Capybara::Session.new(:reusable_webkit, TestApp)
end
- def extract_results(session)
- YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text
- end
+ # def extract_results(session)
+ # YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text
+ # end
- it_should_behave_like 'attach_file'
- # it_should_behave_like "session"
+ # it_should_behave_like 'attach_file'
+ it_should_behave_like "session"
# it_should_behave_like "session with javascript support"
end
View
12 src/capybara.js
@@ -28,16 +28,22 @@ Capybara = {
},
text: function (index) {
- return this.nodes[index].innerText;
+ var node = this.nodes[index];
+ var type = (node.type || node.tagName).toLowerCase();
+ if (type == "textarea") {
+ return node.innerHTML;
+ } else {
+ return node.innerText;
+ }
},
attribute: function (index, name) {
switch(name) {
- case 'checked':
+ case 'checked':
return this.nodes[index].checked;
break;
- case 'disabled':
+ case 'disabled':
return this.nodes[index].disabled;
break;

0 comments on commit c621e65

Please sign in to comment.
Something went wrong with that request. Please try again.