spec: Make dom-ready spec stronger

This commit is contained in:
Cheng Zhao 2015-07-24 15:48:13 +08:00
parent 1a93b1db52
commit b52c07f650
5 changed files with 24 additions and 36 deletions

View file

@ -257,25 +257,3 @@ describe 'browser-window module', ->
assert.equal url, 'https://www.github.com/'
done()
w.loadUrl "file://#{fixtures}/pages/will-navigate.html"
describe 'dom-ready event', ->
return if isCI and process.platform is 'darwin'
it 'emits when document is loaded', (done) ->
ipc = remote.require 'ipc'
server = http.createServer (req, res) ->
action = url.parse(req.url, true).pathname
if action == '/logo.png'
img = fs.readFileSync(path.join(fixtures, 'assets', 'logo.png'))
res.writeHead(200, {'Content-Type': 'image/png'})
setTimeout ->
res.end(img, 'binary')
, 2000
server.close()
server.listen 62542, '127.0.0.1'
ipc.on 'dom-ready', (e, state) ->
ipc.removeAllListeners 'dom-ready'
assert.equal state, 'interactive'
done()
w.webContents.on 'did-finish-load', ->
w.close()
w.loadUrl "file://#{fixtures}/pages/f.html"