Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
spec: Fix failing specs on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Jan 6, 2016
1 parent c4071a7 commit 9a55021
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions spec/webview-spec.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
assert = require 'assert'
path = require 'path'
http = require 'http'
url = require 'url'

describe '<webview> tag', ->
@timeout 10000
Expand Down Expand Up @@ -261,12 +262,12 @@ describe '<webview> tag', ->
it 'emits when favicon urls are received', (done) ->
webview.addEventListener 'page-favicon-updated', (e) ->
assert.equal e.favicons.length, 2
url =
pageUrl =
if process.platform is 'win32'
'file:///C:/favicon.png'
else
'file:///favicon.png'
assert.equal e.favicons[0], url
assert.equal e.favicons[0], pageUrl
done()
webview.src = "file://#{fixtures}/pages/a.html"
document.body.appendChild webview
Expand All @@ -281,7 +282,9 @@ describe '<webview> tag', ->
document.body.appendChild webview

describe 'did-navigate event', ->
pageUrl = "file://#{fixtures}/pages/webview-will-navigate.html"
p = path.join fixtures, 'pages', 'webview-will-navigate.html'
p = p.replace /\\/g, '/'
pageUrl = url.format protocol: 'file', slashes: true, pathname: p

it 'emits when a url that leads to outside of the page is clicked', (done) ->
webview.addEventListener 'did-navigate', (e) ->
Expand All @@ -293,7 +296,10 @@ describe '<webview> tag', ->

describe 'did-navigate-in-page event', ->
it 'emits when an anchor link is clicked', (done) ->
pageUrl = "file://#{fixtures}/pages/webview-did-navigate-in-page.html"
p = path.join fixtures, 'pages', 'webview-did-navigate-in-page.html'
p = p.replace /\\/g, '/'
pageUrl = url.format protocol: 'file', slashes: true, pathname: p

webview.addEventListener 'did-navigate-in-page', (e) ->
assert.equal e.url, "#{pageUrl}#test_content"
done()
Expand All @@ -310,7 +316,10 @@ describe '<webview> tag', ->
document.body.appendChild webview

it 'emits when window.location.hash is changed', (done) ->
pageUrl = "file://#{fixtures}/pages/webview-did-navigate-in-page-with-hash.html"
p = path.join fixtures, 'pages', 'webview-did-navigate-in-page-with-hash.html'
p = p.replace /\\/g, '/'
pageUrl = url.format protocol: 'file', slashes: true, pathname: p

webview.addEventListener 'did-navigate-in-page', (e) ->
assert.equal e.url, "#{pageUrl}#test"
done()
Expand Down

0 comments on commit 9a55021

Please sign in to comment.