email fields behave like text fields wrt the set function

This commit is contained in:
Joshua Krall 2011-07-13 16:03:18 -05:00 committed by Joe Ferris
parent 8674ef7a51
commit 9971edbf21
2 changed files with 7 additions and 1 deletions

View File

@ -503,6 +503,7 @@ describe Capybara::Driver::Webkit do
<form action="/" method="GET">
<input class="watch" type="text"/>
<input class="watch" type="password"/>
<input class="watch" type="email"/>
<textarea class="watch"></textarea>
<input class="watch" type="checkbox"/>
<input class="watch" type="radio"/>
@ -559,6 +560,11 @@ describe Capybara::Driver::Webkit do
subject.find("//li").map(&:text).should == keyevents
end
it "triggers email input events" do
subject.find("//input[@type='email']").first.set(newtext)
subject.find("//li").map(&:text).should == keyevents
end
it "triggers radio input events" do
subject.find("//input[@type='radio']").first.set(true)
subject.find("//li").map(&:text).should == %w(click change)

View File

@ -106,7 +106,7 @@ Capybara = {
set: function(index, value) {
var node = this.nodes[index];
var type = (node.type || node.tagName).toLowerCase();
if (type == "text" || type == "textarea" || type == "password") {
if (type == "text" || type == "textarea" || type == "password" || type == "email") {
this.trigger(index, "focus");
node.value = "";
var maxLength = this.attribute(index, "maxlength"),