Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions testsuite/tests/input/tex/Bbm.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterAll, beforeEach, describe, test } from '@jest/globals';
import { getTokens, toXmlMatch, setupTex, tex2mml } from '#helpers';
import { afterAll, beforeEach, describe, test, expect } from '@jest/globals';
import { getTokens, toXmlMatch, setupTex, setupComponents, tex2mml } from '#helpers';
import '#js/input/tex/bbm/BbmConfiguration';

/**********************************************************************************/
Expand Down Expand Up @@ -153,4 +153,18 @@ describe('Bbm', () => {
/**********************************************************************************/
/**********************************************************************************/

declare const MathJax: any;

setupComponents({loader: {load: ['input/tex-base', 'output/chtml']}});

describe('Bbm', () => {

test('bbm with no output', async() => {
await expect(MathJax.loader.load('[tex]/bbm').then(() => true)).resolves.toBe(true);
});
});

/**********************************************************************************/
/**********************************************************************************/

afterAll(() => getTokens('bbm'));
82 changes: 82 additions & 0 deletions testsuite/tests/input/tex/TagFormat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,88 @@ describe('Tagformat', () => {

/********************************************************************************/

test('Array tag', () => {
setupTex(['base', 'ams', 'tagformat'], {
tagformat: {
tag: (tag: string) => ['|', tag, '|'],
},
tags: 'ams'
});
toXmlMatch(
tex2mml('x \\tag{1}'),
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="x \\tag{1}" display="block">
<mtable displaystyle="true" data-latex="x \\tag{1}">
<mlabeledtr>
<mtd id="mjx-eqn:1">
<mtext data-latex="\\text{|}">|</mtext>
<mtext data-latex="\\text{1}">1</mtext>
<mtext data-latex="\\text{|}">|</mtext>
</mtd>
<mtd>
<mi data-latex="\\tag{1}">x</mi>
</mtd>
</mlabeledtr>
</mtable>
</math>`
);
});

/********************************************************************************/

test('Array tag with empty entry', () => {
setupTex(['base', 'ams', 'tagformat'], {
tagformat: {
tag: (tag: string) => ['', tag, '.'],
},
tags: 'ams'
});
toXmlMatch(
tex2mml('x \\tag{1}'),
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="x \\tag{1}" display="block">
<mtable displaystyle="true" data-latex="x \\tag{1}">
<mlabeledtr>
<mtd id="mjx-eqn:1">
<mtext data-latex="\\text{1}">1</mtext>
<mtext data-latex="\\text{.}">.</mtext>
</mtd>
<mtd>
<mi data-latex="\\tag{1}">x</mi>
</mtd>
</mlabeledtr>
</mtable>
</math>`
);
});

/********************************************************************************/

test('Array tag with null entry', () => {
setupTex(['base', 'ams', 'tagformat'], {
tagformat: {
tag: (tag: string) => [ , tag, '.'],
},
tags: 'ams'
});
toXmlMatch(
tex2mml('x \\tag{1}'),
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="x \\tag{1}" display="block">
<mtable displaystyle="true" data-latex="x \\tag{1}">
<mlabeledtr>
<mtd id="mjx-eqn:1">
<mtext data-latex="\\text{1}">1</mtext>
<mtext data-latex="\\text{.}">.</mtext>
</mtd>
<mtd>
<mi data-latex="\\tag{1}">x</mi>
</mtd>
</mlabeledtr>
</mtable>
</math>`
);
});

/********************************************************************************/

});

/**********************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion ts/input/tex/base/BaseItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ export class FnItem extends BaseItem {
// @test Mathop Apply, Mathop No Apply
if (
top.isKind('TeXAtom') &&
top.childNodes[0]?.childNodes?.length === 0
top.childNodes[0].childNodes.length === 0
) {
return [[top, item], true];
}
Expand Down