feat(short-drama-agent-front): 完善质量规则确认与中文交互
This commit is contained in:
1 parent
190333d4f9
commit
c4b43b9725
85 files changed
+2059
-480
No files matched your search
@@ -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, {
|
||||
|
||||
@@ -129,21 +129,17 @@ describe('统一的 Naive UI 表单校验', () => {
|
||||
expect(wrapper.emitted('generate')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('分类风格始终显示,非法 JSON 拦截保存,修正后保留草稿正常提交', async () => {
|
||||
it('画面要求按行填写,保存时保持原有文字列表格式', async () => {
|
||||
wrapper = mount(StyleEditor, { attachTo: document.body, props: { visualStyle: null, disabled: false } })
|
||||
await flushPromises()
|
||||
expect(wrapper.find('button[aria-expanded]').exists()).toBe(false)
|
||||
expect(wrapper.get('.style-category-section h3').text()).toBe('分类风格与硬约束')
|
||||
expect(wrapper.get('.style-category-section h3').text()).toBe('分类风格与画面要求')
|
||||
expect(wrapper.findAll('.style-category-fields .n-form-item')).toHaveLength(3)
|
||||
await input('#style-name', '手工风格')
|
||||
await input('#style-constraints', '{"invalid":true}')
|
||||
await input('#style-constraints', '真人写实\n\n 只用古代服装 ')
|
||||
await submit()
|
||||
expect(wrapper.emitted('save')).toBeUndefined()
|
||||
expect(feedback()).toContain('请输入 JSON 字符串数组')
|
||||
expect(wrapper.emitted('save')?.[0]?.[0]).toMatchObject({ name: '手工风格', hardConstraints: ['真人写实', '只用古代服装'] })
|
||||
expect(wrapper.get('#style-constraints').isVisible()).toBe(true)
|
||||
await input('#style-constraints', '["真人写实"]')
|
||||
await submit()
|
||||
expect(wrapper.emitted('save')?.[0]?.[0]).toMatchObject({ name: '手工风格', hardConstraints: ['真人写实'] })
|
||||
})
|
||||
|
||||
it('登记参考图拦截非法地址和小数排序,允许有效存储地址与负整数排序', async () => {
|
||||
@@ -159,7 +155,7 @@ describe('统一的 Naive UI 表单校验', () => {
|
||||
await input('[aria-label="风格图片地址"]', 'javascript:alert(1)')
|
||||
await input('[aria-label="风格图片排序"]', '1.5')
|
||||
await submit()
|
||||
expect(feedback()).toContain('请填写有效的 HTTP(S) 或 /storage/ 图片地址')
|
||||
expect(feedback()).toContain('请填写可访问的图片链接或已上传图片的地址')
|
||||
expect(feedback()).toContain('排序须为整数')
|
||||
expect(wrapper.emitted('add')).toBeUndefined()
|
||||
await input('[aria-label="风格图片地址"]', '/storage/style.png')
|
||||
|
||||
Reference in new issue
Block a user