41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
import { afterEach, describe, expect, it } from 'vitest'
|
|
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
|
import BreakdownIssuesDialog from '@/features/breakdown/components/BreakdownIssuesDialog.vue'
|
|
import AppDialog from '@/components/ui/AppDialog.vue'
|
|
|
|
/** 独立问题弹窗实例,验证后移除 Teleport。 */
|
|
let wrapper: VueWrapper | undefined
|
|
afterEach(() => {
|
|
wrapper?.unmount()
|
|
document.body.innerHTML = ''
|
|
})
|
|
|
|
describe('拆解问题弹窗', () => {
|
|
it('同镜头问题合并展示并去重,定位等待弹窗离场后发出', async () => {
|
|
wrapper = mount(BreakdownIssuesDialog, {
|
|
attachTo: document.body,
|
|
props: {
|
|
open: true,
|
|
locatable: true,
|
|
issues: [
|
|
{ episodeNo: 1, beatNo: 2, shotNo: 3, message: '缺少场景' },
|
|
{ episodeNo: 1, beatNo: 2, shotNo: 3, message: '缺少道具' },
|
|
{ episodeNo: 1, beatNo: 2, shotNo: 3, message: '缺少场景' },
|
|
{ episodeNo: 2, beatNo: 1, shotNo: 1, message: '缺少人物' }
|
|
]
|
|
}
|
|
})
|
|
await flushPromises()
|
|
expect(document.querySelectorAll('.breakdown-issue-group')).toHaveLength(2)
|
|
expect(document.body.textContent).toContain('3 项校验问题 · 2 个位置')
|
|
const button = [...document.querySelectorAll<HTMLButtonElement>('button')].find(
|
|
item => item.textContent?.trim() === '定位分镜'
|
|
)!
|
|
button.click()
|
|
await flushPromises()
|
|
expect(wrapper.emitted('locate')).toBeUndefined()
|
|
wrapper.getComponent(AppDialog).vm.$emit('closed')
|
|
expect(wrapper.emitted('locate')?.[0]?.[0]).toMatchObject({ episodeNo: 1, beatNo: 2, shotNo: 3 })
|
|
})
|
|
})
|