Skip to content

Commit

Permalink
Trigger change event on checkbox and radio button when checked state …
Browse files Browse the repository at this point in the history
…is changed
  • Loading branch information
Vasily Reys authored and jferris committed Jun 14, 2011
1 parent d7f491d commit 465e5ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/driver_spec.rb
Expand Up @@ -467,12 +467,12 @@

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

Expand Down
1 change: 1 addition & 0 deletions src/capybara.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 465e5ed

Please sign in to comment.