test: add especial symbols to mi tag implementation

This commit is contained in:
Alexandre Nunes 2020-09-19 14:14:03 -03:00
parent 83dc582946
commit 65e1d0985c
1 changed files with 27 additions and 5 deletions

View File

@ -21,13 +21,35 @@ describe('#convert', () => {
}); });
}); });
describe('given math string with mi tag with space on it', () => { describe('given math string with mi tag', () => {
test('should trim empty space', () => { describe('tag with space on it', () => {
const mathml = '<root><math><mi> a </mi></math></root>'; test('should trim empty space', () => {
const mathml = '<root><math><mi> a </mi></math></root>';
const result = MathMLToLaTeX.convert(mathml); const result = MathMLToLaTeX.convert(mathml);
expect(result).toBe('a'); expect(result).toBe('a');
});
});
describe('with especial operator', () => {
test('should convert to latex command', () => {
const mathml = '<root><math><mi> &#x221E; </mi></math></root>';
const result = MathMLToLaTeX.convert(mathml);
expect(result).toBe('\\infty');
});
});
describe('with empty space', () => {
test('should keep empty space and convert to mathrm command', () => {
const mathml = '<root><math><mi> </mi></math></root>';
const result = MathMLToLaTeX.convert(mathml);
expect(result).toBe('\\textrm{ }');
});
}); });
}); });