Skip to content

Commit f421d4e

Browse files
committed
#fi-51 updating repo in package.js; phasing out withSetupTeardown
1 parent 9d7bbfb commit f421d4e

File tree

4 files changed

+48
-111
lines changed

4 files changed

+48
-111
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"delaunay-triangulate": "^1.1.6",
5555
"es6-promise": "^3.0.2",
5656
"fast-isnumeric": "^1.1.1",
57-
"gl-contour2d": "git://github.com/gl-vis/gl-contour2d.git",
57+
"gl-contour2d": "^1.1.2",
5858
"gl-error2d": "^1.0.0",
5959
"gl-error3d": "^1.0.0",
6060
"gl-heatmap2d": "^1.0.2",

test/jasmine/assets/with_setup_teardown.js

-84
This file was deleted.

test/jasmine/tests/gl2d_scatterplot_contour_test.js

+24-18
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ Plotly.register(
99
require('@lib/contourgl')
1010
);
1111

12-
var withSetupTeardown = require('../assets/with_setup_teardown');
12+
// Test utilities
13+
var createGraphDiv = require('../assets/create_graph_div');
14+
var destroyGraphDiv = require('../assets/destroy_graph_div');
15+
var failTest = require('../assets/fail_test');
1316

1417
var plotData = {
1518
'data': [
@@ -158,48 +161,51 @@ var plotDataElliptical = function(maxJitter) {
158161
};
159162

160163

161-
function makePlot(gd, mock) {
162-
return Plotly.plot(gd, mock.data, mock.layout);
164+
function makePlot(gd, mock, done) {
165+
return Plotly.plot(gd, mock.data, mock.layout)
166+
.then(null, failTest)
167+
.then(done);
163168
}
164169

165170
describe('contourgl plots', function() {
166171

172+
var gd;
173+
174+
beforeEach(function() {
175+
gd =createGraphDiv();
176+
});
177+
178+
afterEach(function() {
179+
Plotly.purge(gd);
180+
destroyGraphDiv();
181+
});
182+
167183
// this first dataset is a special case, very forgiving to the contour renderer, as it's convex,
168184
// contains no inflexion points etc.
169185
it('render without raising an error', function(done) {
170-
withSetupTeardown(done, function(gd) {
171-
return makePlot(gd, plotData);
172-
});
186+
makePlot(gd, plotData, done);
173187
});
174188

175189
it('render without raising an error', function(done) {
176190
var mock = require('@mocks/gl2d_simple_contour_fill.json');
177-
withSetupTeardown(done, function(gd) {
178-
return makePlot(gd, mock);
179-
});
191+
makePlot(gd, mock, done);
180192
});
181193

182194
it('render without raising an error (coloring: "lines")', function(done) {
183195
var mock = Lib.extendDeep({}, plotDataElliptical(0));
184196
mock.data[0].contours.coloring = 'lines'; // 'fill' is the default
185-
withSetupTeardown(done, function(gd) {
186-
return makePlot(gd, mock);
187-
});
197+
makePlot(gd, mock, done);
188198
});
189199

190200
it('render smooth, regular ellipses without raising an error (coloring: "fill")', function(done) {
191201
var mock = plotDataElliptical(0);
192-
withSetupTeardown(done, function(gd) {
193-
return makePlot(gd, mock);
194-
});
202+
makePlot(gd, mock, done);
195203
});
196204

197205
it('render ellipses with added noise without raising an error (coloring: "fill")', function(done) {
198206
var mock = plotDataElliptical(0.5);
199207
mock.data[0].contours.coloring = 'fill'; // 'fill' is the default
200208
mock.data[0].line = {smoothing: 0};
201-
withSetupTeardown(done, function(gd) {
202-
return makePlot(gd, mock);
203-
});
209+
makePlot(gd, mock, done);
204210
});
205211
});

test/jasmine/tests/gl_plot_interact_basic_test.js

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
'use strict';
22

33
var Plotly = require('@lib/index');
4-
5-
var withSetupTeardown = require('../assets/with_setup_teardown');
64
var mouseEvent = require('../assets/mouse_event');
75

6+
// Test utilities
7+
var createGraphDiv = require('../assets/create_graph_div');
8+
var destroyGraphDiv = require('../assets/destroy_graph_div');
9+
var failTest = require('../assets/fail_test');
10+
11+
812
// Expected shape of projection-related data
913
var cameraStructure = {
1014
up: {x: jasmine.any(Number), y: jasmine.any(Number), z: jasmine.any(Number)},
@@ -54,15 +58,26 @@ function testEvents(plot) {
5458

5559
describe('gl3d plots', function() {
5660

61+
var gd;
62+
63+
beforeEach(function() {
64+
gd =createGraphDiv();
65+
});
66+
67+
afterEach(function() {
68+
Plotly.purge(gd);
69+
destroyGraphDiv();
70+
});
71+
5772
it('should respond to drag interactions with mock of unset camera', function(done) {
58-
withSetupTeardown(done, function(gd) {
59-
return testEvents(makePlot(gd, require('@mocks/gl3d_scatter3d-connectgaps.json')));
60-
});
73+
testEvents(makePlot(gd, require('@mocks/gl3d_scatter3d-connectgaps.json')))
74+
.then(null, failTest) // current linter balks on .catch with 'dot-notation'; fixme a linter
75+
.then(done);
6176
});
6277

6378
it('should respond to drag interactions with mock of partially set camera', function(done) {
64-
withSetupTeardown(done, function(gd) {
65-
return testEvents(makePlot(gd, require('@mocks/gl3d_errorbars_zx.json')));
66-
});
79+
testEvents(makePlot(gd, require('@mocks/gl3d_errorbars_zx.json')))
80+
.then(null, failTest)
81+
.then(done);
6782
});
6883
});

0 commit comments

Comments
 (0)