File tree Expand file tree Collapse file tree 3 files changed +13
-20
lines changed Expand file tree Collapse file tree 3 files changed +13
-20
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ module . exports = function loadScript ( src , done ) {
4+ var newScript ;
5+ newScript = document . createElement ( 'script' ) ;
6+ newScript . src = src ;
7+ newScript . type = 'text/javascript' ;
8+ newScript . onload = done ;
9+ newScript . onerror = done . fail ;
10+ document . body . appendChild ( newScript ) ;
11+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var d3Select = require('../../strict-d3').select;
33
44var createGraphDiv = require ( '../assets/create_graph_div' ) ;
55var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
6+ var loadScript = require ( '../assets/load_script' ) ;
67
78// N.B. we have to load MathJax "dynamically" as Karam
89// does not undefined the MathJax's `?config=` parameter.
@@ -12,16 +13,6 @@ var destroyGraphDiv = require('../assets/destroy_graph_div');
1213// suites, but to do that we'll need to find a way to remove MathJax from
1314// page without breaking things downstream.
1415
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- }
24-
2516describe ( 'Test MathJax v2:' , function ( ) {
2617 beforeAll ( function ( done ) {
2718 loadScript ( '/base/node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG' , done ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var d3Select = require('../../strict-d3').select;
33
44var createGraphDiv = require ( '../assets/create_graph_div' ) ;
55var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
6+ var loadScript = require ( '../assets/load_script' ) ;
67
78// TODO: find a better way reuse the code from mathjav v2 tests
89//
@@ -12,16 +13,6 @@ var destroyGraphDiv = require('../assets/destroy_graph_div');
1213// suites, but to do that we'll need to find a way to remove MathJax from
1314// page without breaking things downstream.
1415
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- }
24-
2516describe ( 'Test MathJax v3:' , function ( ) {
2617 beforeAll ( function ( done ) {
2718 loadScript ( '/base/node_modules/mathjax-v3/es5/tex-svg.js' , done ) ;
You can’t perform that action at this time.
0 commit comments