From 92c3a4e4c21caf0e4ab8f0af694a7ae947c8ac52 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Tue, 27 Aug 2019 00:37:30 -0700 Subject: [PATCH] test: tsify spec for experimental views api (#19966) --- spec-main/ambient.d.ts | 7 +++++++ spec-main/api-view-spec.ts | 15 +++++++++++++++ spec/api-view-spec.js | 14 -------------- 3 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 spec-main/api-view-spec.ts delete mode 100644 spec/api-view-spec.js diff --git a/spec-main/ambient.d.ts b/spec-main/ambient.d.ts index b9582b96a1e..a54a9b93330 100644 --- a/spec-main/ambient.d.ts +++ b/spec-main/ambient.d.ts @@ -16,4 +16,11 @@ declare namespace Electron { interface WebContents { getOwnerBrowserWindow(): BrowserWindow; } + + // Experimental views API + class TopLevelWindow { + constructor(args: {show: boolean}) + setContentView(view: View): void + } + class View {} } diff --git a/spec-main/api-view-spec.ts b/spec-main/api-view-spec.ts new file mode 100644 index 00000000000..95e1416dba0 --- /dev/null +++ b/spec-main/api-view-spec.ts @@ -0,0 +1,15 @@ +import { closeWindow } from './window-helpers' +import { TopLevelWindow, View } from 'electron' + +describe('View', () => { + let w: TopLevelWindow + afterEach(async () => { + await closeWindow(w as any) + w = null as unknown as TopLevelWindow + }) + + it('can be used as content view', () => { + w = new TopLevelWindow({ show: false }) + w.setContentView(new View()) + }) +}) diff --git a/spec/api-view-spec.js b/spec/api-view-spec.js deleted file mode 100644 index 396d9a972eb..00000000000 --- a/spec/api-view-spec.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -const { closeWindow } = require('./window-helpers') -const { TopLevelWindow, View } = require('electron').remote - -describe('View', () => { - let w = null - afterEach(() => closeWindow(w).then(() => { w = null })) - - it('can be used as content view', () => { - w = new TopLevelWindow({ show: false }) - w.setContentView(new View()) - }) -})