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

+5 -9
View File
@@ -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')