|
3 | 3 | import React from 'react'; |
4 | 4 | import TestRenderer from 'react-test-renderer'; |
5 | 5 | import ReactTestUtils from 'react-dom/test-utils'; |
| 6 | +import { MathJaxContext } from 'better-react-mathjax'; |
6 | 7 | import Editor from './Editor.jsx'; |
7 | 8 | import { exportGraph } from './GraphMapping.js'; |
8 | 9 |
|
9 | 10 | it('renders without crashing', () => { |
10 | | - TestRenderer.create(<Editor />); |
| 11 | + TestRenderer.create( |
| 12 | + <MathJaxContext> |
| 13 | + <Editor /> |
| 14 | + </MathJaxContext> |
| 15 | + ); |
11 | 16 | }); |
12 | 17 |
|
13 | 18 | it('renders with children in the expected visibility state', () => { |
14 | | - TestRenderer.create(<Editor />, function() { |
15 | | - expect(this.gp.current.props.showing).toBe(true); |
16 | | - expect(this.ge.current.props.showing).toBe(false); |
| 19 | + TestRenderer.create( |
| 20 | + <MathJaxContext> |
| 21 | + <Editor /> |
| 22 | + </MathJaxContext>, |
| 23 | + function() { |
| 24 | + expect(this.gp.current.props.showing).toBe(true); |
| 25 | + expect(this.ge.current.props.showing).toBe(false); |
17 | 26 |
|
18 | | - expect(ReactTestUtils.isCompositeComponent(this.gp.current)).toBe(true); |
19 | | - expect(ReactTestUtils.isCompositeComponent(this.ge.current)).toBe(true); |
| 27 | + expect(ReactTestUtils.isCompositeComponent(this.gp.current)).toBe(true); |
| 28 | + expect(ReactTestUtils.isCompositeComponent(this.ge.current)).toBe(true); |
20 | 29 |
|
21 | | - expect(this.state.step).toBe(0); |
22 | | - expect(this.state.gType).toBe(null); |
23 | | - ReactTestUtils.Simulate.click(this.gp.current.b1); |
24 | | - // expect(this.state.step).toBe(1); |
25 | | - }); |
| 30 | + expect(this.state.step).toBe(0); |
| 31 | + expect(this.state.gType).toBe(null); |
| 32 | + ReactTestUtils.Simulate.click(this.gp.current.b1); |
| 33 | + // expect(this.state.step).toBe(1); |
| 34 | + }); |
26 | 35 | }); |
27 | 36 |
|
28 | 37 | it('exports its graph state', () => { |
29 | | - TestRenderer.create(<Editor />, function() { |
30 | | - let o = exportGraph(this.state); |
31 | | - expect(o.graph_type).toBe(null); |
32 | | - expect(o.show_intersection).toBe(true); |
33 | | - expect(o.line_1_slope).toBe(1); |
34 | | - expect(o.line_2_slope).toBe(-1); |
35 | | - expect(o.line_1_label).toBe(''); |
36 | | - expect(o.line_2_label).toBe(''); |
37 | | - expect(o.y_axis_label).toBe(''); |
38 | | - expect(o.x_axis_label).toBe(''); |
39 | | - }); |
| 38 | + TestRenderer.create( |
| 39 | + <MathJaxContext> |
| 40 | + <Editor /> |
| 41 | + </MathJaxContext>, |
| 42 | + function() { |
| 43 | + let o = exportGraph(this.state); |
| 44 | + expect(o.graph_type).toBe(null); |
| 45 | + expect(o.show_intersection).toBe(true); |
| 46 | + expect(o.line_1_slope).toBe(1); |
| 47 | + expect(o.line_2_slope).toBe(-1); |
| 48 | + expect(o.line_1_label).toBe(''); |
| 49 | + expect(o.line_2_label).toBe(''); |
| 50 | + expect(o.y_axis_label).toBe(''); |
| 51 | + expect(o.x_axis_label).toBe(''); |
| 52 | + }); |
40 | 53 | }); |
0 commit comments