@@ -4,28 +4,27 @@ var d3Select = require('../../strict-d3').select;
44var createGraphDiv = require ( '../assets/create_graph_div' ) ;
55var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
66
7+ // N.B. we have to load MathJax "dynamically" as Karam
8+ // does not undefined the MathJax's `?config=` parameter.
9+ //
10+ // Now with the mathjax_config no longer needed,
11+ // it might be nice to move these tests in the "regular" test
12+ // suites, but to do that we'll need to find a way to remove MathJax from
13+ // page without breaking things downstream.
14+
15+ function loadScript ( src , done ) {
16+ var newScript ;
17+ newScript = document . createElement ( 'script' ) ;
18+ newScript . src = src ;
19+ newScript . type = 'text/javascript' ;
20+ newScript . onload = done ;
21+ newScript . onerror = done . fail ;
22+ document . body . appendChild ( newScript ) ;
23+ }
724
825describe ( 'Test MathJax v2:' , function ( ) {
9- var mathJaxScriptTag ;
10-
11- // N.B. we have to load MathJax "dynamically" as Karam
12- // does not undefined the MathJax's `?config=` parameter.
13- //
14- // Now with the mathjax_config no longer needed,
15- // it might be nice to move these tests in the "regular" test
16- // suites, but to do that we'll need to find a way to remove MathJax from
17- // page without breaking things downstream.
1826 beforeAll ( function ( done ) {
19- mathJaxScriptTag = document . createElement ( 'script' ) ;
20- mathJaxScriptTag . type = 'text/javascript' ;
21- mathJaxScriptTag . onload = function ( ) {
22- done ( ) ;
23- } ;
24- mathJaxScriptTag . onerror = function ( ) {
25- fail ( 'MathJax v2 failed to load' ) ;
26- } ;
27- mathJaxScriptTag . src = '/base/node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG' ;
28- document . body . appendChild ( mathJaxScriptTag ) ;
27+ loadScript ( '/base/node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG' , done ) ;
2928 } ) ;
3029
3130 describe ( 'Test axis title scoot:' , function ( ) {
0 commit comments