mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Merge pull request #1054 from TimMoore/improve-change-event-test
Improve the test for change events when calling fill_in.
This commit is contained in:
commit
151034f01d
2 changed files with 4 additions and 2 deletions
|
@ -35,7 +35,7 @@ $(function() {
|
|||
$('body').append('<p id="focus_event_triggered">Focus Event triggered</p>');
|
||||
});
|
||||
$('#with_change_event').change(function() {
|
||||
if($(this).val() == '') $(this).val("Can't be empty");
|
||||
$('body').append($('<p class="change_event_triggered"></p>').text(this.value));
|
||||
});
|
||||
$('#checkbox_with_event').click(function() {
|
||||
$('body').append('<p id="checkbox_event_triggered">Checkbox event triggered</p>');
|
||||
|
|
|
@ -125,7 +125,9 @@ Capybara::SpecHelper.spec "#fill_in" do
|
|||
it 'should only trigger onchange once' do
|
||||
@session.visit('/with_js')
|
||||
@session.fill_in('with_change_event', :with => 'some value')
|
||||
@session.find(:css, '#with_change_event').value.should == 'some value'
|
||||
# click outside the field to trigger the change event
|
||||
@session.find(:css, 'body').click
|
||||
@session.find(:css, '.change_event_triggered', :match => :one).should have_text 'some value'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue