import postprocessEditorOutput from './postprocessEditorOutput'; const normalizeHtmlString = (html: string) => { return html.replace(/\s+/g, ' ').trim(); }; const processListHtml = (inputHtml: string) => { const doc = new DOMParser().parseFromString(`
${inputHtml}`, 'text/html'); const output = postprocessEditorOutput(doc.body); return normalizeHtmlString(output.querySelector('ul').outerHTML); }; describe('postprocessEditorOutput', () => { test.each([ [ 'should remove extra paragraphs from around list items', `Test
Test 3
Parent item
Nested item
After nested
First paragraph
Second paragraph
Nested
First paragraph
Second paragraph
Before
Nested
After
Before
After
Paragraph
Paragraph
Parent
Nested
After nested
Should remove single wrapper paragraphs.
Should not remove paragraphs...
...when there are multiple.
Should not remove paragraphs...
...when there are multiple.