mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-03 17:00:53 +00:00
ENH - expand Notes rich text editing
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { parseNotes } from './notes'
|
||||
import {
|
||||
noteBodyToEditorHtml,
|
||||
noteBodyToPlainText,
|
||||
serializeRichNoteBody,
|
||||
} from './noteRichText'
|
||||
|
||||
describe('notes persistence', () => {
|
||||
it('returns valid notes and ignores malformed entries', () => {
|
||||
@@ -24,3 +29,22 @@ describe('notes persistence', () => {
|
||||
expect(parseNotes('{}')).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe('notes rich text', () => {
|
||||
it('keeps legacy plain text notes editable without interpreting HTML', () => {
|
||||
expect(noteBodyToEditorHtml('First line\n<b>not markup</b>')).toBe(
|
||||
'<p>First line<br><b>not markup</b></p>',
|
||||
)
|
||||
})
|
||||
|
||||
it('stores formatted notes and derives a clean preview', () => {
|
||||
const body = serializeRichNoteBody(
|
||||
'<h2>Briefing</h2><p><strong>Meet</strong> outside.</p><ul><li>Radio</li><li>Vest</li></ul>',
|
||||
)
|
||||
|
||||
expect(noteBodyToEditorHtml(body)).toContain('<strong>Meet</strong>')
|
||||
expect(noteBodyToPlainText(body)).toBe(
|
||||
'Briefing\nMeet outside.\n• Radio\n• Vest',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user