diff --git a/renderer/lib/init.coffee b/renderer/lib/init.coffee index 8c061149cd4..01b72777ff0 100644 --- a/renderer/lib/init.coffee +++ b/renderer/lib/init.coffee @@ -50,6 +50,11 @@ window.onerror = (error) -> else false +# Override default window.close, see: +# https://github.com/atom/atom-shell/issues/70 +window.close = -> + require('remote').getCurrentWindow().close() + # Override default window.open. window.open = (url, name, features) -> options = {} diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index c6a7283ff3d..6f8cab50bd2 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -33,7 +33,7 @@ describe 'browser-window module', -> w.loadUrl 'file://' + path.join(fixtures, 'api', 'beforeunload-false.html') describe 'window.close()', -> - xit 'should emit unload handler', (done) -> + it 'should emit unload handler', (done) -> w = new BrowserWindow(show: false) w.on 'closed', -> test = path.join(fixtures, 'api', 'close')