feat(short-drama-agent-front): 新增全局主题和左右布局切换

This commit is contained in:
GJ committed 2026-11-06 22:07:42 +08:00
1 parent db9aea1694
commit 27ee9fd4ff
10 files changed
+709 -41

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ afterEach(() => {
wrapper = undefined
localStorage.clear()
delete document.documentElement.dataset.theme
document.documentElement.style.colorScheme = ''
document.documentElement.removeAttribute('style')
vi.unstubAllGlobals()
})
+24 -1
View File
@@ -188,6 +188,7 @@ describe('管理后台组件边界', () => {
return option!.icon()
}
expect(firstMenuIcon().type).not.toBe(NPopover)
expect(wrapper.get('.admin-sider-footer').findComponent(NPopover).exists()).toBe(false)
expect(wrapper.get('[aria-label="折叠侧栏"] svg').classes()).toContain('lucide-panel-left-close')
expect(wrapper.findAll('.studio-logo svg')).toHaveLength(2)
@@ -219,6 +220,26 @@ describe('管理后台组件边界', () => {
'分镜设计',
'镜头生产'
])
// 切换布局时保留分镜工作区的 DOM,刷新后从已保存的偏好恢复。
const workspace = wrapper.get('#main-content .workspace-page').element
const layoutToggle = wrapper.get('.workspace-layout-toggle')
await layoutToggle.trigger('click')
await flushPromises()
const layoutOptions = [...document.querySelectorAll<HTMLElement>('.n-dropdown-option-body')]
.filter(option => option.closest('.n-dropdown-menu'))
.filter(option => ['居左', '居右', '居中'].includes(option.textContent?.trim() ?? ''))
expect(layoutOptions.map(option => option.textContent?.trim())).toEqual(['居左', '居右'])
layoutOptions[1]!.click()
await flushPromises()
expect(wrapper.get('.admin-layout').classes()).toContain('is-nav-right')
expect(wrapper.get('#main-content .workspace-page').element).toBe(workspace)
expect(layoutToggle.attributes('aria-label')).toBe('工作台布局:居右')
expect(wrapper.get('[aria-label="展开侧栏"] svg').classes()).toContain('lucide-panel-right-open')
wrapper.unmount()
wrapper = mount(App, { attachTo: document.body, global: { plugins: [router] } })
await flushPromises()
expect(wrapper.get('.admin-layout').classes()).toContain('is-nav-right')
const settings = wrapper.get('.admin-sider-footer [aria-label="连接设置"]')
expect(settings.text()).toBe('连接设置')
await settings.trigger('click')
@@ -254,7 +275,9 @@ describe('管理后台组件边界', () => {
expect(css).toContain('@media (prefers-reduced-motion: reduce)')
expect(css).toContain('.admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .n-menu-item-content-header')
expect(css).toContain('clip-path: inset(0);')
expect(css).toContain('transform: translateX(-6px);')
expect(css).toContain('transform: translateX(var(--admin-nav-reveal-offset));')
expect(css).toContain('--admin-nav-reveal-offset: -6px;')
expect(css).toContain('--admin-nav-reveal-offset: 6px;')
expect(css).not.toContain('.admin-sider-mask')
expect(css).not.toContain('.admin-sider.is-overlay')
for (const path of ['storyboard/StoryboardPage.vue', 'production/ProductionPage.vue']) {