From 01445dbe9368a99e54e7bfe85bf6672c51d43bfb Mon Sep 17 00:00:00 2001 From: Alexandre Nunes Date: Sat, 19 Sep 2020 15:52:37 -0300 Subject: [PATCH] test: add mfenced and mtable as pmatrix --- __test__/index.test.ts | 83 +++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/__test__/index.test.ts b/__test__/index.test.ts index c4ce85c..1204a0a 100755 --- a/__test__/index.test.ts +++ b/__test__/index.test.ts @@ -327,33 +327,66 @@ describe('#convert', () => { describe('when mfenced represents a matrix', () => { describe('given math string with mtable, mtr and mtd tag', () => { - it('returns a matrix representation in latex', () => { - const mathml = ` - - - - A - = - - - - x - y - - - z - w - - - - - - - `; + describe('with open attribute as [', () => { + it('returns a bmatrix representation in latex', () => { + const mathml = ` + + + + A + = + + + + x + y + + + z + w + + + + + + + `; - const result = MathMLToLaTeX.convert(mathml); + const result = MathMLToLaTeX.convert(mathml); - expect(result).toBe('A = \\begin{bmatrix}\n x & y \\\\\n z & w \n\\end{bmatrix}'.replace(/\n/g, '')); + expect(result).toBe('A = \\begin{bmatrix}\n x & y \\\\\n z & w \n\\end{bmatrix}'.replace(/\n/g, '')); + }); + }); + + describe('with open attribute as [', () => { + it('returns a bmatrix representation in latex', () => { + const mathml = ` + + + + A + = + + + + x + y + + + z + w + + + + + + + `; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('A = \\begin{pmatrix}\n x & y \\\\\n z & w \n\\end{pmatrix}'.replace(/\n/g, '')); + }); }); }); });