Skip to content

Commit

Permalink
Support Textareas#value
Browse files Browse the repository at this point in the history
  • Loading branch information
halogenandtoast committed Jul 29, 2011
1 parent 32c1502 commit c621e65
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 5 additions & 5 deletions spec/integration/session_spec.rb
Expand Up @@ -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
12 changes: 9 additions & 3 deletions src/capybara.js
Expand Up @@ -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;

Expand Down

0 comments on commit c621e65

Please sign in to comment.