Trigger change event on checkbox and radio button when checked state is changed
This commit is contained in:
parent
d7f491d7e0
commit
465e5edb12
|
@ -467,12 +467,12 @@ describe Capybara::Driver::Webkit do
|
|||
|
||||
it "triggers radio input events" do
|
||||
subject.find("//input[@type='radio']").first.set(true)
|
||||
subject.find("//li").map(&:text).should == %w(click)
|
||||
subject.find("//li").map(&:text).should == %w(click change)
|
||||
end
|
||||
|
||||
it "triggers checkbox events" do
|
||||
subject.find("//input[@type='checkbox']").first.set(true)
|
||||
subject.find("//li").map(&:text).should == %w(click)
|
||||
subject.find("//li").map(&:text).should == %w(click change)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ Capybara = {
|
|||
} else if(type == "checkbox" || type == "radio") {
|
||||
node.checked = (value == "true");
|
||||
this.trigger(index, "click");
|
||||
this.trigger(index, "change");
|
||||
} else {
|
||||
node.value = value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue