Skip to content

Commit e8434c8

Browse files
committed
Enhance createGraphDiv function to accept a customizable divId parameter and update tests to utilize the new functionality.
1 parent bc80967 commit e8434c8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/jasmine/assets/create_graph_div.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
module.exports = function createGraphDiv() {
3+
module.exports = function createGraphDiv(divId = 'graph') {
44
var gd = document.createElement('div');
5-
gd.id = 'graph';
5+
gd.id = divId;
66
document.body.appendChild(gd);
77

88
// force the graph to be at position 0,0 no matter what

test/jasmine/tests/titles_test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var Lib = require('../../../src/lib');
88
var rgb = require('../../../src/components/color').rgb;
99

1010
var createGraphDiv = require('../assets/create_graph_div');
11-
var createShadowGraphDiv = require('../assets/create_shadow_graph_div');
1211
var destroyGraphDiv = require('../assets/destroy_graph_div');
1312
var mouseEvent = require('../assets/mouse_event');
1413

@@ -984,7 +983,7 @@ describe('Title automargining', function() {
984983

985984
it('computes title automargins independently when multiple plots exist', function(done) {
986985
var gd1 = gd;
987-
var gd2 = createShadowGraphDiv();
986+
var gd2 = createGraphDiv('title-automargining-2');
988987

989988
var dataLocal = [{x: [1, 2], y: [1, 2]}];
990989

@@ -1020,6 +1019,9 @@ describe('Title automargining', function() {
10201019
var t2 = gd2._fullLayout._size.t;
10211020

10221021
expect(t1).toBeGreaterThan(t2);
1022+
}).then(function() {
1023+
var el = document.getElementById('title-automargining-2');
1024+
if(el) document.body.removeChild(el);
10231025
})
10241026
.then(done, done.fail);
10251027
});

0 commit comments

Comments
 (0)