-
Notifications
You must be signed in to change notification settings - Fork 31
/
test.jsx
43 lines (37 loc) · 1.03 KB
/
test.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import expect from "expect";
import React from "react";
import { render, unmountComponentAtNode } from "react-dom";
import ReactMathjaxPreview from "./index.jsx";
describe("ReactMathjaxPreview", () => {
let node;
beforeEach(() => {
node = document.createElement("div");
});
afterEach(() => {
unmountComponentAtNode(node);
});
// TODO: test MathJax rendered output
it("renders MathJax", () => {
render(
<ReactMathjaxPreview
math={String.raw`$\lim_{x \to \infty} \exp(-x) = 0$`}
/>,
node,
() => {
expect(node.innerHTML).toContain("react-mathjax-preview-result");
}
);
});
it("renders MathJax with dynamic script", () => {
render(
<ReactMathjaxPreview
script="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-MML-AM_HTMLorMML"
math={String.raw`$\lim_{x \to \infty} \exp(-x) = 0$`}
/>,
node,
() => {
expect(node.innerHTML).toContain("react-mathjax-preview-result");
}
);
});
});