mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
chore: migrate api-touch-bar-spec.ts to vitest
This commit is contained in:
@@ -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);
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user