chore: migrate api-touch-bar-spec.ts to vitest

This commit is contained in:
Samuel Attard
2026-04-11 23:00:01 -07:00
parent 8881184167
commit 6fb8c72b96

View File

@@ -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);
})
);
});
}
});