Add 'loading-state-changed' event for BrowserWindow.

It's required for testing the BrowserWindow class.
This commit is contained in:
Cheng Zhao 2013-08-29 11:47:07 +08:00
parent e00d3d4b37
commit 34e1800716
5 changed files with 32 additions and 2 deletions

View file

@ -31,3 +31,19 @@ describe 'window module', ->
assert.equal String(content), 'close'
done()
w.loadUrl 'file://' + path.join(fixtures, 'api', 'close.html')
describe 'BrowserWindow.loadUrl(url)', ->
it 'should emit loading-state-changed event', (done) ->
w = new BrowserWindow(show: false)
count = 0
w.on 'loading-state-changed', (event, isLoading) ->
if count == 0
assert.equal isLoading, true
else if count == 1
assert.equal isLoading, false
done()
else
assert false
++count
w.loadUrl 'about:blank'