From 541b36917559bd2639c16746c9e010184e494b40 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Fri, 27 Oct 2017 11:44:41 -0700 Subject: [PATCH 1/3] :construction_worker: Add a spec --- spec/api-browser-view-spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/api-browser-view-spec.js b/spec/api-browser-view-spec.js index 9e2078ff727e..6debec2a7682 100644 --- a/spec/api-browser-view-spec.js +++ b/spec/api-browser-view-spec.js @@ -90,6 +90,21 @@ describe('BrowserView module', () => { }) }) + describe('BrowserWindow.getBrowserView()', () => { + it('returns the set view', () => { + view = new BrowserView() + w.setBrowserView(view) + assert.notEqual(view.id, null) + let view2 = w.getBrowserView() + assert.equal(view2.webContents.id, view.webContents.id) + }) + + it('returns null if none is set', () => { + let view = w.getBrowserView() + assert.equal(null, view) + }) + }) + describe('BrowserView.webContents.getOwnerBrowserWindow()', () => { it('points to owning window', () => { view = new BrowserView() From 29a85bc928a0c2e9b3523d6bae2131f0a74db0fa Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Fri, 27 Oct 2017 11:44:48 -0700 Subject: [PATCH 2/3] :memo: Document it --- docs/api/browser-window.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index e2b7c3f048d2..8d61d518f761 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -1443,6 +1443,10 @@ removed in future Electron releases. * `browserView` [BrowserView](browser-view.md) +#### `win.getBrowserView()` _Experimental_ + +Returns `BrowserView` - an attached BrowserView. Returns `null` if none is attached. + **Note:** The BrowserView API is currently experimental and may change or be removed in future Electron releases. From 7bad679a69f558270ba366aadee89a87a1effb9a Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Fri, 27 Oct 2017 12:14:09 -0700 Subject: [PATCH 3/3] :memo: Correct types --- docs/api/browser-window.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 8d61d518f761..acd141695ac7 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -1445,7 +1445,7 @@ removed in future Electron releases. #### `win.getBrowserView()` _Experimental_ -Returns `BrowserView` - an attached BrowserView. Returns `null` if none is attached. +Returns `BrowserView | null` - an attached BrowserView. Returns `null` if none is attached. **Note:** The BrowserView API is currently experimental and may change or be removed in future Electron releases.