feat: ship v1.1.0 writer toolkit with templates, import, export, and inspiration capture
Implement chapter templates, txt/md/docx import, submission export presets, and global inspiration shortcut. Split import handlers into a separate main bundle and fix EditorLayout setTarget loop that broke E2E. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { splitPlainText } from '../../src/main/lib/chapter-splitter'
|
||||
|
||||
const SAMPLE = `前言内容
|
||||
|
||||
# 第一章 开端
|
||||
|
||||
第一段正文。
|
||||
|
||||
# 第二章 发展
|
||||
|
||||
第二段正文。
|
||||
|
||||
# 第三章 结局
|
||||
|
||||
第三段正文。`
|
||||
|
||||
describe('chapter-splitter', () => {
|
||||
it('UT-IMPORT-01: auto split finds 3 chapters', () => {
|
||||
const parts = splitPlainText(SAMPLE, 'auto')
|
||||
expect(parts).toHaveLength(3)
|
||||
expect(parts[0]!.title).toContain('第一章')
|
||||
expect(parts[2]!.title).toContain('第三章')
|
||||
})
|
||||
|
||||
it('paragraph mode splits by blank lines', () => {
|
||||
const text = '标题一\n\n正文一\n\n标题二\n\n正文二'
|
||||
const parts = splitPlainText(text, 'paragraph')
|
||||
expect(parts.length).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user