feat: add enterprise identity and channel integrations

This commit is contained in:
hailin
2026-07-27 19:03:42 +08:00
parent d93cb75c10
commit e69368a2f3
44 changed files with 5045 additions and 69 deletions

View File

@@ -12,11 +12,19 @@ function navigate(path: string) {
}
beforeEach(() => {
vi.stubGlobal('ResizeObserver', class ResizeObserverMock {
observe() {}
unobserve() {}
disconnect() {}
})
window.sessionStorage.clear()
window.location.hash = '#/tickets/42'
})
afterEach(() => cleanup())
afterEach(() => {
cleanup()
vi.unstubAllGlobals()
})
describe('已打开页面标签', () => {
it('只显示实际打开过的页面,并允许关闭非当前标签', async () => {
@@ -64,6 +72,47 @@ describe('已打开页面标签', () => {
expect(screen.getByRole('tab', { name: '知识库' })).toBeInTheDocument()
})
it('右键标签可以关闭其左侧和右侧标签', async () => {
const user = userEvent.setup()
render(<AppRouteTabs />)
navigate('/knowledge')
navigate('/solutions')
await waitFor(() => expect(screen.getAllByRole('tab')).toHaveLength(3))
fireEvent.contextMenu(screen.getByRole('tab', { name: '知识库' }))
await user.click(await screen.findByRole('menuitem', { name: '关闭左侧标签' }))
expect(screen.queryByRole('tab', { name: '工单详情' })).not.toBeInTheDocument()
expect(screen.getByRole('tab', { name: '知识库' })).toBeInTheDocument()
expect(screen.getByRole('tab', { name: '解决方案库' })).toBeInTheDocument()
fireEvent.contextMenu(screen.getByRole('tab', { name: '知识库' }))
await user.click(await screen.findByRole('menuitem', { name: '关闭右侧标签' }))
expect(screen.queryByRole('tab', { name: '解决方案库' })).not.toBeInTheDocument()
expect(screen.getAllByRole('tab')).toHaveLength(1)
expect(window.location.hash).toBe('#/knowledge')
})
it('批量菜单可以关闭其他标签和关闭全部标签', async () => {
const user = userEvent.setup()
render(<AppRouteTabs />)
navigate('/knowledge')
navigate('/solutions')
await waitFor(() => expect(screen.getAllByRole('tab')).toHaveLength(3))
await user.click(screen.getByRole('button', { name: '查看全部已打开页面,共 3 个' }))
await user.click(screen.getByRole('menuitem', { name: '关闭其他标签' }))
expect(screen.getAllByRole('tab')).toHaveLength(1)
expect(screen.getByRole('tab', { name: '解决方案库' })).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: '查看全部已打开页面,共 1 个' }))
await user.click(screen.getByRole('menuitem', { name: '关闭全部标签' }))
expect(screen.getAllByRole('tab')).toHaveLength(1)
expect(screen.getByRole('tab', { name: '工作台' })).toBeInTheDocument()
expect(window.location.hash).toBe('#/')
})
it('标签溢出时隐藏原生滚动条,并提供左右切换和全部页面菜单', async () => {
const user = userEvent.setup()
const { container } = render(<AppRouteTabs />)