fix(short-drama-agent-front): 优化选角抽屉与操作文案

This commit is contained in:
GJ committed 2026-10-21 16:34:25 +08:00
1 parent a8ecf37e78
commit 81d6a85260
5 files changed
+103 -68

No files matched your search

+15 -11
View File
@@ -2,7 +2,7 @@ import { preparationFixture } from '../storyboard-preparation/fixtures'
import { generationProfile, imageCatalog } from '../../fixtures/generation'
import { routerLinkStubs } from '../../fixtures/router'
import { computed, ref } from 'vue'
import { NImage, NRadioGroup, NScrollbar } from 'naive-ui'
import { NDrawer, NImage, NRadioGroup, NScrollbar } from 'naive-ui'
import { createMemoryHistory, createRouter, type RouteRecordRaw } from 'vue-router'
import { DOMWrapper, flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, describe, expect, it, vi, type Mock } from 'vitest'
@@ -732,7 +732,7 @@ describe('视觉风格与主体身份工作区', () => {
})
stubFetch(fetcher)
await mountAssets('identity')
await drawerPanel().get('.n-card-header__close').trigger('click')
await drawerPanel().get('.n-drawer-header__close').trigger('click')
await flushPromises()
const items = wrapper!.findAll('.identity-subject-item')
expect(items).toHaveLength(3)
@@ -1073,11 +1073,11 @@ describe('视觉风格与主体身份工作区', () => {
})
stubFetch(fetcher)
await mountAssets('identity')
await confirmGeneration('补齐全部主体身份文本')
await confirmGeneration('补齐全部主体身份描述')
const post = fetcher.mock.calls.find(([, init]) => init?.method === 'POST')!
expect(post[0]).toBe('/api/projects/page-test-project/subject-identities/generate')
expect(JSON.parse(post[1]!.body as string)).toEqual({ force: false, concurrency: 3 })
expect(drawerPanel().text()).toContain('本次存在部分失败')
expect(drawerPanel().text()).toContain('部分生成未完成')
expect(drawerPanel().text()).toContain('含锁定 1')
expect(drawerPanel().text()).toContain('文本模型超时')
})
@@ -1167,7 +1167,7 @@ describe('视觉风格与主体身份工作区', () => {
expect(anchorImage.props()).toMatchObject({ objectFit: 'cover', previewDisabled: false })
})
it('选角进度卡片分层显示长姓名、编号和状态,点击仍按正式 ID 切换主体', async () => {
it('全屏选角卡片显示长姓名、编号和状态,关闭动画结束后按正式 ID 切换主体', async () => {
const longName = '来自记忆当铺的另一条时间线中尚未丢失记忆的林默'
const items = [
{
@@ -1211,7 +1211,8 @@ describe('视觉风格与主体身份工作区', () => {
})
stubFetch(fetcher)
await mountAssets('identity')
expect(drawerPanel().get('.identity-tools-intro').text()).toContain('为同一个人物、场景或道具固定稳定特征')
expect(drawerPanel().text()).toContain('先保存人物、场景或道具的固定特征')
expect(wrapper!.getComponent(NDrawer).props('width')).toBe('100vw')
const cards = drawerPanel().get('[aria-label="角色选角进度"]').findAll('.casting-item')
expect(cards).toHaveLength(2)
expect(cards[0]!.get('.casting-item-name').text()).toBe(longName)
@@ -1219,12 +1220,15 @@ describe('视觉风格与主体身份工作区', () => {
expect(cards[0]!.get('.casting-item-status').text()).toBe('选角已完成')
expect(cards[0]!.find('.truncate').exists()).toBe(false)
expect(cards[0]!.attributes('aria-pressed')).toBe('true')
expect(cards[1]!.get('.casting-item-status').text()).toBe('等待确认演员')
expect(cards[1]!.get('.casting-item-status').text()).toBe('待确认选角')
await cards[1]!.trigger('click')
await flushPromises()
expect(cards[0]!.attributes('aria-pressed')).toBe('false')
expect(cards[1]!.attributes('aria-pressed')).toBe('true')
expect(cards[1]!.classes()).toContain('selected')
expect(wrapper!.getComponent(NDrawer).props('show')).toBe(false)
expect(wrapper!.findAll('.identity-subject-item')[0]!.attributes('aria-pressed')).toBe('true')
/** DOM 环境不播放离场动画,显式交接公共抽屉的关闭完成事件。 */
wrapper!.getComponent(NDrawer).vm.$emit('after-leave')
await flushPromises()
expect(wrapper!.findAll('.identity-subject-item')[1]!.attributes('aria-pressed')).toBe('true')
expect(new DOMWrapper(document.body).get<HTMLTextAreaElement>('#identity-description').element.value).toBe(
'老周的稳定身份'
)
@@ -1278,7 +1282,7 @@ describe('视觉风格与主体身份工作区', () => {
})
stubFetch(fetcher)
await mountAssets('identity')
expect(wrapper!.text()).toContain('等待确认演员')
expect(wrapper!.text()).toContain('待确认选角')
expect(wrapper!.find('.identity-anchor-grid').exists()).toBe(true)
button('确认选角并锁定').click()
await flushPromises()