diff --git a/testsuite/tests/input/tex/Bbm.test.ts b/testsuite/tests/input/tex/Bbm.test.ts index 4b3ae11b1..224a45583 100644 --- a/testsuite/tests/input/tex/Bbm.test.ts +++ b/testsuite/tests/input/tex/Bbm.test.ts @@ -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'; /**********************************************************************************/ @@ -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')); diff --git a/testsuite/tests/input/tex/TagFormat.test.ts b/testsuite/tests/input/tex/TagFormat.test.ts index 0940570a0..2ab96418d 100644 --- a/testsuite/tests/input/tex/TagFormat.test.ts +++ b/testsuite/tests/input/tex/TagFormat.test.ts @@ -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}'), + ` + + + + | + 1 + | + + + x + + + + ` + ); + }); + + /********************************************************************************/ + + test('Array tag with empty entry', () => { + setupTex(['base', 'ams', 'tagformat'], { + tagformat: { + tag: (tag: string) => ['', tag, '.'], + }, + tags: 'ams' + }); + toXmlMatch( + tex2mml('x \\tag{1}'), + ` + + + + 1 + . + + + x + + + + ` + ); + }); + + /********************************************************************************/ + + test('Array tag with null entry', () => { + setupTex(['base', 'ams', 'tagformat'], { + tagformat: { + tag: (tag: string) => [ , tag, '.'], + }, + tags: 'ams' + }); + toXmlMatch( + tex2mml('x \\tag{1}'), + ` + + + + 1 + . + + + x + + + + ` + ); + }); + + /********************************************************************************/ + }); /**********************************************************************************/ diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index 22be6f323..b69cf4b3c 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -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]; }