Skip to content

Commit 353d393

Browse files
committed
use mathjax_test file for both v2 and v3
1 parent 600035d commit 353d393

File tree

4 files changed

+24
-163
lines changed

4 files changed

+24
-163
lines changed

.circleci/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ case $1 in
7070
;;
7171

7272
mathjax-firefox)
73-
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_v2 --nowatch || EXIT_STATE=$?
73+
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --nowatch || EXIT_STATE=$?
7474
exit $EXIT_STATE
7575
;;
7676

7777
mathjax-firefox82+)
78-
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax_v2 --nowatch &&
79-
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax_v3 --nowatch || EXIT_STATE=$?
78+
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax --nowatch &&
79+
./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --skip-tags=noFF82 --bundleTest=mathjax --mathjax3 --nowatch || EXIT_STATE=$?
8080
exit $EXIT_STATE
8181
;;
8282

test/jasmine/bundle_tests/mathjax_v3_test.js renamed to test/jasmine/bundle_tests/mathjax_test.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,24 @@ var createGraphDiv = require('../assets/create_graph_div');
55
var destroyGraphDiv = require('../assets/destroy_graph_div');
66
var loadScript = require('../assets/load_script');
77

8-
// TODO: find a better way reuse the code from mathjav v2 tests
9-
//
10-
//
11-
// Now with the mathjax_config no longer needed,
12-
// it might be nice to move these tests in the "regular" test
13-
// suites, but to do that we'll need to find a way to remove MathJax from
14-
// page without breaking things downstream.
15-
16-
describe('Test MathJax v3:', function() {
8+
// eslint-disable-next-line no-undef
9+
var mathjaxVersion = __karma__.config.mathjaxVersion;
10+
11+
describe('Test MathJax v' + mathjaxVersion + ':', function() {
1712
beforeAll(function(done) {
18-
loadScript('/base/node_modules/mathjax-v3/es5/tex-svg.js', done);
13+
var src = mathjaxVersion === 3 ?
14+
'/base/node_modules/mathjax-v3/es5/tex-svg.js' :
15+
'/base/node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG';
16+
17+
// N.B. we have to load MathJax "dynamically" as Karma
18+
// does not undefined the MathJax's `?config=` parameter.
19+
//
20+
// Now with the mathjax_config no longer needed,
21+
// it might be nice to move these tests in the "regular" test
22+
// suites, but to do that we'll need to find a way to remove MathJax from
23+
// page without breaking things downstream.
24+
25+
loadScript(src, done);
1926
});
2027

2128
describe('Test axis title scoot:', function() {

test/jasmine/bundle_tests/mathjax_v2_test.js

Lines changed: 0 additions & 150 deletions
This file was deleted.

test/jasmine/karma.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var isCI = Boolean(process.env.CI);
99
var argv = minimist(process.argv.slice(4), {
1010
string: ['bundleTest', 'width', 'height'],
1111
'boolean': [
12+
'mathjax3',
1213
'info',
1314
'nowatch', 'randomize',
1415
'failFast', 'doNotFailOnEmptyTestSuite',
@@ -60,6 +61,7 @@ if(argv.info) {
6061
'',
6162
'Other options:',
6263
' - `--info`: show this info message',
64+
' - `--mathjax3`: to load mathjax v3 in relevant test',
6365
' - `--Chrome` (alias `--chrome`): run test in (our custom) Chrome browser',
6466
' - `--Firefox` (alias `--FF`, `--firefox`): run test in (our custom) Firefox browser',
6567
' - `--IE11` (alias -- `ie11`)`: run test in IE11 browser',
@@ -287,6 +289,8 @@ func.defaultConfig = {
287289
tagPrefix: '@',
288290
skipTags: isCI ? 'noCI' : null,
289291

292+
mathjaxVersion: argv.mathjax3 ? 3 : 2,
293+
290294
// See https://jasmine.github.io/api/3.4/Configuration.html
291295
jasmine: {
292296
random: argv.randomize,

0 commit comments

Comments
 (0)