import { afterAll, beforeEach, describe, expect, test } from '@jest/globals';
import {
getTokens,
setupTex,
setupTexRender,
tex2mml,
render2mml,
expectTexError,
} from '#helpers';
import '#js/input/tex/texhtml/TexHtmlConfiguration';
/**********************************************************************************/
describe('Texhtml', () => {
beforeEach(() => setupTexRender(['base', 'texhtml'], { allowTexHTML: true }));
test('Html', () => {
expect(
render2mml('x + bold + y')
).toMatchSnapshot();
});
test('Html multiple', () => {
expect(
render2mml(
'x + bold + italicy'
)
).toMatchSnapshot();
});
test('Html nested', () => {
expect(
render2mml(
'x + bold and html + y'
)
).toMatchSnapshot();
});
test('Html empty tag', () => {
expect(render2mml('x + + y')).toMatchSnapshot();
});
test('Html no tag', () => {
expect(render2mml('x < y')).toMatchSnapshot();
});
});
/**********************************************************************************/
describe('Texhtml error', () => {
beforeEach(() => setupTex(['base', 'texhtml'], { allowTexHTML: true }));
test('Html missing comment tag', () => {
expectTexError('x + bold + y').toBe(
'Could not find for '
);
});
});
/**********************************************************************************/
describe('Texhtml not enabled', () => {
beforeEach(() => setupTex(['base', 'texhtml'], { allowTexHTML: false }));
test('Html not allowed', () => {
expect(tex2mml('x + a + y')).toMatchSnapshot();
});
});
/**********************************************************************************/
afterAll(() => getTokens('texhtml'));