Don't rely on real focus/blur events in tests
authorCheng Zhao <zcbenz@gmail.com>
Thu, 18 Jun 2015 08:31:55 +0000 (16:31 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 18 Jun 2015 08:31:55 +0000 (16:31 +0800)
It is super unreliable.

spec/api-app-spec.coffee

index 44de389..5c6591c 100644 (file)
@@ -1,6 +1,6 @@
 assert = require 'assert'
-app = require('remote').require 'app'
 remote = require 'remote'
+app = remote.require 'app'
 BrowserWindow = remote.require 'browser-window'
 
 describe 'app module', ->
@@ -40,5 +40,5 @@ describe 'app module', ->
         done()
       app.once 'browser-window-focus', (e, window) ->
         assert.equal w.id, window.id
-        w.hide()
-      w.show()
+        w.emit 'blur'
+      w.emit 'focus'