Files
hermes-ui/tests/client/desktop-titlebar.test.ts
T
toor 1e9ea89d86
Build / build (push) Canceled after 0s
NPM Lockfile Check / npm ci --ignore-scripts (push) Canceled after 0s
Playwright / e2e (push) Canceled after 0s
chore: bootstrap hermes-ui skeleton from 0.6.29 snapshot
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.
2026-10-16 10:34:35 +08:00

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