feat: refine UI, improve UX, optimize the analysis pipeline, and add character standing positions

This commit is contained in:
saturn
2026-04-02 17:39:16 +08:00
parent c3e74c228a
commit 9703714b69
153 changed files with 4472 additions and 1088 deletions

View File

@@ -0,0 +1,34 @@
import { describe, expect, it, vi } from 'vitest'
import { copyPreviewJsonText } from '@/app/[locale]/workspace/[projectId]/modes/novel-promotion/components/storyboard/AIDataModalPreviewPane'
describe('AIDataModalPreviewPane copy helper', () => {
it('falls back to execCommand when clipboard api rejects', async () => {
const writeText = vi.fn(async () => {
throw new Error('clipboard denied')
})
const appendChild = vi.fn()
const removeChild = vi.fn()
const select = vi.fn()
const textarea = {
value: '',
style: {} as Record<string, string>,
select,
}
vi.stubGlobal('navigator', { clipboard: { writeText } })
vi.stubGlobal('document', {
body: {
appendChild,
removeChild,
},
createElement: vi.fn(() => textarea),
execCommand: vi.fn(() => true),
})
await expect(copyPreviewJsonText('{"a":1}')).resolves.toBeUndefined()
expect(writeText).toHaveBeenCalledWith('{"a":1}')
expect(appendChild).toHaveBeenCalledWith(textarea)
expect(select).toHaveBeenCalled()
})
})