Skip to content

Commit 7deeec7

Browse files
committed
put create and destroy graph div routine in jasmine tests assets/
1 parent 35c59c9 commit 7deeec7

File tree

4 files changed

+20
-24
lines changed

4 files changed

+20
-24
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
module.exports = function createGraphDiv() {
4+
var gd = document.createElement('div');
5+
gd.id = 'graph';
6+
document.body.appendChild(gd);
7+
return gd;
8+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
module.exports = function destroyGraphDiv() {
4+
var gd = document.getElementById('graph');
5+
document.body.removeChild(gd);
6+
};

test/jasmine/tests/gl_plot_interact_test.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ var d3 = require('d3');
22

33
var Plotly = require('@src/index');
44

5+
var createGraphDiv = require('../assets/create_graph_div');
6+
var destroyGraphDiv = require('../assets/destroy_graph_div');
7+
58
/*
69
* WebGL interaction test cases fail on the CircleCI
710
* most likely due to a WebGL/driver issue
@@ -12,18 +15,6 @@ var Plotly = require('@src/index');
1215
describe('Test plot structure', function () {
1316
'use strict';
1417

15-
function createGraphDiv() {
16-
var gd = document.createElement('div');
17-
gd.id = 'graph';
18-
document.body.appendChild(gd);
19-
return gd;
20-
}
21-
22-
function destroyGraphDiv() {
23-
var gd = document.getElementById('graph');
24-
document.body.removeChild(gd);
25-
}
26-
2718
afterEach(destroyGraphDiv);
2819

2920
describe('gl3d plots', function() {

test/jasmine/tests/plot_interact_test.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,13 @@ var d3 = require('d3');
33
var Plotly = require('@src/index');
44
var Fx = require('@src/plots/cartesian/graph_interact');
55

6+
var createGraphDiv = require('../assets/create_graph_div');
7+
var destroyGraphDiv = require('../assets/destroy_graph_div');
8+
69

710
describe('Test plot structure', function () {
811
'use strict';
912

10-
function createGraphDiv() {
11-
var gd = document.createElement('div');
12-
gd.id = 'graph';
13-
document.body.appendChild(gd);
14-
return gd;
15-
}
16-
17-
function destroyGraphDiv() {
18-
var gd = document.getElementById('graph');
19-
document.body.removeChild(gd);
20-
}
21-
2213
afterEach(destroyGraphDiv);
2314

2415
describe('cartesian plots', function() {

0 commit comments

Comments
 (0)