feat(short-drama-agent-front): 完善质量规则确认与中文交互

This commit is contained in:
GJ committed 2026-10-17 22:09:28 +08:00
1 parent 190333d4f9
commit c4b43b9725
85 files changed
+2059 -480

No files matched your search

+20 -2
View File
@@ -7,6 +7,7 @@ import StyleEditor from '@/features/visual-style/components/StyleEditor.vue'
import SubjectList from '@/features/breakdown/components/SubjectList.vue'
import { selectMenu } from '@/testing/naive'
import type { SubjectCandidate } from '@/features/breakdown/types'
import { styleFixture } from '@/features/visual-style/testing/fixtures'
let wrapper: VueWrapper | undefined
afterEach(() => {
@@ -51,7 +52,7 @@ describe('精简入口保留功能', () => {
it('风格分类始终显示,保存保留人工补充与硬约束', async () => {
wrapper = mount(StyleEditor, { props: { visualStyle: null, disabled: false } })
expect(wrapper.find('#style-constraints').exists()).toBe(true)
await wrapper.get('#style-constraints').setValue('["保留硬约束"]')
await wrapper.get('#style-constraints').setValue('保持真人写实\n不使用现代服装')
const fields = wrapper.findAllComponents(NInput)
fields.find(item => item.props('placeholder')?.includes('人物质感'))!.vm.$emit('update:value', '人物风格')
await flushPromises()
@@ -60,10 +61,27 @@ describe('精简入口保留功能', () => {
await wrapper.get('form').trigger('submit')
await flushPromises()
expect(wrapper.emitted('save')).toMatchObject([
[{ characterPrompt: '人物风格', hardConstraints: ['保留硬约束'] }]
[{ characterPrompt: '人物风格', hardConstraints: ['保持真人写实', '不使用现代服装'] }]
])
})
it('未编辑要求时完整保留原有多行条目,不按换行拆开已保存内容', async () => {
const requirements = ['只使用古代服装\n保留角色配饰', '保持人物外观一致']
wrapper = mount(StyleEditor, { props: { visualStyle: styleFixture({ hardConstraints: requirements }), disabled: false } })
await wrapper.get('form').trigger('submit')
await flushPromises()
expect(wrapper.emitted('save')?.[0]?.[0]).toMatchObject({ hardConstraints: requirements })
})
it('旧格式要求只读核对,保存其他设置不会用空白要求覆盖旧内容', async () => {
const legacy = { legacyRules: ['完整保留旧要求'] }
wrapper = mount(StyleEditor, { props: { visualStyle: styleFixture({ hardConstraints: legacy }), disabled: false } })
expect(wrapper.get('#style-constraints').attributes('disabled')).toBeDefined()
await wrapper.get('form').trigger('submit')
await flushPromises()
expect(wrapper.emitted('save')?.[0]?.[0]).toMatchObject({ hardConstraints: legacy })
})
it('主体长文收起仅影响显示,完整内容与图片入口不丢失', async () => {
const description = '主体完整经历。'.repeat(30)
wrapper = mount(SubjectList, {