WYSIWYG Improvements to Nested Lists (#14052)

* indent/outdent working properly

* Add tests

* Latest fixes and tests

* PR comments + comments
This commit is contained in:
Chris LaFreniere
2021-01-27 12:57:23 -08:00
committed by GitHub
parent b3891ff68b
commit 26bb3ca033
2 changed files with 51 additions and 2 deletions

View File

@@ -148,10 +148,18 @@ suite('HTML Markdown Converter', function (): void {
test('Should transform <li> tags', () => {
htmlString = '<ul><li>Test</li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test`, 'Basic unordered list test failed');
htmlString = '<ul><li><span>Test</span><br></li><li>Test2</li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test\n- Test2`, 'Basic unordered list test with span and line break failed');
htmlString = '<ul><li><span>Test</span><br><br></li><li>Test2</li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test \n \n \n- Test2`, 'Basic unordered list test with span and line break failed');
htmlString = '<ul><li>Test</li><li>Test2</li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test\n- Test2`, 'Basic unordered 2 item list test failed');
htmlString = '<ul><li>Test<ul><li>Test2</li></ul><li>Test3</li></ul>';
htmlString = '<ul><li>Test</li><ul><li>Test2</li></ul><li>Test3</li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test\n - Test2\n- Test3`, 'Nested item list test failed');
htmlString = '<ul><li>Test</li><ul><li>Test2</li></ul><ul></ul><li>Test3</li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test\n - Test2\n- Test3`, 'Nested item list test empty list failed');
htmlString = '<ul><li><span>Hello</span><br></li><li><span>Hello</span></li></ul>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Hello\n- Hello`, 'Nested item list test empty list failed');
htmlString = '<ol><li>Test</li></ol>';
assert.equal(htmlMarkdownConverter.convert(htmlString), `1. Test`, 'Basic ordered item test failed');
htmlString = '<ol><li>Test</li><li>Test2</li></ol>';