mirror of
https://github.com/EKKOLearnAI/hermes-web-ui.git
synced 2026-07-16 13:40:14 +00:00
3ab875998b
* Split Hermes bridge Python modules * Add Hermes write gate controls * Adjust approval prompt width * Improve write gate and desktop startup UX * Fix bridge runtime patch sync --------- Co-authored-by: Codex <codex@openai.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import DesktopTitleBar from '@/components/layout/DesktopTitleBar.vue'
|
|
|
|
type DesktopBridge = {
|
|
platform?: string
|
|
getWindowState?: () => Promise<{ isMaximized: boolean }>
|
|
windowControl?: (action: 'minimize' | 'toggle-maximize' | 'close') => Promise<{ isMaximized: boolean }>
|
|
}
|
|
|
|
function setDesktopBridge(bridge: DesktopBridge) {
|
|
Object.defineProperty(window, 'hermesDesktop', {
|
|
configurable: true,
|
|
value: bridge,
|
|
})
|
|
}
|
|
|
|
describe('DesktopTitleBar', () => {
|
|
afterEach(() => {
|
|
vi.restoreAllMocks()
|
|
delete (window as typeof window & { hermesDesktop?: DesktopBridge }).hermesDesktop
|
|
})
|
|
|
|
it('does not render a custom title bar on Linux so native window controls remain visible', () => {
|
|
setDesktopBridge({ platform: 'linux' })
|
|
|
|
const wrapper = mount(DesktopTitleBar)
|
|
|
|
expect(wrapper.find('.desktop-titlebar').exists()).toBe(false)
|
|
})
|
|
|
|
it('renders custom window controls on Windows frameless windows', () => {
|
|
setDesktopBridge({
|
|
platform: 'win32',
|
|
getWindowState: vi.fn().mockResolvedValue({ isMaximized: false }),
|
|
windowControl: vi.fn().mockResolvedValue({ isMaximized: false }),
|
|
})
|
|
|
|
const wrapper = mount(DesktopTitleBar)
|
|
|
|
expect(wrapper.find('.desktop-titlebar').exists()).toBe(true)
|
|
expect(wrapper.findAll('.desktop-window-btn')).toHaveLength(3)
|
|
})
|
|
})
|