mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
29 lines
558 B
TypeScript
29 lines
558 B
TypeScript
import { plainTextToHtml } from './htmlUtils';
|
|
|
|
describe('htmlUtils', () => {
|
|
|
|
test('should convert a plain text string to its HTML equivalent', () => {
|
|
const testCases = [
|
|
[
|
|
'',
|
|
'',
|
|
],
|
|
[
|
|
'line 1\nline 2',
|
|
'<p>line 1</p><p>line 2</p>',
|
|
],
|
|
[
|
|
'<img onerror="http://downloadmalware.com"/>',
|
|
'<img onerror="http://downloadmalware.com"/>',
|
|
],
|
|
];
|
|
|
|
for (const t of testCases) {
|
|
const [input, expected] = t;
|
|
const actual = plainTextToHtml(input);
|
|
expect(actual).toBe(expected);
|
|
}
|
|
});
|
|
|
|
});
|