Skip to content

Commit 7679483

Browse files
committed
update jasmine test of annotation visibility & autorange
1 parent 4a0a866 commit 7679483

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/jasmine/tests/annotations_test.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,24 @@ describe('annotations autosize', function() {
151151
// xaxis2 need a bit more tolerance to pass on CI
152152
// this most likely due to the different text bounding box values
153153
// on headfull vs headless browsers.
154-
var PREC2 = 0.1;
154+
// but also because it's a date axis that we've converted to ms
155+
var PRECX2 = -10;
156+
// yaxis2 needs a bit more now too...
157+
var PRECY2 = 0.2;
158+
var dateAx = fullLayout.xaxis2;
155159

156160
expect(fullLayout.xaxis.range).toBeCloseToArray(x, PREC, '- xaxis');
157161
expect(fullLayout.yaxis.range).toBeCloseToArray(y, PREC, '- yaxis');
158-
expect(fullLayout.xaxis2.range).toBeCloseToArray(x2, PREC2, 'xaxis2');
159-
expect(fullLayout.yaxis2.range).toBeCloseToArray(y2, PREC, 'yaxis2');
162+
expect(dateAx.range.map(dateAx.r2l)).toBeCloseToArray(x2.map(dateAx.r2l), PRECX2, 'xaxis2 ' + dateAx.range);
163+
expect(fullLayout.yaxis2.range).toBeCloseToArray(y2, PRECY2, 'yaxis2');
160164
expect(fullLayout.xaxis3.range).toBeCloseToArray(x3, PREC, 'xaxis3');
161165
expect(fullLayout.yaxis3.range).toBeCloseToArray(y3, PREC, 'yaxis3');
162166
}
163167

164168
Plotly.plot(gd, mock).then(function() {
165169
assertRanges(
166170
[0.97, 2.03], [0.97, 2.03],
167-
[-0.32, 3.38], [0.42, 2.58],
171+
['2000-10-01 08:23:18.0583', '2001-06-05 19:20:23.301'], [-0.245, 4.245],
168172
[0.9, 2.1], [0.86, 2.14]
169173
);
170174

@@ -177,7 +181,7 @@ describe('annotations autosize', function() {
177181
.then(function() {
178182
assertRanges(
179183
[1.44, 2.02], [0.97, 2.03],
180-
[1.31, 2.41], [0.42, 2.58],
184+
['2001-01-18 15:06:04.0449', '2001-03-27 14:01:20.8989'], [-0.245, 4.245],
181185
[1.44, 2.1], [0.86, 2.14]
182186
);
183187

@@ -190,7 +194,7 @@ describe('annotations autosize', function() {
190194
.then(function() {
191195
assertRanges(
192196
[1.44, 2.02], [0.99, 1.52],
193-
[0.5, 2.5], [0.42, 2.58],
197+
['2001-01-31 23:59:59.999', '2001-02-01 00:00:00.001'], [-0.245, 4.245],
194198
[0.5, 2.5], [0.86, 2.14]
195199
);
196200

@@ -206,7 +210,7 @@ describe('annotations autosize', function() {
206210
.then(function() {
207211
assertRanges(
208212
[0.97, 2.03], [0.97, 2.03],
209-
[-0.32, 3.38], [0.42, 2.58],
213+
['2000-10-01 08:23:18.0583', '2001-06-05 19:20:23.301'], [-0.245, 4.245],
210214
[0.9, 2.1], [0.86, 2.14]
211215
);
212216
})

0 commit comments

Comments
 (0)