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:
parent
5542d127b0
commit
91e09a793d
3 changed files with 22 additions and 0 deletions
|
@ -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'
|
||||
|
|
|
@ -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
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue