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

test nested modal calls work correctly

This commit is contained in:
Thomas Walpole 2015-09-28 16:19:04 -07:00
parent 5542d127b0
commit 91e09a793d
3 changed files with 22 additions and 0 deletions

View file

@ -100,6 +100,13 @@ $(function() {
$(this).attr('response', response);
}
});
$('#open-twice').click(function() {
if (confirm('Are you sure?')) {
if (!confirm('Are you really sure?')) {
$(this).attr('confirmed', 'false');
}
}
})
$('#delayed-page-change').click(function() {
setTimeout(function() {
window.location.pathname = '/with_html'

View file

@ -16,4 +16,15 @@ Capybara::SpecHelper.spec '#accept_confirm', :requires => [:modals] do
end
expect(message).to eq('Confirm opened')
end
it "should work with nested modals", focus: true do
expect {
@session.dismiss_confirm 'Are you really sure?' do
@session.accept_confirm 'Are you sure?' do
@session.click_link('Open check twice')
end
end
}.not_to raise_error
expect(@session).to have_xpath("//a[@id='open-twice' and @confirmed='false']")
end
end

View file

@ -85,6 +85,10 @@
<a href="#" id="open-confirm">Open confirm</a>
</p>
<p>
<a href="#" id="open-twice">Open check twice</a>
</p>
<p>
<a href="#" id="open-prompt">Open prompt</a>
</p>