From 6fb8c72b960ca4e6cd3a36aa59b08c6ad2f6dd76 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Sat, 11 Apr 2026 23:00:01 -0700 Subject: [PATCH] chore: migrate api-touch-bar-spec.ts to vitest --- ...ouch-bar-spec.ts => api-touch-bar.spec.ts} | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) rename spec/{api-touch-bar-spec.ts => api-touch-bar.spec.ts} (80%) diff --git a/spec/api-touch-bar-spec.ts b/spec/api-touch-bar.spec.ts similarity index 80% rename from spec/api-touch-bar-spec.ts rename to spec/api-touch-bar.spec.ts index 659bbaecc9..0ca5c87d81 100644 --- a/spec/api-touch-bar-spec.ts +++ b/spec/api-touch-bar.spec.ts @@ -1,9 +1,11 @@ import { BaseWindow, BrowserWindow, TouchBar } from 'electron/main'; import { expect } from 'chai'; +import { afterEach, beforeEach, describe, it } from 'vitest'; import * as path from 'node:path'; +import { withDone } from './lib/spec-helpers'; import { closeWindow } from './lib/window-helpers'; const { @@ -117,29 +119,35 @@ describe('TouchBar module', () => { touchBar.escapeItem = null; }); - it('calls the callback on the items when a window interaction event fires', (done) => { - const button = new TouchBarButton({ - label: 'bar', - click: () => { - done(); - } - }); - const touchBar = new TouchBar({ items: [button] }); - window.setTouchBar(touchBar); - window.emit('-touch-bar-interaction', {}, (button as any).id); - }); + it( + 'calls the callback on the items when a window interaction event fires', + withDone((done) => { + const button = new TouchBarButton({ + label: 'bar', + click: () => { + done(); + } + }); + const touchBar = new TouchBar({ items: [button] }); + window.setTouchBar(touchBar); + window.emit('-touch-bar-interaction', {}, (button as any).id); + }) + ); - it('calls the callback on the escape item when a window interaction event fires', (done) => { - const button = new TouchBarButton({ - label: 'bar', - click: () => { - done(); - } - }); - const touchBar = new TouchBar({ escapeItem: button }); - window.setTouchBar(touchBar); - window.emit('-touch-bar-interaction', {}, (button as any).id); - }); + it( + 'calls the callback on the escape item when a window interaction event fires', + withDone((done) => { + const button = new TouchBarButton({ + label: 'bar', + click: () => { + done(); + } + }); + const touchBar = new TouchBar({ escapeItem: button }); + window.setTouchBar(touchBar); + window.emit('-touch-bar-interaction', {}, (button as any).id); + }) + ); }); } });