collab/mermaid/cypress/integration/rendering/katex.spec.jsblame
View source
6dd74de1import { imgSnapshotTest } from '../../helpers/util';
6dd74de2
6dd74de3describe('Katex', () => {
6dd74de4 it('1: should render a complex Katex flowchart no htmlLabels', () => {
6dd74de5 imgSnapshotTest(
6dd74de6 `graph LR
6dd74de7 A["$$f(\\relax{x}) = \\int_{-\\infty}^\\infty \\hat{f}(\\xi)\\,e^{2 \\pi i \\xi x}\\,d\\xi$$"] -->|"$$\\Bigg(\\bigg(\\Big(\\big((\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a})\\big)\\Big)\\bigg)\\Bigg)$$"| B("$$1+\\frac{e^{-2\\pi}} {1+\\frac{e^{-4\\pi}} {1+\\frac{e^{-6\\pi}} {1+\\frac{e^{-8\\pi}} {1+\\cdots}}}}$$")
6dd74de8 A -->|"$$\\overbrace{a+b+c}^{\\text{note}}$$"| C("$$\\phase{-78^\\circ}$$")
6dd74de9 B --> D("$$x = \\begin{cases} a &\\text{if } b \\\\ c &\\text{if } d \\end{cases}$$")
6dd74de10 C --> E("$$x(t)=c_1\\begin{bmatrix}-\\cos{t}+\\sin{t}\\\\ 2\\cos{t} \\end{bmatrix}e^{2t}$$")`,
6dd74de11 { fontFamily: 'courier' }
6dd74de12 );
6dd74de13 });
6dd74de14 it('2: should render a Katex flowchart containing the Greek alphabet', () => {
6dd74de15 imgSnapshotTest(
6dd74de16 `graph LR
6dd74de17 A["$$\\alpha\\beta\\gamma\\delta\\epsilon\\zeta\\eta\\theta\\iota\\kappa\\lambda\\mu\\nu\\xi\\omicron\\pi\\rho\\sigma\\tau\\upsilon\\phi\\chi\\psi\\omega$$"] --> B["$$\\Alpha\\Beta\\Gamma\\Delta\\Epsilon\\Zeta\\Eta\\Theta\\Iota\\Kappa\\Lambda\\Mu\\Nu\\Xi\\Omicron\\Pi\\Rho\\Sigma\\Tau\\Upsilon\\Phi\\Chi\\Psi\\Omega$$"]`,
6dd74de18 { fontFamily: 'courier' }
6dd74de19 );
6dd74de20 });
6dd74de21 it('3: should render a Katex flowchart containing set theory symbols', () => {
6dd74de22 imgSnapshotTest(
6dd74de23 `graph LR
6dd74de24 A["$$\\forall\\complement\\therefore\\emptyset\\exists\\subset\\because\\empty\\exist\\supset\\mapsto\\varnothing\\nexists\\mid\\to\\implies\\in\\land\\gets\\impliedby\\isin\\lor\\leftrightarrow\\iff\\notin\\ni\\notni\\lnot$$"] --> B["$$\\nabla\\Im\\Reals\\jmath\\partial\\image\\wp\\aleph\\Game\\weierp\\alef\\Finv\\N\\Z\\alefsym\\cnums\\natnums\\beth\\Complex\\R\\gimel\\ell\\Re\\daleth\\hbar\\real\\eth\\hslash\\reals$$"]`,
6dd74de25 { fontFamily: 'courier' }
6dd74de26 );
6dd74de27 });
6dd74de28 // TODO: changes made to develop between Feb 13 - Feb 23 cause this test to no longer function
6dd74de29 // it.skip('4: should render an error box originating from Katex', () => {
6dd74de30 // imgSnapshotTest(
6dd74de31 // `graph LR
6dd74de32 // A["$$\\shouldBeError$$"]`,
6dd74de33 // { fontFamily: 'courier' }
6dd74de34 // );
6dd74de35 // });
6dd74de36});