1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-24 23:26:50 +02:00

Desktop: Fixed pasting HTML in Rich Text editor, and improved pasting plain text

This commit is contained in:
Laurent Cozic
2021-05-20 18:08:59 +02:00
parent 9e9bf63d70
commit 2226b79c46
6 changed files with 79 additions and 11 deletions

View File

@ -0,0 +1,28 @@
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"/>',
'&lt;img onerror=&quot;http://downloadmalware.com&quot;/&gt;',
],
];
for (const t of testCases) {
const [input, expected] = t;
const actual = plainTextToHtml(input);
expect(actual).toBe(expected);
}
});
});