| 1 | import { imgSnapshotTest } from '../../helpers/util'; |
| 2 | |
| 3 | describe('Katex', () => { |
| 4 | it('1: should render a complex Katex flowchart no htmlLabels', () => { |
| 5 | imgSnapshotTest( |
| 6 | `graph LR |
| 7 | 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}}}}$$") |
| 8 | A -->|"$$\\overbrace{a+b+c}^{\\text{note}}$$"| C("$$\\phase{-78^\\circ}$$") |
| 9 | B --> D("$$x = \\begin{cases} a &\\text{if } b \\\\ c &\\text{if } d \\end{cases}$$") |
| 10 | C --> E("$$x(t)=c_1\\begin{bmatrix}-\\cos{t}+\\sin{t}\\\\ 2\\cos{t} \\end{bmatrix}e^{2t}$$")`, |
| 11 | { fontFamily: 'courier' } |
| 12 | ); |
| 13 | }); |
| 14 | it('2: should render a Katex flowchart containing the Greek alphabet', () => { |
| 15 | imgSnapshotTest( |
| 16 | `graph LR |
| 17 | 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$$"]`, |
| 18 | { fontFamily: 'courier' } |
| 19 | ); |
| 20 | }); |
| 21 | it('3: should render a Katex flowchart containing set theory symbols', () => { |
| 22 | imgSnapshotTest( |
| 23 | `graph LR |
| 24 | 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$$"]`, |
| 25 | { fontFamily: 'courier' } |
| 26 | ); |
| 27 | }); |
| 28 | // TODO: changes made to develop between Feb 13 - Feb 23 cause this test to no longer function |
| 29 | // it.skip('4: should render an error box originating from Katex', () => { |
| 30 | // imgSnapshotTest( |
| 31 | // `graph LR |
| 32 | // A["$$\\shouldBeError$$"]`, |
| 33 | // { fontFamily: 'courier' } |
| 34 | // ); |
| 35 | // }); |
| 36 | }); |
| 37 | |