Import the client, server, skills, tests, and build scripts as the starting point for the rebuild, then trim the surfaces this project does not ship: Electron desktop packaging, the marketing website, and the ESP32 firmware tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows. Rename the package and CLI entry points to hermes-ui, drop the prepare hook so npm ci no longer triggers a build, and drop the removed tsconfig and nodemon references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs so the documented package map and hard rules match this repository. reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
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)
|
|
})
|
|
})
|