From b003619f6a75701c8a403aa0d79f390dc94dbc34 Mon Sep 17 00:00:00 2001 From: Alexandre Nunes Date: Thu, 17 Sep 2020 11:17:20 -0300 Subject: [PATCH] test: add mtext use case for normal, bold and italic --- __test__/index.test.ts | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/__test__/index.test.ts b/__test__/index.test.ts index 78f71c7..d988596 100755 --- a/__test__/index.test.ts +++ b/__test__/index.test.ts @@ -1343,4 +1343,64 @@ describe('#convert', () => { expect(result).toBe('\\left(x + y\\right)_{0}^{1}'); }); }); + + describe('given math string with mtext', () => { + describe('mtext without any attribute', () => { + it('wrap its content inside text command', () => { + const mathml = ` + + + Theorem of Pythagoras + + + `; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('\\text{ Theorem of Pythagoras }'); + }); + }); + + describe('mtext with mathvariant attribute setted as "normal"', () => { + const mathml = ` + + + Theorem of Pythagoras + + + `; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('\\text{ Theorem of Pythagoras }'); + }); + + describe('mtext with mathvariant attribute setted as "normal"', () => { + const mathml = ` + + + Theorem of Pythagoras + + + `; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('\\textbf{ Theorem of Pythagoras }'); + }); + + describe('mtext with mathvariant attribute setted as "normal"', () => { + const mathml = ` + + + Theorem of Pythagoras + + + `; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('\\textit{ Theorem of Pythagoras }'); + }); + }); });