diff --git a/tests/js/htmlparser.test.js b/tests/js/htmlparser.test.js index 20ec12a..d540abd 100644 --- a/tests/js/htmlparser.test.js +++ b/tests/js/htmlparser.test.js @@ -1,7 +1,7 @@ import {expect, test} from '@jest/globals'; import {parseEditorContent} from './src/htmlparser.mjs'; -test('html 1', () => { +test('Language markers spread via several block elements.', () => { const html = '

{mlang de}

Foo bar {mlang}
'; const parsed = '

{mlang de}' @@ -12,7 +12,7 @@ test('html 1', () => { expect(parseEditorContent(html)).toEqual(parsed); }); -test('html 2', () => { +test('Only one closing language tag.', () => { const html = '

Foo bar {mlang}
'; const parsed = '
Foo bar {mlang other}' @@ -20,7 +20,7 @@ test('html 2', () => { expect(parseEditorContent(html)).toEqual(parsed); }); -test('html 3', () => { +test('Language tags in text and attribures, attributes without value.', () => { const html = '

{mlang en}This is a test{mlang}{mlang de}Das ist ein Test{mlang}.

\n' + '

This is a multilang link: {mlang\n' @@ -66,7 +66,7 @@ test('html 3', () => { + 'contenteditable="false" class="multilang-end mceNonEditable" data-mce-contenteditable="false">{mlang}

'; expect(parseEditorContent(html)).toEqual(parsed); }); -test('html 4', () => { +test('Already containing tiny tags for language markers.', () => { const html = '

{mlang en}English rules' + '{mlang}' @@ -76,7 +76,7 @@ test('html 4', () => { + 'contenteditable="false" class="multilang-end mceNonEditable" data-mce-contenteditable="false">{mlang}

'; expect(parseEditorContent(html)).toEqual(parsed); }); -test('html 5', () => { +test('Html containing comments.', () => { const html = '

\n' @@ -91,4 +91,30 @@ test('html 5', () => { + 'data-mce-contenteditable="false">{mlang}

\n' + '

Done

\n'; expect(parseEditorContent(html)).toEqual(parsed); +}); +test('Html containing a svg.', () => { + const html = '

Resistor: \n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '

'; + expect(parseEditorContent(html)).toEqual(html); +}); +test('Html with tex anotations.', () => { + const html = '

The Quadratic Equation: \\(ax^2 + bx + c = 0\\)

'; + expect(parseEditorContent(html)).toEqual(html); +}); +test('Html containing mathml elements.', () => { + const html = '

The Quadratic Equation: ' + + ' \n' + + ' a x2\n' + + ' +bx\n' + + ' +c\n' + + ' \n' + + '

'; + expect(parseEditorContent(html)).toEqual(html); }); \ No newline at end of file