test(workspace): align project menu edge assertion

This commit is contained in:
mesalogo
2026-10-14 14:55:03 +08:00
parent 7c57f653d8
commit 2e9adbe982
+2 -2
View File
@@ -402,7 +402,7 @@ describe('ProjectSwitcher runtime fields', () => {
expect(menu.closest('.floating-portal')?.parentElement).toBe(document.body)
const surface = screen.getByRole('dialog', { name: '项目与活动' })
expect(surface.style.width).toBe('680px')
expect(surface.style.left).toBe('14px')
expect(surface.style.left).toBe('16px')
const selected = within(menu).getByRole('menuitemradio', { checked: true })
await waitFor(() => expect(screen.getByRole('tab', { name: '全部项目' })).toHaveFocus())
fireEvent.pointerDown(selected)
@@ -411,7 +411,7 @@ describe('ProjectSwitcher runtime fields', () => {
const width = vi.spyOn(window, 'innerWidth', 'get').mockReturnValue(360)
fireEvent(window, new Event('resize'))
expect(surface.style.width).toBe('328px')
expect(surface.style.left).toBe('14px')
expect(surface.style.left).toBe('16px')
width.mockRestore()
fireEvent.keyDown(selected, { key: 'Escape' })
expect(screen.queryByRole('menu')).not.toBeInTheDocument()