Permalink
Browse files

Use #click instead of #toggle for Selenium, Closes #50

  • Loading branch information...
1 parent b8154a2 commit d298f4dc8c5030db1708fa3c10cc45afca2f9b23 @jnicklas jnicklas committed Feb 27, 2010
@@ -31,7 +31,7 @@ def set(value)
elsif tag_name == 'input' and type == 'radio'
node.select
elsif tag_name == 'input' and type == 'checkbox'
- node.toggle
+ node.click
end
end
View
@@ -27,4 +27,7 @@ $(function() {
$('#with_focus_event').focus(function() {
$('body').append('<p id="focus_event_triggered">Focus Event triggered</p>')
});
-});
+ $('#checkbox_with_event').click(function() {
+ $('body').append('<p id="checkbox_event_triggered">Checkbox event triggered</p>')
+ });
+});
@@ -132,6 +132,14 @@
end
end
+ describe '#check' do
+ it "should trigger associated events" do
+ @session.visit('/with_js')
+ @session.check('checkbox_with_event')
+ @session.should have_css('#checkbox_event_triggered');
+ end
+ end
+
describe '#has_xpath?' do
it "should wait for content to appear" do
@session.visit('/with_js')
View
@@ -30,5 +30,10 @@
<p>
<input type="text" name="with_focus_event" value="" id="with_focus_event"/>
</p>
+
+ <p>
+ <input type="checkbox" id="checkbox_with_event"/>
+ </p>
</body>
</html>
+

0 comments on commit d298f4d

Please sign in to comment.