+ 可在图片准备检查中核对缺少的资料和准备费用。 +
{{ prop.spec.semanticClass }}
-
diff --git a/tests/components/ui/AssetImage.test.ts b/tests/components/ui/AssetImage.test.ts
index 457d958..d8c5dbc 100644
--- a/tests/components/ui/AssetImage.test.ts
+++ b/tests/components/ui/AssetImage.test.ts
@@ -33,10 +33,12 @@ describe('资源图片展示与原图预览', () => {
expect(wrapper.get
('img').element.style.objectFit).toBe('contain') }) - it('图片加载前显示轻量骨架占位,加载完成后直接淡入图片并移除占位', async () => { + it('图片加载时显示无文字的占位图标,完成后展示原图', async () => { wrapper = mount(AssetImage, { props: { src: '/storage/reveal.png', alt: '加载中的图片' } }) expect(wrapper.get('.reveal-image').attributes('aria-busy')).toBe('true') - expect(wrapper.find('.reveal-image-placeholder').exists()).toBe(true) + const placeholder = wrapper.get('.reveal-image-placeholder') + expect(placeholder.find('svg').exists()).toBe(true) + expect(placeholder.text()).toBe('') expect(wrapper.find('.reveal-image-grid').exists()).toBe(false) await wrapper.get('img').trigger('load') expect(wrapper.get('.reveal-image').classes()).toContain('is-loaded') diff --git a/tests/components/ui/layout.test.ts b/tests/components/ui/layout.test.ts index 39cdc97..f2a5fbf 100644 --- a/tests/components/ui/layout.test.ts +++ b/tests/components/ui/layout.test.ts @@ -529,10 +529,14 @@ describe('管理后台组件边界', () => { expect(wrapper.get('.project-view .workspace-page').text()).toBe(path) } expect(detail).toHaveBeenCalledOnce() - expect(wrapper.findAll('.project-header .n-button').map(button => button.text())).toEqual([ - '制作前检查', - '项目配置' - ]) + const menuButton = wrapper.get('.project-header button[aria-label="项目操作"]') + expect(wrapper.findAll('.project-header .n-button')).toHaveLength(1) + await menuButton.trigger('click') + await flushPromises() + expect(menuButton.attributes('aria-expanded')).toBe('true') + expect( + [...document.querySelectorAll('.n-dropdown-option-body')].map(option => option.textContent?.trim()) + ).toEqual(['制作前检查', '项目配置']) expect(wrapper.find('.project-header [aria-label="刷新项目"]').exists()).toBe(false) expect(wrapper.find('.project-header .n-tag').exists()).toBe(false) }) diff --git a/tests/features/projects/access.test.ts b/tests/features/projects/access.test.ts index 80f9545..d906d2e 100644 --- a/tests/features/projects/access.test.ts +++ b/tests/features/projects/access.test.ts @@ -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') }) diff --git a/tests/features/storyboard-preparation/policy-entry.test.ts b/tests/features/storyboard-preparation/policy-entry.test.ts index ad4664a..adaf7cb 100644 --- a/tests/features/storyboard-preparation/policy-entry.test.ts +++ b/tests/features/storyboard-preparation/policy-entry.test.ts @@ -8,7 +8,7 @@ import { projectSettingsOpenKey } from '@/features/generation-config/context' import { preparationFixture } from './fixtures' /** 当前挂载的检查入口,不连接模型或数据库写入。 */ -let wrapper: VueWrapper | undefined +let wrapper: VueWrapper > | 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 ('.app-drawer')!) } } diff --git a/tests/features/subject-images/asset-impact.test.ts b/tests/features/subject-images/asset-impact.test.ts index 4cb65c9..b6628f3 100644 --- a/tests/features/subject-images/asset-impact.test.ts +++ b/tests/features/subject-images/asset-impact.test.ts @@ -247,6 +247,21 @@ describe('过期首帧到具体素材定位', () => { expect(fetcher).toHaveBeenCalledTimes(requestCount) }) + it('筛选只移除卡片且保留卡片尺寸不变时,瀑布流将它移回首列首行', async () => { + const { second, fetcher } = await gallery() + const retainedCard = wrapper!.get (`[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') diff --git a/tests/features/subject-images/source-diagnostics.test.ts b/tests/features/subject-images/source-diagnostics.test.ts index a30cb1e..b1e240f 100644 --- a/tests/features/subject-images/source-diagnostics.test.ts +++ b/tests/features/subject-images/source-diagnostics.test.ts @@ -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 ( @@ -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 {