1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Merge pull request #2071 from elliterate/chores/improve-not-interactable-checkbox-test

Add test for clicking label of a blocked element
This commit is contained in:
Thomas Walpole 2018-07-19 15:04:33 -07:00 committed by GitHub
commit d386f3e8c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -195,6 +195,13 @@ Capybara::SpecHelper.spec '#check' do
@session.click_button('awesome')
expect(extract_results(@session)['cars']).to include('pagani')
end
it 'should check via the label if input is visible but blocked by another element' do
expect(@session.find(:checkbox, 'form_cars_bugatti', unchecked: true, visible: :all)).to be_truthy
@session.check('form_cars_bugatti', allow_label_click: true)
@session.click_button('awesome')
expect(extract_results(@session)['cars']).to include('bugatti')
end
end
end
end

View file

@ -185,6 +185,12 @@ New line after and before textarea tag
<label for="form_cars_ferrari">Ferrari</label>
<input type="checkbox" value="pagani" name="form[cars][]" id="form_cars_pagani" style="position: absolute; left: -9999px"/>
<label for="form_cars_pagani">Pagani</label>
<div style="position: relative;">
<input type="checkbox" value="bugatti" name="form[cars][]" id="form_cars_bugatti"/>
<div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-color: #fff;">
<label for="form_cars_bugatti">Bugatti</label>
</div>
</div>
<input type="checkbox" value="ariel" name="form[cars][]" id="form_cars_ariel" style="display: none"/>
<input type="checkbox" value="porsche" name="form[cars][]" id="form_cars_porsche" checked="checked" style="display: none"/>
<label>