Skip to content

Commit b3ee369

Browse files
committed
improve test - add tiny bars
1 parent 96ef28a commit b3ee369

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed
-2.26 KB
Loading

test/image/mocks/bar_hide_nulls.json

+17-5
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55
"x": [
66
"A",
77
"B",
8-
"C"
8+
"C",
9+
"D"
910
],
1011
"y": [
1112
0,
1213
null,
14+
0.001,
1315
1
1416
],
1517
"text": [
1618
0,
1719
null,
20+
0.001,
1821
1
1922
],
2023
"textposition": "auto",
@@ -26,16 +29,19 @@
2629
"x": [
2730
"A",
2831
"B",
29-
"C"
32+
"C",
33+
"D"
3034
],
3135
"y": [
3236
0,
3337
null,
38+
0.001,
3439
1
3540
],
3641
"text": [
3742
0,
3843
null,
44+
0.001,
3945
1
4046
],
4147
"textposition": "auto",
@@ -50,16 +56,19 @@
5056
"x": [
5157
0,
5258
null,
59+
0.001,
5360
1
5461
],
5562
"y": [
5663
"A",
5764
"B",
58-
"C"
65+
"C",
66+
"D"
5967
],
6068
"text": [
6169
0,
6270
null,
71+
0.001,
6372
1
6473
],
6574
"textposition": "auto",
@@ -74,16 +83,19 @@
7483
"x": [
7584
0,
7685
null,
86+
0.001,
7787
1
7888
],
7989
"y": [
8090
"A",
8191
"B",
82-
"C"
92+
"C",
93+
"D"
8394
],
8495
"text": [
8596
0,
8697
null,
98+
0.001,
8799
1
88100
],
89101
"textposition": "auto",
@@ -94,7 +106,7 @@
94106
}
95107
],
96108
"layout": {
97-
"showlegend": true,
109+
"showlegend": false,
98110
"width": 800,
99111
"height": 800,
100112
"dragmode": "pan",

test/jasmine/tests/bar_test.js

+22-5
Original file line numberDiff line numberDiff line change
@@ -2041,19 +2041,36 @@ describe('A bar plot', function() {
20412041
dy -= +pos[2];
20422042
dx -= +pos[3];
20432043

2044-
return dx * dy;
2044+
return Math.abs(dx * dy);
20452045
}
20462046

20472047
Plotly.plot(gd, mock)
20482048
.then(function() {
20492049
var nodes = gd.querySelectorAll('g.point > path');
2050-
expect(nodes.length).toBe(12, '# of bars');
2050+
expect(nodes.length).toBe(16, '# of bars');
20512051

20522052
[
2053-
0, 1, 3, 4, 6, 7, 9, 10
2054-
].forEach(function(i) {
2053+
[0, false],
2054+
[1, false],
2055+
[2, true],
2056+
[3, true],
2057+
[4, false],
2058+
[5, false],
2059+
[6, true],
2060+
[7, true],
2061+
[8, false],
2062+
[9, false],
2063+
[10, true],
2064+
[11, true],
2065+
[12, false],
2066+
[13, false],
2067+
[14, true],
2068+
[15, true]
2069+
].forEach(function(e) {
2070+
var i = e[0];
20552071
var d = nodes[i].getAttribute('d');
2056-
expect(getArea(d)).toBe(0, 'item:' + i);
2072+
var visible = e[1];
2073+
expect(getArea(d) > 0).toBe(visible, 'item:' + i);
20572074
});
20582075
})
20592076
.catch(failTest)

0 commit comments

Comments
 (0)