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;
3
3
4
4
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
5
5
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
6
+ var loadScript = require ( '../assets/load_script' ) ;
6
7
7
8
// N.B. we have to load MathJax "dynamically" as Karam
8
9
// does not undefined the MathJax's `?config=` parameter.
@@ -12,16 +13,6 @@ var destroyGraphDiv = require('../assets/destroy_graph_div');
12
13
// suites, but to do that we'll need to find a way to remove MathJax from
13
14
// page without breaking things downstream.
14
15
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
-
25
16
describe ( 'Test MathJax v2:' , function ( ) {
26
17
beforeAll ( function ( done ) {
27
18
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;
3
3
4
4
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
5
5
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
6
+ var loadScript = require ( '../assets/load_script' ) ;
6
7
7
8
// TODO: find a better way reuse the code from mathjav v2 tests
8
9
//
@@ -12,16 +13,6 @@ var destroyGraphDiv = require('../assets/destroy_graph_div');
12
13
// suites, but to do that we'll need to find a way to remove MathJax from
13
14
// page without breaking things downstream.
14
15
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
-
25
16
describe ( 'Test MathJax v3:' , function ( ) {
26
17
beforeAll ( function ( done ) {
27
18
loadScript ( '/base/node_modules/mathjax-v3/es5/tex-svg.js' , done ) ;
You can’t perform that action at this time.
0 commit comments