]> khamidou — GitHub mirrors - electron.git/commitdiff
Override default window.close, fixes #70.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 17 Feb 2014 10:18:52 +0000 (18:18 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 17 Feb 2014 10:19:55 +0000 (18:19 +0800)
renderer/lib/init.coffee
spec/api-browser-window-spec.coffee

index 8c061149cd460ca99f953db4804c7beb189d4ae3..01b72777ff03cbdd213c4f2913047515f152427e 100644 (file)
@@ -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 = {}
index c6a7283ff3d3c87b1cfeb98d398bc44c9daa97da..6f8cab50bd21b780225919a7f20486b7f75313c9 100644 (file)
@@ -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')