-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathcolorbar_test.js
59 lines (50 loc) · 2.78 KB
/
colorbar_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var Plotly = require('@lib/index');
var Colorbar = require('@src/components/colorbar');
var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');
describe('Test colorbar:', function() {
'use strict';
describe('hasColorbar', function() {
var hasColorbar = Colorbar.hasColorbar,
trace;
it('should return true when marker colorbar is defined', function() {
trace = {
marker: {
colorbar: {},
line: {
colorbar: {}
}
}
};
expect(hasColorbar(trace.marker)).toBe(true);
expect(hasColorbar(trace.marker.line)).toBe(true);
trace = {
marker: {
line: {}
}
};
expect(hasColorbar(trace.marker)).toBe(false);
expect(hasColorbar(trace.marker.line)).toBe(false);
});
});
describe('floating point limits', function() {
var gd;
beforeEach(function() {
gd = createGraphDiv();
});
afterEach(destroyGraphDiv);
it('does not lock up on tiny fractional ranges', function(done) {
var z = [
[9607345622458638.0, 9607345622458652.0, 9607345622458652.0, 9607345622458646.0, 9607345622458652.0, 9607345622458650.0, 9607345622458650.0, 9607345622458646.0],
[9607345622458654.0, 9607345622458640.0, 9607345622458650.0, 9607345622458652.0, 9607345622458652.0, 9607345622458654.0, 9607345622458650.0, 9607345622458652.0],
[9607345622458654.0, 9607345622458652.0, 9607345622458638.0, 9607345622458652.0, 9607345622458650.0, 9607345622458652.0, 9607345622458654.0, 9607345622458650.0],
[9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458632.0, 9607345622458644.0, 9607345622458646.0, 9607345622458646.0, 9607345622458650.0],
[9607345622458654.0, 9607345622458652.0, 9607345622458650.0, 9607345622458650.0, 9607345622458638.0, 9607345622458654.0, 9607345622458654.0, 9607345622458650.0],
[9607345622458650.0, 9607345622458654.0, 9607345622458650.0, 9607345622458646.0, 9607345622458652.0, 9607345622458638.0, 9607345622458646.0, 9607345622458652.0],
[9607345622458654.0, 9607345622458652.0, 9607345622458654.0, 9607345622458650.0, 9607345622458654.0, 9607345622458652.0, 9607345622458640.0, 9607345622458654.0],
[9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458652.0, 9607345622458650.0, 9607345622458654.0, 9607345622458654.0, 9607345622458638.0]
];
Plotly.newPlot(gd, [{type: 'heatmap', z: z}]).then(done);
});
});
});