You've already forked joplin
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:
28
packages/lib/htmlUtils.test.ts
Normal file
28
packages/lib/htmlUtils.test.ts
Normal 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"/>',
|
||||
'<img onerror="http://downloadmalware.com"/>',
|
||||
],
|
||||
];
|
||||
|
||||
for (const t of testCases) {
|
||||
const [input, expected] = t;
|
||||
const actual = plainTextToHtml(input);
|
||||
expect(actual).toBe(expected);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user