返回 slidev
side-editor.test.ts
根目录 / test / side-editor.test.ts
1 import { describe, expect, it } from 'vitest'
2 import { parseSideEditorContent } from '../packages/client/logic/sideEditor'
3
4 describe('side editor', () => {
5 it('extracts frontmatter-only slide content', () => {
6 expect(parseSideEditorContent(`---
7 layout: image
8 image: /example.png
9 ---`)).toEqual({
10 content: '',
11 frontmatterRaw: 'layout: image\nimage: /example.png',
12 })
13 })
14
15 it('extracts frontmatter from slides with body content', () => {
16 expect(parseSideEditorContent(`---
17 layout: center
18 ---
19
20 # Hello`)).toEqual({
21 content: '\n# Hello',
22 frontmatterRaw: 'layout: center',
23 })
24 })
25 })
26
26 lines TYPESCRIPT