* fix(renderer): preserve literal text line breaks * fix(renderer): preserve empty text paragraphs * fix(renderer): scope line-break preservation to plain text * fix(renderer): detect non-tag HTML markup * style(renderer): format rich text tests
21 lines
686 B
TypeScript
21 lines
686 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { preservesPlainTextLineBreaks } from '../../src/utils/richText';
|
|
|
|
describe('preservesPlainTextLineBreaks', () => {
|
|
it.each(['First line\nSecond line', 'A \nB', '2 < 3'])(
|
|
'keeps literal line endings for tag-free content: %j',
|
|
(content) => {
|
|
expect(preservesPlainTextLineBreaks(content)).toBe(true);
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
'<p>A</p>\n<p>B</p>',
|
|
'<my-widget>content</my-widget>',
|
|
'A<!-- source note -->\nB',
|
|
'<!doctype html>\nA',
|
|
])('does not preserve source-formatting line endings in HTML markup: %j', (content) => {
|
|
expect(preservesPlainTextLineBreaks(content)).toBe(false);
|
|
});
|
|
});
|