Skip to content

Commit 0949c23

Browse files
committed
Update/refactor tests for new CI
1 parent fbf9a2b commit 0949c23

5 files changed

Lines changed: 38 additions & 29 deletions

File tree

test/jasmine/tests/axes_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,13 +1722,13 @@ describe('Test axes', function() {
17221722
width: 600,
17231723
height: 600
17241724
}).then(function() {
1725-
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.110, 2]);
1725+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.12, 2]);
17261726

17271727
return Plotly.relayout(gd, {
17281728
'xaxis.insiderange': [1, 3]
17291729
});
17301730
}).then(function() {
1731-
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0.889, 3]);
1731+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0.879, 3]);
17321732
}).then(done, done.fail);
17331733
});
17341734
});
@@ -8152,11 +8152,11 @@ describe('more react tests', function() {
81528152

81538153
Plotly.newPlot(gd, fig1)
81548154
.then(function() {
8155-
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.110, 2]);
8155+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.12, 2]);
81568156

81578157
return Plotly.react(gd, fig2);
81588158
}).then(function() {
8159-
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.164, 2]);
8159+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.173, 2]);
81608160
}).then(done, done.fail);
81618161
});
81628162
});

test/jasmine/tests/geo_test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ describe('Test geo interactions', function() {
14041404
py -= 2;
14051405
mouseEvent('mousemove', px, py);
14061406

1407-
if(py > 175) {
1407+
if(py > 176) {
14081408
_assert('- py ' + py, 1);
14091409
expect(cnt).toBe(0, 'no plotly_unhover event so far');
14101410
} else {
@@ -2608,15 +2608,15 @@ describe('Test geo zoom/pan/drag interactions:', function() {
26082608
_assert('base', [
26092609
[-96.6, 38.7], 1,
26102610
], [
2611-
[410, 329], 738.5
2611+
[410, 309], 738.5
26122612
], undefined);
26132613
return drag({path: [[250, 250], [200, 200]], noCover: true});
26142614
})
26152615
.then(function() {
26162616
_assert('after NW-SE drag', [
26172617
[-91.8, 34.8], 1,
26182618
], [
2619-
[366, 279], 738.5
2619+
[366, 259], 738.5
26202620
], [
26212621
'geo.center.lon', 'geo.center.lon'
26222622
]);
@@ -2626,7 +2626,7 @@ describe('Test geo zoom/pan/drag interactions:', function() {
26262626
_assert('after scroll', [
26272627
[-94.5, 35.0], 1.3
26282628
], [
2629-
[380, 273], 974.4
2629+
[380, 245.9], 974.4
26302630
], [
26312631
'geo.center.lon', 'geo.center.lon', 'geo.projection.scale'
26322632
]);
@@ -2637,7 +2637,7 @@ describe('Test geo zoom/pan/drag interactions:', function() {
26372637
[-94.5, 35.0], 1.3
26382638
], [
26392639
// new center values are reflected in translate()
2640-
[380, 273], 974.4
2640+
[380, 245.9], 974.4
26412641
], [
26422642
'geo.showlakes'
26432643
]);
@@ -2647,7 +2647,7 @@ describe('Test geo zoom/pan/drag interactions:', function() {
26472647
_assert('after double click', [
26482648
[-96.6, 38.7], 1,
26492649
], [
2650-
[416, 329], 738.5
2650+
[416, 309], 738.5
26512651
], 'dblclick');
26522652
})
26532653
.then(done, done.fail);
@@ -2759,10 +2759,10 @@ describe('Test geo interactions update marker angles:', function() {
27592759
})
27602760
.then(function() {
27612761
newPath = getPath();
2762-
expect(newPath).toEqual('M0,0L18.224184922503092,8.238876374264322L19.586365339190138,-4.046516131164082Z');
2762+
expect(newPath).toEqual('M0,0L18.27769005891461,8.119485581627321L19.559475756661865,-4.174554841483899Z');
27632763

27642764
expect(newPath).not.toEqual(initialPath);
2765-
expect(newPath).toEqual('M0,0L18.224184922503092,8.238876374264322L19.586365339190138,-4.046516131164082Z');
2765+
expect(newPath).toEqual('M0,0L18.27769005891461,8.119485581627321L19.559475756661865,-4.174554841483899Z');
27662766
expect(initialPath).toEqual('M0,0L-1.5094067529528923,19.942960945008643L10.501042615957648,17.021401351764233Z');
27672767
})
27682768
.then(done, done.fail);

test/jasmine/tests/sankey_test.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,10 +1144,17 @@ describe('sankey tests', function() {
11441144

11451145
return function(elType) {
11461146
return new Promise(function(resolve, reject) {
1147-
gd.once(eventType, function(d) {
1147+
const handler = (d) => {
11481148
Lib.clearThrottle();
1149+
const isNode = d.points[0].hasOwnProperty('sourceLinks');
1150+
const isExpectedType = (elType === 'node') ? isNode : !isNode;
1151+
if (!isExpectedType) {
1152+
gd.once(eventType, handler);
1153+
return;
1154+
}
11491155
resolve(d);
1150-
});
1156+
}
1157+
gd.once(eventType, handler);
11511158

11521159
mouseFn(posByElementType[elType]);
11531160
setTimeout(function() {
@@ -1460,8 +1467,8 @@ describe('sankey tests', function() {
14601467
nodes = document.getElementsByClassName('sankey-node');
14611468
node = Array.prototype.slice.call(nodes).find(function(n) { return n.textContent === '0';});
14621469
var newPosition = getNodeCoords(node);
1463-
expect(newPosition.x).toBeCloseTo(positionAfterDrag[0], 2, 'final x position is off');
1464-
expect(newPosition.y).toBeCloseTo(positionAfterDrag[1], 2, 'final y position is off');
1470+
expect(newPosition.x).toBeCloseTo(positionAfterDrag[0], -1, 'final x position is off');
1471+
expect(newPosition.y).toBeCloseTo(positionAfterDrag[1], -1, 'final y position is off');
14651472

14661473
// Change color of nodes
14671474
var mockCopy = Lib.extendDeep({}, mockCircularFreeform);
@@ -1485,8 +1492,8 @@ describe('sankey tests', function() {
14851492
pos = positionBeforeDrag;
14861493
msg = 'should go back to its default because uirevision changed';
14871494
}
1488-
expect(newPosition.x).toBeCloseTo(pos[0], 2, 'x position ' + msg);
1489-
expect(newPosition.y).toBeCloseTo(pos[1], 2, 'y position ' + msg);
1495+
expect(newPosition.x).toBeCloseTo(pos[0], -1, 'x position ' + msg);
1496+
expect(newPosition.y).toBeCloseTo(pos[1], -1, 'y position ' + msg);
14901497
})
14911498
.then(done, done.fail);
14921499
});

test/jasmine/tests/scatter3d_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ describe('Test scatter3d interactions:', function() {
204204
}
205205

206206
Plotly.newPlot(gd, _mock)
207-
.then(delay(20))
208207
.then(function() {
209208
assertObjects(order0);
210209

test/jasmine/tests/select_test.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ describe('Test select box and lasso per trace:', function() {
22992299
[[150, 150], [300, 300]],
23002300
function() {
23012301
assertPoints([['NY', 10]]);
2302-
assertRanges([[-83.38, 46.13], [-74.06, 39.29]]);
2302+
assertRanges([[-83.35, 46.13], [-74.03, 39.29]]);
23032303
assertSelectedPoints({0: [0]});
23042304
},
23052305
null, BOXEVENTS, 'choroplethmap select'
@@ -2315,8 +2315,8 @@ describe('Test select box and lasso per trace:', function() {
23152315
assertPoints([['MA', 20]]);
23162316
assertSelectedPoints({0: [1]});
23172317
assertLassoPoints([
2318-
[-74.06, 43.936], [-74.06, 39.293], [-67.84, 39.293],
2319-
[-67.84, 43.936], [-74.06, 43.936]
2318+
[-74.03, 43.936], [-74.03, 39.293], [-67.81, 39.293],
2319+
[-67.81, 43.936], [-74.03, 43.936]
23202320
]);
23212321
},
23222322
null, LASSOEVENTS, 'choroplethmap lasso'
@@ -2656,12 +2656,14 @@ describe('Test select box and lasso per trace:', function() {
26562656
assertPoints([
26572657
[0, 281, 'Purchases'],
26582658
[0, 269, 'Material expenses'],
2659+
[0, 191, 'Personnel expenses'],
2660+
[0, 179, 'Other expenses'],
26592661
]);
26602662
assertSelectedPoints({
2661-
0: [5, 6]
2663+
0: [5, 6, 7, 8]
26622664
});
26632665
},
2664-
null, [3, 2, 1], 'waterfall lasso'
2666+
null, [4, 2, 1], 'waterfall lasso'
26652667
);
26662668
})
26672669
.then(function() {
@@ -2705,13 +2707,14 @@ describe('Test select box and lasso per trace:', function() {
27052707
assertPoints([
27062708
[0, 331.5, 'Author: etpinard'],
27072709
[1, 53.5, 'Pull requests'],
2710+
[1, 15.5, 'Author: etpinard'],
27082711
]);
27092712
assertSelectedPoints({
27102713
0: [2],
2711-
1: [1]
2714+
1: [1, 2]
27122715
});
27132716
},
2714-
null, [3, 2, 1], 'funnel lasso'
2717+
null, [4, 2, 1], 'funnel lasso'
27152718
);
27162719
})
27172720
.then(done, done.fail);
@@ -3336,7 +3339,7 @@ describe('Test select box and lasso per trace:', function() {
33363339
[[150, 150], [300, 300]],
33373340
function() {
33383341
assertPoints([['NY', 10]]);
3339-
assertRanges([[-83.38, 46.13], [-74.06, 39.29]]);
3342+
assertRanges([[-83.35, 46.13], [-74.03, 39.29]]);
33403343
assertSelectedPoints({0: [0], 3: []});
33413344
},
33423345
null, BOXEVENTS, 'choroplethmap select'
@@ -3352,8 +3355,8 @@ describe('Test select box and lasso per trace:', function() {
33523355
assertPoints([['MA', 20], []]);
33533356
assertSelectedPoints({0: [1], 3: [0]});
33543357
assertLassoPoints([
3355-
[-74.06, 43.936], [-74.06, 39.293], [-67.84, 39.293],
3356-
[-67.84, 43.936], [-74.06, 43.936]
3358+
[-74.03, 43.936], [-74.03, 39.293], [-67.81, 39.293],
3359+
[-67.81, 43.936], [-74.03, 43.936]
33573360
]);
33583361
},
33593362
null, LASSOEVENTS, 'choroplethmap lasso'

0 commit comments

Comments
 (0)