Skip to content

Commit a39a859

Browse files
committed
correct mesh3d, isosurface and volume hover label tests
1 parent c77ec0f commit a39a859

File tree

3 files changed

+62
-37
lines changed

3 files changed

+62
-37
lines changed

test/jasmine/tests/gl3d_hover_click_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ describe('Test gl3d trace click/hover:', function() {
466466
.then(_click)
467467
.then(delay(20))
468468
.then(function() {
469-
assertEventData(134.03, -163.59, -163.59, 0, 3);
469+
assertEventData(140.72, -96.97, -96.97, 0, 2);
470470
})
471471
.then(done);
472472
});
@@ -501,21 +501,21 @@ describe('Test gl3d trace click/hover:', function() {
501501
.then(_hover)
502502
.then(delay(20))
503503
.then(function() {
504-
assertHoverText('x: 4', 'y: 5', 'z: 3.5', 'ts: 4\nhz: 5\nftt:3.5');
504+
assertHoverText('x: 3', 'y: 4', 'z: 5', 'ts: 3\nhz: 4\nftt:5');
505505
})
506506
.then(function() {
507507
return Plotly.restyle(gd, 'hoverinfo', 'x+y');
508508
})
509509
.then(delay(20))
510510
.then(function() {
511-
assertHoverText('(4, 5)');
511+
assertHoverText('(3, 4)');
512512
})
513513
.then(function() {
514514
return Plotly.restyle(gd, 'hoverinfo', 'text');
515515
})
516516
.then(delay(20))
517517
.then(function() {
518-
assertHoverText('ts: 4\nhz: 5\nftt:3.5');
518+
assertHoverText('ts: 3\nhz: 4\nftt:5');
519519
})
520520
.then(function() {
521521
return Plotly.restyle(gd, 'text', 'yo!');
@@ -531,14 +531,14 @@ describe('Test gl3d trace click/hover:', function() {
531531
})
532532
.then(delay(20))
533533
.then(function() {
534-
assertHoverText(null, null, null, 'ts: 4\nhz: 5\nftt:3.5 !!');
534+
assertHoverText(null, null, null, 'ts: 3\nhz: 4\nftt:5 !!');
535535
})
536536
.then(function() {
537537
return Plotly.restyle(gd, 'hovertemplate', '%{x}-%{y}-%{z}<extra></extra>');
538538
})
539539
.then(delay(20))
540540
.then(function() {
541-
assertHoverText(null, null, null, '4-5-3.5');
541+
assertHoverText(null, null, null, '3-4-5');
542542
})
543543
.catch(failTest)
544544
.then(done);

test/jasmine/tests/isosurface_test.js

+43-18
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,27 @@ describe('Test isosurface', function() {
324324

325325
function _hover1() {
326326
mouseEvent('mouseover', 200, 200);
327+
return delay(20)();
327328
}
328329

329330
function _hover2() {
330331
mouseEvent('mouseover', 100, 100);
332+
return delay(20)();
333+
}
334+
335+
function _hover3() {
336+
mouseEvent('mouseover', 300, 150);
337+
return delay(20)();
338+
}
339+
340+
function _hover4() {
341+
mouseEvent('mouseover', 150, 300);
342+
return delay(20)();
331343
}
332344

333345
Plotly.plot(gd, fig)
334346
.then(delay(20))
335347
.then(_hover1)
336-
.then(delay(20))
337348
.then(function() {
338349
assertHoverLabelContent({
339350
nums: [
@@ -346,47 +357,61 @@ describe('Test isosurface', function() {
346357
})
347358
.then(delay(20))
348359
.then(_hover2)
349-
.then(delay(20))
350360
.then(function() {
351361
assertHoverLabelContent({
352362
nums: [
353-
'x: 0.4',
363+
'x: 0.3',
354364
'y: 0.001',
355-
'z: −8',
356-
'value: −1.28'
365+
'z: −16',
366+
'value: −0.27'
357367
].join('\n')
358368
});
359369
})
370+
.then(delay(20))
371+
.then(_hover3)
360372
.then(function() {
361-
return Plotly.restyle(gd, 'hovertext', [
362-
fig.data[0].value.map(function(v) { return '!! ' + v + ' !!'; })
363-
]);
373+
assertHoverLabelContent({
374+
nums: [
375+
'x: 0.2',
376+
'y: 100μ',
377+
'z: −16',
378+
'value: −1.12'
379+
].join('\n')
380+
});
364381
})
365382
.then(delay(20))
366-
.then(_hover2)
383+
.then(_hover4)
367384
.then(function() {
368385
assertHoverLabelContent({
369386
nums: [
370387
'x: 0.4',
371-
'y: 0.001',
372-
'z: −8',
373-
'value: −1.28',
374-
'!! -1.28 !!'
388+
'y: 100μ',
389+
'z: −4',
390+
'value: −1.3'
375391
].join('\n')
376392
});
377393
})
378394
.then(function() {
379-
return Plotly.restyle(gd, 'hovertemplate', '%{value}<br>(%{x},%{y},%{z})<extra>!!</extra>');
395+
return Plotly.restyle(gd, 'hovertext', [
396+
fig.data[0].value.map(function(v) { return '!! ' + v + ' !!'; })
397+
]);
380398
})
381399
.then(delay(20))
382-
.then(_hover2)
383-
.then(delay(20))
400+
.then(_hover4)
384401
.then(function() {
385402
assertHoverLabelContent({
386-
nums: '−1.28\n(0.4,0.001,−8)',
387-
name: '!!'
403+
nums: [
404+
'x: 0.4',
405+
'y: 100μ',
406+
'z: −4',
407+
'value: −1.3',
408+
'!! -1.3 !!'
409+
].join('\n')
388410
});
389411
})
412+
.then(function() {
413+
return Plotly.restyle(gd, 'hovertemplate', '%{value}<br>(%{x},%{y},%{z})<extra>!!</extra>');
414+
})
390415
.catch(failTest)
391416
.then(done);
392417
});

test/jasmine/tests/volume_test.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ describe('Test volume', function() {
351351
nums: [
352352
'x: 0.4',
353353
'y: 100μ',
354-
'z: −8',
355-
'value: −1.31'
354+
'z: −16',
355+
'value: −1.32'
356356
].join('\n')
357357
});
358358
})
@@ -361,10 +361,10 @@ describe('Test volume', function() {
361361
.then(function() {
362362
assertHoverLabelContent({
363363
nums: [
364-
'x: 0.4',
364+
'x: 0.3',
365365
'y: 0.001',
366366
'z: −16',
367-
'value: −0.32'
367+
'value: −0.27'
368368
].join('\n')
369369
});
370370
})
@@ -375,8 +375,8 @@ describe('Test volume', function() {
375375
nums: [
376376
'x: 0.3',
377377
'y: 100μ',
378-
'z: −8',
379-
'value: −1.19'
378+
'z: −16',
379+
'value: −1.2'
380380
].join('\n')
381381
});
382382
})
@@ -386,9 +386,9 @@ describe('Test volume', function() {
386386
assertHoverLabelContent({
387387
nums: [
388388
'x: 0.4',
389-
'y: 0.001',
390-
'z: −2',
391-
'value: −1.26'
389+
'y: 100μ',
390+
'z: −4',
391+
'value: −1.3'
392392
].join('\n')
393393
});
394394
})
@@ -403,10 +403,10 @@ describe('Test volume', function() {
403403
assertHoverLabelContent({
404404
nums: [
405405
'x: 0.4',
406-
'y: 0.001',
407-
'z: −2',
408-
'value: −1.26',
409-
'!! -1.26 !!'
406+
'y: 100μ',
407+
'z: −4',
408+
'value: −1.3',
409+
'!! -1.3 !!'
410410
].join('\n')
411411
});
412412
})

0 commit comments

Comments
 (0)