spec: Native modules should work after navigation in webview
This commit is contained in:
parent
36c4b1705d
commit
3ff2959f0c
2 changed files with 22 additions and 0 deletions
9
spec/fixtures/pages/native-module.html
vendored
Normal file
9
spec/fixtures/pages/native-module.html
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var path = require('path');
|
||||
console.log(typeof require(path.join(__dirname, '..', '..', 'node_modules', 'runas')));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -47,6 +47,19 @@ describe '<webview> tag', ->
|
|||
webview.src = "file://#{fixtures}/pages/d.html"
|
||||
document.body.appendChild webview
|
||||
|
||||
it 'loads native modules when navigation happens', (done) ->
|
||||
listener = (e) ->
|
||||
webview.removeEventListener 'did-finish-load', listener
|
||||
listener2 = (e) ->
|
||||
assert.equal e.message, 'function'
|
||||
done()
|
||||
webview.addEventListener 'console-message', listener2
|
||||
webview.src = "file://#{fixtures}/pages/native-module.html"
|
||||
webview.addEventListener 'did-finish-load', listener
|
||||
webview.setAttribute 'nodeintegration', 'on'
|
||||
webview.src = "file://#{fixtures}/pages/native-module.html"
|
||||
document.body.appendChild webview
|
||||
|
||||
describe 'preload attribute', ->
|
||||
it 'loads the script before other scripts in window', (done) ->
|
||||
listener = (e) ->
|
||||
|
|
Loading…
Reference in a new issue