From ccdeb4746ec25555b11709b19742e1f1b7fe7cb8 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 13 Apr 2017 00:52:07 +0300 Subject: [PATCH] Destroy BrowserViews after each test --- spec/api-browser-view-spec.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/spec/api-browser-view-spec.js b/spec/api-browser-view-spec.js index fc138b0b6f1..3ccb9502c23 100644 --- a/spec/api-browser-view-spec.js +++ b/spec/api-browser-view-spec.js @@ -8,6 +8,7 @@ const {BrowserView, BrowserWindow} = remote describe('View module', function () { var w = null + var view = null beforeEach(function () { w = new BrowserWindow({ @@ -21,17 +22,22 @@ describe('View module', function () { }) afterEach(function () { + if (view) { + view.destroy() + view = null + } + return closeWindow(w).then(function () { w = null }) }) describe('BrowserView.setBackgroundColor()', function () { it('does not throw for valid args', function () { - const view = new BrowserView() + view = new BrowserView() view.setBackgroundColor('#000') }) it('throws for invalid args', function () { - const view = new BrowserView() + view = new BrowserView() assert.throws(function () { view.setBackgroundColor(null) }, /conversion failure/) @@ -40,13 +46,13 @@ describe('View module', function () { describe('BrowserView.setAutoResize()', function () { it('does not throw for valid args', function () { - const view = new BrowserView() + view = new BrowserView() view.setAutoResize({}) view.setAutoResize({ width: true, height: false }) }) it('throws for invalid args', function () { - const view = new BrowserView() + view = new BrowserView() assert.throws(function () { view.setAutoResize(null) }, /conversion failure/) @@ -55,12 +61,12 @@ describe('View module', function () { describe('BrowserView.setBounds()', function () { it('does not throw for valid args', function () { - const view = new BrowserView() + view = new BrowserView() view.setBounds({ x: 0, y: 0, width: 1, height: 1 }) }) it('throws for invalid args', function () { - const view = new BrowserView() + view = new BrowserView() assert.throws(function () { view.setBounds(null) }, /conversion failure/) @@ -72,12 +78,12 @@ describe('View module', function () { describe('BrowserWindow.setBrowserView()', function () { it('does not throw for valid args', function () { - const view = new BrowserView() + view = new BrowserView() w.setBrowserView(view) }) it('does not throw if called multiple times with same view', function () { - const view = new BrowserView() + view = new BrowserView() w.setBrowserView(view) w.setBrowserView(view) w.setBrowserView(view)