mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 17:23:45 -05:00
Fix for < > (non HTML) tags disappearing in WYSIWYG (#13267)
* Push the latest update for WYSIWYG bug * Improvements to nested lists * OL tests and PR feedback * Fixed all toolbar options for tags * Address PR comments * Ensure style is kept and not escaped * Add all markdown toolbar action tests * Style text edge case fix * Address repeat function and type comment * add more clarifying test
This commit is contained in:
@@ -138,6 +138,7 @@ suite('HTML Markdown Converter', function (): void {
|
||||
htmlString = '<a href="http://www.microsoft.com/images/msft.png">msft</a>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '[msft](http://www.microsoft.com/images/msft.png)', 'Basic http link test failed');
|
||||
});
|
||||
|
||||
test('Should transform <li> tags', () => {
|
||||
htmlString = '<ul><li>Test</li></ul>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), `- Test`, 'Basic unordered list test failed');
|
||||
@@ -153,6 +154,40 @@ suite('HTML Markdown Converter', function (): void {
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), `1. Test\n 1. Test2\n2. Test3`, 'Basic ordered item test failed');
|
||||
});
|
||||
|
||||
test('Should keep < > tag', () => {
|
||||
htmlString = '<test>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '<test>', 'Non-HTML tag test failed to escape');
|
||||
htmlString = '<test><span style="background:red">message</span><test>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '<test><span style="background:red">message</span><test>', 'Non-HTML tag inside span tag test failed to escape');
|
||||
htmlString = '<h1><test><h1>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '# \\<test\\>', 'Non-HTML tag inside H1 tag test failed to escape');
|
||||
htmlString = '<h2><test><h2>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '## \\<test\\>', 'Non-HTML tag inside H2 tag test failed to escape');
|
||||
htmlString = '<h3><test><h3>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '### \\<test\\>', 'Non-HTML tag inside H3 tag test failed to escape');
|
||||
htmlString = '<a href="https://www.microsoft.com/images/msft.png"><msft></a>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '[\\<msft\\>](https://www.microsoft.com/images/msft.png)', 'Non-HTML tag as link test failed to escape');
|
||||
htmlString = '<strong><Bold test></strong>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '**\\<Bold test\\>**', 'Basic bold non-HTML tag test failed to escape');
|
||||
htmlString = '<em><Italicize test></em>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '_\\<Italicize test\\>_', 'Basic italicize non-HTML tag test failed to escape');
|
||||
htmlString = '<u><Underline_test></u> ';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '<u><Underline_test></u>', 'Basic underline non-HTML tag test failed to escape');
|
||||
htmlString = '<ul><li><test></li></ul>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '- \\<test\\>', 'Basic unordered list non-HTML tag item test failed to escape');
|
||||
htmlString = '<ol><li><test></li></ol>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '1. \\<test\\>', 'Basic ordered list non-HTML tag item test failed to escape');
|
||||
htmlString = '<mark><test></mark>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '<mark><test></mark>', 'Basic highlighting Non-HTML tag test failed to escape');
|
||||
htmlString = '<mark><h1><test></h1></mark>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '<mark><h1><test></h1></mark>', 'Non-HTML tag inside multiple html tags test failed to escape');
|
||||
htmlString = '<p><style></p>';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '\\<style\\>', 'Style tag as a non-HTML tag test failed to escape');
|
||||
htmlString = '<test> <u>Underlined Text style</u> end';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), '<test> <u>Underlined Text style</u> end', 'Non-HTML tag outside with style and underline test failed to escape');
|
||||
|
||||
});
|
||||
|
||||
test('Should transform table with no header', () => {
|
||||
htmlString = '<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n<th></th>\n</tr>\n</thead>\n<tbody><tr>\n<td>test</td>\n<td>test</td>\n<td>test</td>\n</tr>\n<tr>\n<td>test</td>\n<td>test</td>\n<td>test</td>\n</tr>\n<tr>\n<td>test</td>\n<td>test</td>\n<td>test</td>\n</tr>\n<tr>\n<td>test</td>\n<td>test</td>\n<td>test</td>\n</tr>\n</tbody></table>\n';
|
||||
assert.equal(htmlMarkdownConverter.convert(htmlString), `| | | |\n| --- | --- | --- |\n| test | test | test |\n| test | test | test |\n| test | test | test |\n| test | test | test |`, 'Table with no header failed');
|
||||
|
||||
Reference in New Issue
Block a user