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
11 changes: 11 additions & 0 deletions packages/math-rendering/src/__tests__/render-math.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
import { TeX } from 'mathjax-full/js/input/tex';
import renderMath, { fixMathElement } from '../render-math';
import { times } from 'lodash-es';

Expand Down Expand Up @@ -140,6 +141,16 @@ describe('render-math', () => {
});
});

it('registers the abs macro in the TeX config', () => {
const div = document.createElement('div');

renderMath(div);

const texConfig = TeX.mock.calls[0][0];

expect(texConfig.macros.abs).toEqual(['\\left|#1\\right|', 1]);
});

it('wraps the math containing element the right way', () => {
const { container } = render(
<div>
Expand Down
1 change: 1 addition & 0 deletions packages/math-rendering/src/render-math.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const createMathMLInstance = (opts, docProvided = document) => {
overarc: '\\overparen',
napprox: '\\not\\approx',
longdiv: '\\enclose{longdiv}',
abs: ['\\left|#1\\right|', 1],
};

const texConfig = opts.useSingleDollar
Expand Down
Loading