ui: 默认展开内容折叠区

This commit is contained in:
GouJ
2026-09-22 18:42:56 +08:00
parent b9db84c261
commit 8e8fab307f
19 changed files with 90 additions and 126 deletions
+5 -4
View File
@@ -37,8 +37,11 @@ describe('精简入口保留功能', () => {
expect(wrapper.emitted('select')).toHaveLength(1)
})
it('补充说明默认展开,键盘可聚焦的标题可查看原文', async () => {
it('补充说明默认展开,键盘可聚焦的标题仍可手动收起和展开', async () => {
wrapper = mount(DetailDisclosure, { props: { title: '规则说明' }, slots: { default: '完整规则仍然保留' } })
expect(wrapper.text()).toContain('完整规则仍然保留')
await wrapper.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
expect(wrapper.text()).not.toContain('完整规则仍然保留')
await wrapper.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
@@ -47,9 +50,7 @@ describe('精简入口保留功能', () => {
it('风格高级字段收起不丢失保存值,展开后仍可修改', async () => {
wrapper = mount(StyleEditor, { props: { visualStyle: null, disabled: false } })
expect(wrapper.find('#style-constraints').exists()).toBe(false)
await wrapper.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
expect(wrapper.find('#style-constraints').exists()).toBe(true)
await wrapper.get('#style-constraints').setValue('["保留硬约束"]')
const fields = wrapper.findAllComponents(NInput)
fields.find(item => item.props('placeholder')?.includes('人物质感'))!.vm.$emit('update:value', '人物风格')
+1 -2
View File
@@ -93,8 +93,7 @@ describe('统一的 Naive UI 表单校验', () => {
it('折叠后的非法 JSON 仍拦截保存并展开错误,修正后保留草稿正常提交', async () => {
wrapper = mount(StyleEditor, { attachTo: document.body, props: { visualStyle: null, disabled: false } })
await flushPromises()
button('分类风格与硬约束').click()
await flushPromises()
expect(button('分类风格与硬约束').getAttribute('aria-expanded')).toBe('true')
await input('#style-name', '手工风格')
await input('#style-constraints', '{"invalid":true}')
button('分类风格与硬约束').click()
@@ -99,7 +99,7 @@ function checkpoint(): Checkpoint {
}
}
/** 提供响应式 checkpoint,模拟手动刷新但不连接后端或启动模型任务。 */
/** 提供响应式 checkpoint,模拟轮询更新但不连接后端或启动模型任务。 */
function mountPage(records = [checkpoint()], episodes = 1): ReturnType<typeof useProjectData> {
const project: ProjectDetail = {
id: 'breakdown-scroll-test',
@@ -248,7 +248,7 @@ describe('拆解页内容滚动', () => {
['人物', 'character'],
['场景', 'scene'],
['道具', 'prop']
] as const)('%s 的奇偶主体展开后均使用独立形态块,搜索重排不影响形态归属', async (label, module) => {
] as const)('%s 的奇偶主体默认展示独立形态块,搜索重排不影响形态归属', async (label, module) => {
const record = checkpoint()
// 前两个主体各准备两种形态,覆盖奇偶条纹和默认标签,不调用模型接口。
record.state.breakdownResult!.subjectForms = [0, 1].flatMap(subjectIndex =>
@@ -267,8 +267,6 @@ describe('拆解页内容滚动', () => {
const articles = wrapper!.findAll('.subject-record-list > article')
for (const index of [0, 1]) {
const article = articles[index]!
await article.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
const cards = article.findAll('.subject-form-card')
expect(cards).toHaveLength(2)
expect(cards[0]!.get('.n-tag').text()).toBe('默认')
@@ -341,7 +339,7 @@ describe('拆解页内容滚动', () => {
expect(toolbar.text()).toContain('第二集')
expect(toolbar.get('.breakdown-storyboard-summary').text()).toContain('2 个节拍 · 2 个镜头')
expect(wrapper!.findAll('.beat-section')).toHaveLength(2)
// 刷新删除当前选项时,输入框与正文一起回到仍存在的第一集。
// 轮询删除当前选项时,输入框与正文一起回到仍存在的第一集。
provided.data.value!.checkpoints = [checkpoint()]
await flushPromises()
expect(select.props('value')).toBe(1)
+2 -2
View File
@@ -374,7 +374,7 @@ describe('视觉质量契约与付费边界', () => {
})
describe('质量面板渐进展示', () => {
it('默认仅校验,未确认时不可提交,打开或更改参数不产生费用', async () => {
it('默认展示校验参数,未确认时不可提交,打开或更改参数不产生费用', async () => {
const data = server()
wrapper = mount(QualityDialog, {
attachTo: document.body,
@@ -388,7 +388,7 @@ describe('质量面板渐进展示', () => {
await flushPromises()
expect(validationButton().disabled).toBe(true)
expect(document.body.textContent).toContain('更多参数与模型限制')
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).toBeNull()
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).not.toBeNull()
expect(data.fetcher).not.toHaveBeenCalled()
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
await flushPromises()