Use #click instead of #toggle for Selenium, Closes #50
This commit is contained in:
parent
b8154a2f32
commit
d298f4dc8c
|
@ -31,7 +31,7 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
|||
elsif tag_name == 'input' and type == 'radio'
|
||||
node.select
|
||||
elsif tag_name == 'input' and type == 'checkbox'
|
||||
node.toggle
|
||||
node.click
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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 @@ shared_examples_for "session with javascript support" do
|
|||
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')
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue