fix(short-drama-agent-front): 优化项目操作与形态图库
This commit is contained in:
1 parent
27ee9fd4ff
commit
dbf97e6f98
11 files changed
+175
-109
No files matched your search
@@ -239,7 +239,7 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
expect(wrapper!.get(skeleton).attributes('aria-busy')).toBe('true')
|
||||
expect(wrapper!.find('.workspace-loading').exists()).toBe(false)
|
||||
expect(wrapper!.get('.project-title').text()).toBe('')
|
||||
expect(wrapper!.findAll('.project-header-action-placeholder')).toHaveLength(2)
|
||||
expect(wrapper!.findAll('.project-header-action-placeholder')).toHaveLength(1)
|
||||
expect(wrapper!.find('.project-header .n-button').exists()).toBe(false)
|
||||
expect(mounted).not.toHaveBeenCalled()
|
||||
|
||||
@@ -389,7 +389,7 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
expect(wrapper!.findAll('.n-menu a')).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('读取失败保持锁定;重试成功后解锁,标题只保留项目配置入口', async () => {
|
||||
it('读取失败时禁用项目操作;重试成功后恢复入口和正文', async () => {
|
||||
const detail = vi
|
||||
.spyOn(projectsApi, 'detail')
|
||||
.mockRejectedValueOnce(new Error('项目读取失败'))
|
||||
@@ -398,12 +398,13 @@ describe('剧本完成前的下游访问限制', () => {
|
||||
const { mounted } = await openProject('/projects/retry/storyboard')
|
||||
expect(mounted).not.toHaveBeenCalled()
|
||||
expect(wrapper!.findAll('.n-menu a')).toHaveLength(3)
|
||||
expect(wrapper!.get('.project-header .n-button').text()).toBe('项目配置')
|
||||
expect(wrapper!.get('.project-header button').attributes('disabled')).toBeDefined()
|
||||
const menu = wrapper!.get('.project-header button[aria-label="项目操作"]')
|
||||
expect(menu.attributes('disabled')).toBeDefined()
|
||||
expect(wrapper!.find('.project-header .n-tag').exists()).toBe(false)
|
||||
await wrapper!.get('.project-notices button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(detail).toHaveBeenCalledTimes(2)
|
||||
expect(wrapper!.get('.project-header button[aria-label="项目操作"]').attributes('disabled')).toBeUndefined()
|
||||
expect(mounted).toHaveBeenCalledExactlyOnceWith('storyboard')
|
||||
})
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { projectSettingsOpenKey } from '@/features/generation-config/context'
|
||||
import { preparationFixture } from './fixtures'
|
||||
|
||||
/** 当前挂载的检查入口,不连接模型或数据库写入。 */
|
||||
let wrapper: VueWrapper | undefined
|
||||
let wrapper: VueWrapper<InstanceType<typeof StoryboardPreparation>> | undefined
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
wrapper = undefined
|
||||
@@ -39,7 +39,7 @@ async function openPreparation(id: string) {
|
||||
props: { projectId: id },
|
||||
global: { provide: { [projectSettingsOpenKey as symbol]: openSettings } }
|
||||
})
|
||||
await wrapper.get('button[aria-label="制作前检查"]').trigger('click')
|
||||
await wrapper.setProps({ open: true })
|
||||
await flushPromises()
|
||||
return { data, openSettings, drawer: new DOMWrapper(document.querySelector<HTMLElement>('.app-drawer')!) }
|
||||
}
|
||||
|
||||
@@ -247,6 +247,21 @@ describe('过期首帧到具体素材定位', () => {
|
||||
expect(fetcher).toHaveBeenCalledTimes(requestCount)
|
||||
})
|
||||
|
||||
it('筛选只移除卡片且保留卡片尺寸不变时,瀑布流将它移回首列首行', async () => {
|
||||
const { second, fetcher } = await gallery()
|
||||
const retainedCard = wrapper!.get<HTMLElement>(`[data-form-id="${second.id}"]`).element
|
||||
// 测试 DOM 不计算布局,预置卡片筛选前的位置,且不触发尺寸变化。
|
||||
retainedCard.style.setProperty('--form-image-column', '2')
|
||||
retainedCard.style.setProperty('--form-image-row-start', '500')
|
||||
const requestCount = fetcher.mock.calls.length
|
||||
await wrapper!.get('input[aria-label="搜索形态图片"]').setValue('雨夜')
|
||||
expect(wrapper!.findAll('.form-image-card')).toHaveLength(1)
|
||||
expect(wrapper!.get('.form-image-card').element).toBe(retainedCard)
|
||||
expect(retainedCard.style.getPropertyValue('--form-image-column')).toBe('1')
|
||||
expect(retainedCard.style.getPropertyValue('--form-image-row-start')).toBe('1')
|
||||
expect(fetcher).toHaveBeenCalledTimes(requestCount)
|
||||
})
|
||||
|
||||
it('图库与关联检查不定时刷新,图片记录变更后更新数据', async () => {
|
||||
vi.useFakeTimers()
|
||||
const { fetcher } = await gallery('?sourceShotId=shot-target')
|
||||
|
||||
@@ -8,9 +8,10 @@ afterEach(() => vi.unstubAllGlobals())
|
||||
|
||||
describe('道具与场景来源诊断', () => {
|
||||
it.each([
|
||||
['missing', '尚未准备结构规格'],
|
||||
['stale', '结构来源已过期']
|
||||
])('道具 %s 只读取原文和历史,不调用生成', async (status, label) => {
|
||||
['missing', '尚未准备结构规格', null, false],
|
||||
['stale', '结构来源已过期', 'failed', false],
|
||||
['stale', '结构来源已过期', 'completed', true]
|
||||
])('道具 %s 只读取原文和历史,不调用生成', async (status, label, attemptStatus, canReuse) => {
|
||||
const form = formFixture('source-project')
|
||||
form.subject.module = 'prop'
|
||||
const fetcher = vi.fn<typeof fetch>(
|
||||
@@ -35,8 +36,8 @@ describe('道具与场景来源诊断', () => {
|
||||
relationQuote: '搭扣从工具箱脱落'
|
||||
}
|
||||
],
|
||||
lastGenerationAttempt: {
|
||||
status: 'failed',
|
||||
lastGenerationAttempt: attemptStatus && {
|
||||
status: attemptStatus,
|
||||
sourceCurrent: false,
|
||||
error: '无法核对归属',
|
||||
evidence: { candidates: [{ semanticClass: '工具箱' }] },
|
||||
@@ -56,7 +57,8 @@ describe('道具与场景来源诊断', () => {
|
||||
expect(wrapper.text()).toContain(label)
|
||||
expect(wrapper.text()).toContain('数量来源 · 第 1 集')
|
||||
expect(wrapper.text()).toContain('拆装来源 · 第 2 集')
|
||||
expect(wrapper.text()).toContain('准备时的来源已过期')
|
||||
expect(wrapper.text().includes('准备时的来源已过期')).toBe(Boolean(attemptStatus))
|
||||
expect(wrapper.findAll('button').some(button => button.text() === '免费复用已有规格')).toBe(canReuse)
|
||||
expect(fetcher.mock.calls).toHaveLength(1)
|
||||
expect(fetcher.mock.calls[0]?.[1]?.method).toBe('GET')
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user