fix: refine sidebar search and composer shortcut hints
This commit is contained in:
+14
-1
@@ -520,7 +520,8 @@ describe('registerIpcHandlers computer capabilities', () => {
|
||||
let browserStateListener:
|
||||
| ((state: BrowserLiveState) => void)
|
||||
| undefined
|
||||
const shortcutSnapshot = {
|
||||
const shortcutSnapshot: import('../shared/shortcut').GlobalShortcutSettingsSnapshot = {
|
||||
platform: 'win32',
|
||||
settings: {
|
||||
enabled: true,
|
||||
accelerator: 'Control+Alt+K'
|
||||
@@ -609,6 +610,18 @@ describe('registerIpcHandlers computer capabilities', () => {
|
||||
shortcut: 'Ctrl + Alt + K',
|
||||
shortcutStatus: 'registered'
|
||||
})
|
||||
for (const status of ['disabled', 'conflict', 'failed'] as const) {
|
||||
shortcutSettingsService.getSnapshot.mockReturnValueOnce({
|
||||
...shortcutSnapshot,
|
||||
registered: false,
|
||||
registeredAccelerator: undefined,
|
||||
status
|
||||
})
|
||||
expect(electronMocks.handlers.get(ipcChannels.appInfo)?.(event)).toMatchObject({
|
||||
shortcut: '',
|
||||
shortcutStatus: status
|
||||
})
|
||||
}
|
||||
expect(
|
||||
electronMocks.handlers.get(ipcChannels.shortcutSettingsGet)?.(
|
||||
event
|
||||
|
||||
@@ -102,6 +102,23 @@ describe('ShortcutSettingsService', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it.each(['disabled', 'conflict', 'failed'] as const)('reports an unavailable shortcut at startup when %s', async (status) => {
|
||||
const fixture = createFixture({
|
||||
enabled: status !== 'disabled',
|
||||
accelerator: 'CommandOrControl+Shift+Space'
|
||||
})
|
||||
if (status === 'conflict') fixture.registry.register.mockReturnValueOnce(false)
|
||||
if (status === 'failed') fixture.registry.register.mockImplementationOnce(() => { throw new Error('Registration failed') })
|
||||
|
||||
await expect(fixture.service.initialize()).resolves.toMatchObject({
|
||||
registered: false,
|
||||
displayAccelerator: 'Ctrl+Shift+Space',
|
||||
status
|
||||
})
|
||||
expect(fixture.service.getSnapshot().registeredAccelerator).toBeUndefined()
|
||||
if (status === 'disabled') expect(fixture.registry.register).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it.each([
|
||||
[
|
||||
'win32',
|
||||
|
||||
Reference in New Issue
Block a user