Support Textareas#value

This commit is contained in:
Matthew Mongeau 2011-07-22 15:21:17 -04:00
parent 32c1502449
commit c621e651c9
2 changed files with 14 additions and 8 deletions

View File

@ -86,11 +86,11 @@ describe Capybara::Session, "with TestApp" do
@session = Capybara::Session.new(:reusable_webkit, TestApp) @session = Capybara::Session.new(:reusable_webkit, TestApp)
end end
def extract_results(session) # def extract_results(session)
YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text # YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text
end # end
it_should_behave_like 'attach_file' # it_should_behave_like 'attach_file'
# it_should_behave_like "session" it_should_behave_like "session"
# it_should_behave_like "session with javascript support" # it_should_behave_like "session with javascript support"
end end

View File

@ -28,16 +28,22 @@ Capybara = {
}, },
text: function (index) { 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) { attribute: function (index, name) {
switch(name) { switch(name) {
case 'checked': case 'checked':
return this.nodes[index].checked; return this.nodes[index].checked;
break; break;
case 'disabled': case 'disabled':
return this.nodes[index].disabled; return this.nodes[index].disabled;
break; break;