Skip to content

Commit 65fef96

Browse files
committed
add a few more bundle tests
1 parent 60e67c2 commit 65fef96

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
var d3 = require('d3');
2+
3+
var Plotly = require('@lib/core');
4+
var PlotlyChoropleth = require('@lib/choropleth');
5+
6+
var createGraphDiv = require('../assets/create_graph_div');
7+
var destroyGraphDiv = require('../assets/destroy_graph_div');
8+
9+
10+
describe('Bundle with choropleth', function() {
11+
'use strict';
12+
13+
Plotly.register(PlotlyChoropleth);
14+
15+
var mock = require('@mocks/geo_multiple-usa-choropleths.json');
16+
17+
beforeEach(function(done) {
18+
Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(done);
19+
});
20+
21+
afterEach(destroyGraphDiv);
22+
23+
it('should graph choropleth traces', function() {
24+
var nodes = d3.selectAll('g.trace.choropleth');
25+
26+
expect(nodes.size()).toEqual(4);
27+
});
28+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
var d3 = require('d3');
2+
3+
var Plotly = require('@lib/core');
4+
var PlotlyContour = require('@lib/contour');
5+
6+
var createGraphDiv = require('../assets/create_graph_div');
7+
var destroyGraphDiv = require('../assets/destroy_graph_div');
8+
9+
10+
describe('Bundle with contour', function() {
11+
'use strict';
12+
13+
Plotly.register(PlotlyContour);
14+
15+
var mock = require('@mocks/contour_scatter.json');
16+
17+
beforeEach(function(done) {
18+
Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(done);
19+
});
20+
21+
afterEach(destroyGraphDiv);
22+
23+
it('should graph scatter traces', function() {
24+
var nodes = d3.selectAll('g.trace.scatter');
25+
26+
expect(nodes.size()).toEqual(1);
27+
});
28+
29+
it('should graph contour traces', function() {
30+
var nodes = d3.selectAll('g.contour');
31+
32+
expect(nodes.size()).toEqual(1);
33+
});
34+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
var d3 = require('d3');
2+
3+
var Plotly = require('@lib/core');
4+
var PlotlyHistogram2dContour = require('@lib/histogram2dcontour');
5+
var PlotlyHistogram = require('@lib/histogram');
6+
7+
var createGraphDiv = require('../assets/create_graph_div');
8+
var destroyGraphDiv = require('../assets/destroy_graph_div');
9+
10+
11+
describe('Bundle with histogram2dcontour and histogram', function() {
12+
'use strict';
13+
14+
Plotly.register([PlotlyHistogram2dContour, PlotlyHistogram]);
15+
16+
var mock = require('@mocks/2dhistogram_contour_subplots.json');
17+
18+
beforeEach(function(done) {
19+
Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(done);
20+
});
21+
22+
afterEach(destroyGraphDiv);
23+
24+
it('should graph scatter traces', function() {
25+
var nodes = d3.selectAll('g.trace.scatter');
26+
27+
expect(nodes.size()).toEqual(1);
28+
});
29+
30+
it('should graph contour traces', function() {
31+
var nodes = d3.selectAll('g.contour');
32+
33+
expect(nodes.size()).toEqual(1);
34+
});
35+
36+
it('should graph histogram traces', function() {
37+
var nodes = d3.selectAll('g.bars');
38+
39+
expect(nodes.size()).toEqual(2);
40+
});
41+
});

0 commit comments

Comments
 (0)