add spec and fix docs
This commit is contained in:
parent
239d535cac
commit
9fb03d584c
4 changed files with 23 additions and 3 deletions
|
@ -910,7 +910,9 @@ Injects CSS into this page.
|
||||||
* `code` String
|
* `code` String
|
||||||
* `userGesture` Boolean - Default false
|
* `userGesture` Boolean - Default false
|
||||||
|
|
||||||
Evaluates `code` in page. If `userGesture` is set will simulate user gesture.
|
Evaluates `code` in page. If `userGesture` is set will create user gesture context,
|
||||||
|
HTML api like `requestFullScreen` which require user action can take advantage
|
||||||
|
of this option for automation.
|
||||||
|
|
||||||
### WebContents.setAudioMuted(muted)
|
### WebContents.setAudioMuted(muted)
|
||||||
|
|
||||||
|
|
|
@ -225,11 +225,14 @@ Returns a `String` represents the user agent for guest page.
|
||||||
|
|
||||||
Injects CSS into guest page.
|
Injects CSS into guest page.
|
||||||
|
|
||||||
### `<webview>`.executeJavaScript(code)
|
### `<webview>`.executeJavaScript(code, userGesture)
|
||||||
|
|
||||||
* `code` String
|
* `code` String
|
||||||
|
* `userGesture` Boolean - Default false
|
||||||
|
|
||||||
Evaluates `code` in guest page.
|
Evaluates `code` in page. If `userGesture` is set will create user gesture context,
|
||||||
|
HTML api like `requestFullScreen` which require user action can take advantage
|
||||||
|
of this option for automation.
|
||||||
|
|
||||||
### `<webview>`.openDevTools()
|
### `<webview>`.openDevTools()
|
||||||
|
|
||||||
|
|
1
spec/fixtures/pages/fullscreen.html
vendored
Normal file
1
spec/fixtures/pages/fullscreen.html
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<video></video>
|
|
@ -261,3 +261,17 @@ describe '<webview> tag', ->
|
||||||
done()
|
done()
|
||||||
webview.src = "file://#{fixtures}/pages/dom-ready.html?port=#{port}"
|
webview.src = "file://#{fixtures}/pages/dom-ready.html?port=#{port}"
|
||||||
document.body.appendChild webview
|
document.body.appendChild webview
|
||||||
|
|
||||||
|
describe 'executeJavaScript', ->
|
||||||
|
it 'should support user gesture', (done) ->
|
||||||
|
listener = (e) ->
|
||||||
|
webview.removeEventListener 'enter-html-full-screen', listener
|
||||||
|
done()
|
||||||
|
listener2 = (e) ->
|
||||||
|
jsScript = 'document.getElementsByTagName("video")[0].webkitRequestFullScreen()'
|
||||||
|
webview.executeJavaScript jsScript, true
|
||||||
|
webview.removeEventListener 'did-finish-load', listener2
|
||||||
|
webview.addEventListener 'enter-html-full-screen', listener
|
||||||
|
webview.addEventListener 'did-finish-load', listener2
|
||||||
|
webview.src = "file://#{fixtures}/pages/fullscreen.html"
|
||||||
|
document.body.appendChild webview
|
||||||
|
|
Loading…
Reference in a new issue