2
2
3
3
var Plotly = require ( '@lib/index' ) ;
4
4
5
+ var delay = require ( '../assets/delay' ) ;
5
6
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
6
7
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
7
8
var loadScript = require ( '../assets/load_script' ) ;
@@ -48,12 +49,12 @@ describe('Test MathJax v' + mathjaxVersion + ' config test:', function() {
48
49
49
50
// before plot
50
51
if ( mathjaxVersion === 3 ) {
51
- expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
52
52
expect ( window . MathJax . config . startup . output ) . toEqual ( 'chtml' ) ;
53
+ expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
53
54
}
54
55
if ( mathjaxVersion === 2 ) {
55
- expect ( window . MathJax . Hub . config . tex2jax . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
56
56
expect ( window . MathJax . Hub . config . menuSettings . renderer ) . toEqual ( '' ) ;
57
+ expect ( window . MathJax . Hub . config . tex2jax . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
57
58
}
58
59
59
60
Plotly . newPlot ( gd , {
@@ -69,15 +70,19 @@ describe('Test MathJax v' + mathjaxVersion + ' config test:', function() {
69
70
. then ( function ( ) {
70
71
// after plot
71
72
if ( mathjaxVersion === 3 ) {
72
- expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
73
73
expect ( window . MathJax . config . startup . output ) . toEqual ( 'chtml' ) ;
74
+ expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
74
75
}
75
76
if ( mathjaxVersion === 2 ) {
76
- // TODO: figure out why v2 implementation does not reset inlineMath
77
- // expect(window.MathJax.Hub.config.tex2jax.inlineMath).toEqual([['|', '|']]);
78
77
expect ( window . MathJax . Hub . config . menuSettings . renderer ) . toEqual ( '' ) ;
79
78
}
80
79
} )
80
+ . then ( delay ( 1000 ) ) // TODO: why we need this delay for mathjax v2 here?
81
+ . then ( function ( ) {
82
+ if ( mathjaxVersion === 2 ) {
83
+ expect ( window . MathJax . Hub . config . tex2jax . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
84
+ }
85
+ } )
81
86
. then ( done , done . fail ) ;
82
87
} ) ;
83
88
} ) ;
0 commit comments