mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Update specs to match the documents.
This commit is contained in:
@@ -74,6 +74,12 @@ describe 'window module', ->
|
||||
done()
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-true.html')
|
||||
|
||||
it 'returning non-empty string would not prevent close', (done) ->
|
||||
w = new BrowserWindow(show: false)
|
||||
w.on 'closed', ->
|
||||
done()
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-string.html')
|
||||
|
||||
it 'returning false would prevent close', (done) ->
|
||||
w = new BrowserWindow(show: false)
|
||||
w.on 'onbeforeunload', ->
|
||||
@@ -81,9 +87,9 @@ describe 'window module', ->
|
||||
done()
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-false.html')
|
||||
|
||||
it 'returning non-empty string would prevent close', (done) ->
|
||||
it 'returning empty string would prevent close', (done) ->
|
||||
w = new BrowserWindow(show: false)
|
||||
w.on 'onbeforeunload', ->
|
||||
w.destroy()
|
||||
done()
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-string.html')
|
||||
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close-beforeunload-empty-string.html')
|
||||
|
||||
13
spec/fixtures/api/close-beforeunload-empty-string.html
vendored
Normal file
13
spec/fixtures/api/close-beforeunload-empty-string.html
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.onbeforeunload = function() {
|
||||
setTimeout(function() {
|
||||
require('remote').getCurrentWindow().emit('onbeforeunload');
|
||||
}, 0);
|
||||
return '';
|
||||
}
|
||||
window.close();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user