22
33var Plotly = require ( '@lib/index' ) ;
44
5+ var delay = require ( '../assets/delay' ) ;
56var createGraphDiv = require ( '../assets/create_graph_div' ) ;
67var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
78var loadScript = require ( '../assets/load_script' ) ;
@@ -48,12 +49,12 @@ describe('Test MathJax v' + mathjaxVersion + ' config test:', function() {
4849
4950 // before plot
5051 if ( mathjaxVersion === 3 ) {
51- expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
5252 expect ( window . MathJax . config . startup . output ) . toEqual ( 'chtml' ) ;
53+ expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
5354 }
5455 if ( mathjaxVersion === 2 ) {
55- expect ( window . MathJax . Hub . config . tex2jax . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
5656 expect ( window . MathJax . Hub . config . menuSettings . renderer ) . toEqual ( '' ) ;
57+ expect ( window . MathJax . Hub . config . tex2jax . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
5758 }
5859
5960 Plotly . newPlot ( gd , {
@@ -69,15 +70,19 @@ describe('Test MathJax v' + mathjaxVersion + ' config test:', function() {
6970 . then ( function ( ) {
7071 // after plot
7172 if ( mathjaxVersion === 3 ) {
72- expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
7373 expect ( window . MathJax . config . startup . output ) . toEqual ( 'chtml' ) ;
74+ expect ( window . MathJax . config . startup . tex . inlineMath ) . toEqual ( [ [ '|' , '|' ] ] ) ;
7475 }
7576 if ( mathjaxVersion === 2 ) {
76- // TODO: figure out why v2 implementation does not reset inlineMath
77- // expect(window.MathJax.Hub.config.tex2jax.inlineMath).toEqual([['|', '|']]);
7877 expect ( window . MathJax . Hub . config . menuSettings . renderer ) . toEqual ( '' ) ;
7978 }
8079 } )
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+ } )
8186 . then ( done , done . fail ) ;
8287 } ) ;
8388} ) ;
0 commit comments