# Quit and closing a window run the page's beforeunload through Nacre's "Leave this page?" dialog (S057).
# Run: SMOKE_SIZE=1280x900 tools/smoke.sh tests/smoke/unload-quit.txt
# Expect: quit-ask shows the dialog; after Escape (stay) the tab is still there; quit again, answer Leave, the run
# ends by itself (the `log not reached` line never runs).
wait 3
resize 1280 900
set /theme/mode "dark"
open @PAGES@/dialogs.html
waitload
locate #t
wait 0.5
click @
wait 0.5
do quit
wait 1.2
shot quit-ask
expect /active/dialog true
key Escape
wait 0.5
expect /tab_count 1
status stayed
# Closing the window (last window: same as quit) asks too.
do close_window
wait 1.2
shot window-ask
expect /active/dialog true
key Escape
wait 0.5
expect /tab_count 1
status done
# Leave: the browser quits by itself.
do quit
wait 1
tap 700 542
wait 3
log not reached: the browser should have quit
quit
