Skip to content

Commit fbaf868

Browse files
committed
fixup jasmine tests
1 parent 648c3c9 commit fbaf868

6 files changed

+41
-52
lines changed

test/jasmine/tests/cartesian_interact_test.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,9 +2475,10 @@ describe('Cartesian plots with css transforms', function() {
24752475
});
24762476
}
24772477

2478-
transformPlot(gd, transform);
24792478
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
24802479
.then(function() {
2480+
transformPlot(gd, transform);
2481+
24812482
gd.on('plotly_hover', function(d) {
24822483
eventRecordings[d.points[0].x] = 1;
24832484
});
@@ -2520,8 +2521,11 @@ describe('Cartesian plots with css transforms', function() {
25202521
var end = [150, 150];
25212522

25222523
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
2523-
.then(function() { transformPlot(gd, transform); })
2524-
.then(function() {_drag(start, end); })
2524+
.then(function() {
2525+
transformPlot(gd, transform);
2526+
2527+
_drag(start, end);
2528+
})
25252529
.then(function() {
25262530
_assertTransformedZoombox(start, end);
25272531
})
@@ -2547,9 +2551,10 @@ describe('Cartesian plots with css transforms', function() {
25472551
var start = [10, 10];
25482552
var end = [200, 200];
25492553

2550-
transformPlot(gd, transform);
25512554
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
25522555
.then(function() {
2556+
transformPlot(gd, transform);
2557+
25532558
return Plotly.relayout(gd, 'dragmode', 'select');
25542559
})
25552560
.then(function() {

test/jasmine/tests/choropleth_test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ describe('Test choropleth hover:', function() {
182182
scale = 0.5;
183183
transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
184184
}
185-
})
186-
.then(function() {
185+
187186
mouseEvent('mousemove', scale * pos[0], scale * pos[1]);
188187
assertHoverLabelContent({
189188
nums: content[0],

test/jasmine/tests/choroplethmapbox_test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ describe('@noCI Test choroplethmapbox hover:', function() {
538538
var scale = 1;
539539
if(hasCssTransform) {
540540
scale = 0.5;
541-
transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
542541
}
543542

544543
var fig = Lib.extendDeep({},
@@ -556,6 +555,8 @@ describe('@noCI Test choroplethmapbox hover:', function() {
556555
var pos = s.pos || [270, 220];
557556

558557
return Plotly.plot(gd, fig).then(function() {
558+
if(hasCssTransform) transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
559+
559560
var to = setTimeout(function() {
560561
failTest('no event data received');
561562
done();

test/jasmine/tests/polar_test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,9 +1746,10 @@ describe('Polar plots with css transforms', function() {
17461746
it('hover behaves correctly after css transform: ' + transform, function(done) {
17471747
var hoverEvents = {};
17481748

1749-
transformPlot(gd, transform);
17501749
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
17511750
.then(function() {
1751+
transformPlot(gd, transform);
1752+
17521753
gd.on('plotly_hover', function(d) {
17531754
hoverEvents[d.points[0].pointIndex] = true;
17541755
});
@@ -1765,10 +1766,11 @@ describe('Polar plots with css transforms', function() {
17651766
});
17661767

17671768
it('drag-zoom behaves correctly after css transform: ' + transform, function(done) {
1768-
transformPlot(gd, transform);
17691769
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
17701770

17711771
.then(function() {
1772+
transformPlot(gd, transform);
1773+
17721774
return _drag([10, 10], [50, 50]);
17731775
})
17741776
.then(function() {
@@ -1789,9 +1791,10 @@ describe('Polar plots with css transforms', function() {
17891791
}
17901792
}
17911793

1792-
transformPlot(gd, transform);
17931794
Plotly.newPlot(gd, Lib.extendDeep({}, mock))
17941795
.then(function() {
1796+
transformPlot(gd, transform);
1797+
17951798
return Plotly.relayout(gd, 'dragmode', 'select');
17961799
})
17971800
.then(function() { return _drag([30, 30], [130, 130]); })

test/jasmine/tests/scattermapbox_test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,9 @@ describe('@noCI Test plotly events on a scattermapbox plot when css transform is
10991099
mockCopy.layout.width = 800;
11001100
mockCopy.layout.height = 500;
11011101

1102-
transformPlot(gd, 'translate(-25%, -25%) scale(0.5)');
1103-
Plotly.plot(gd, mockCopy).then(done);
1102+
Plotly.plot(gd, mockCopy)
1103+
.then(function() { transformPlot(gd, 'translate(-25%, -25%) scale(0.5)'); })
1104+
.then(done);
11041105
});
11051106

11061107
afterEach(destroyGraphDiv);

test/jasmine/tests/select_test.js

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,8 +1897,7 @@ describe('Test select box and lasso per trace:', function() {
18971897
Plotly.plot(gd, fig)
18981898
.then(function() {
18991899
if(hasCssTransform) transformPlot(gd, cssTransform);
1900-
})
1901-
.then(function() {
1900+
19021901
return _run(hasCssTransform,
19031902
[[400, 200], [445, 235]],
19041903
function() {
@@ -1956,8 +1955,7 @@ describe('Test select box and lasso per trace:', function() {
19561955
Plotly.plot(gd, fig)
19571956
.then(function() {
19581957
if(hasCssTransform) transformPlot(gd, cssTransform);
1959-
})
1960-
.then(function() {
1958+
19611959
return _run(hasCssTransform,
19621960
[[300, 200], [400, 250]],
19631961
function() {
@@ -2006,8 +2004,7 @@ describe('Test select box and lasso per trace:', function() {
20062004
Plotly.plot(gd, fig)
20072005
.then(function() {
20082006
if(hasCssTransform) transformPlot(gd, cssTransform);
2009-
})
2010-
.then(function() {
2007+
20112008
return _run(hasCssTransform,
20122009
[[370, 120], [500, 200]],
20132010
function() {
@@ -2068,8 +2065,7 @@ describe('Test select box and lasso per trace:', function() {
20682065
Plotly.plot(gd, fig)
20692066
.then(function() {
20702067
if(hasCssTransform) transformPlot(gd, cssTransform);
2071-
})
2072-
.then(function() {
2068+
20732069
return _run(hasCssTransform,
20742070
[[150, 150], [300, 300]],
20752071
function() {
@@ -2143,8 +2139,7 @@ describe('Test select box and lasso per trace:', function() {
21432139
Plotly.plot(gd, fig)
21442140
.then(function() {
21452141
if(hasCssTransform) transformPlot(gd, cssTransform);
2146-
})
2147-
.then(function() {
2142+
21482143
return _run(hasCssTransform,
21492144
[[350, 200], [450, 400]],
21502145
function() {
@@ -2219,8 +2214,7 @@ describe('Test select box and lasso per trace:', function() {
22192214
Plotly.plot(gd, fig)
22202215
.then(function() {
22212216
if(hasCssTransform) transformPlot(gd, cssTransform);
2222-
})
2223-
.then(function() {
2217+
22242218
return _run(hasCssTransform,
22252219
[[150, 150], [350, 250]],
22262220
function() {
@@ -2265,8 +2259,7 @@ describe('Test select box and lasso per trace:', function() {
22652259
Plotly.plot(gd, fig)
22662260
.then(function() {
22672261
if(hasCssTransform) transformPlot(gd, cssTransform);
2268-
})
2269-
.then(function() {
2262+
22702263
return _run(hasCssTransform,
22712264
[[150, 150], [250, 250]],
22722265
function() {
@@ -2336,8 +2329,7 @@ describe('Test select box and lasso per trace:', function() {
23362329
Plotly.plot(gd, fig)
23372330
.then(function() {
23382331
if(hasCssTransform) transformPlot(gd, cssTransform);
2339-
})
2340-
.then(function() {
2332+
23412333
return _run(hasCssTransform,
23422334
[[350, 200], [400, 250]],
23432335
function() {
@@ -2394,8 +2386,7 @@ describe('Test select box and lasso per trace:', function() {
23942386
Plotly.plot(gd, fig)
23952387
.then(function() {
23962388
if(hasCssTransform) transformPlot(gd, cssTransform);
2397-
})
2398-
.then(function() {
2389+
23992390
return _run(hasCssTransform,
24002391
[[400, 300], [200, 400], [400, 500], [600, 400], [500, 350]],
24012392
function() {
@@ -2457,8 +2448,7 @@ describe('Test select box and lasso per trace:', function() {
24572448
Plotly.plot(gd, fig)
24582449
.then(function() {
24592450
if(hasCssTransform) transformPlot(gd, cssTransform);
2460-
})
2461-
.then(function() {
2451+
24622452
return _run(hasCssTransform,
24632453
[[400, 300], [200, 400], [400, 500], [600, 400], [500, 350]],
24642454
function() {
@@ -2522,8 +2512,7 @@ describe('Test select box and lasso per trace:', function() {
25222512
Plotly.plot(gd, fig)
25232513
.then(function() {
25242514
if(hasCssTransform) transformPlot(gd, cssTransform);
2525-
})
2526-
.then(function() {
2515+
25272516
return _run(hasCssTransform,
25282517
[[350, 200], [400, 200], [400, 250], [350, 250], [350, 200]],
25292518
function() {
@@ -2631,8 +2620,7 @@ describe('Test select box and lasso per trace:', function() {
26312620
Plotly.plot(gd, fig)
26322621
.then(function() {
26332622
if(hasCssTransform) transformPlot(gd, cssTransform);
2634-
})
2635-
.then(function() {
2623+
26362624
return _run(hasCssTransform,
26372625
[[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]],
26382626
function() {
@@ -2682,8 +2670,7 @@ describe('Test select box and lasso per trace:', function() {
26822670
Plotly.plot(gd, fig)
26832671
.then(function() {
26842672
if(hasCssTransform) transformPlot(gd, cssTransform);
2685-
})
2686-
.then(function() {
2673+
26872674
return _run(hasCssTransform,
26882675
[[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]],
26892676
function() {
@@ -2740,8 +2727,7 @@ describe('Test select box and lasso per trace:', function() {
27402727
Plotly.plot(gd, fig)
27412728
.then(function() {
27422729
if(hasCssTransform) transformPlot(gd, cssTransform);
2743-
})
2744-
.then(function() {
2730+
27452731
return _run(hasCssTransform,
27462732
[[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]],
27472733
function() {
@@ -2815,8 +2801,7 @@ describe('Test select box and lasso per trace:', function() {
28152801
Plotly.plot(gd, fig)
28162802
.then(function() {
28172803
if(hasCssTransform) transformPlot(gd, cssTransform);
2818-
})
2819-
.then(function() {
2804+
28202805
return _run(hasCssTransform,
28212806
[[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]],
28222807
function() {
@@ -2860,8 +2845,7 @@ describe('Test select box and lasso per trace:', function() {
28602845
Plotly.plot(gd, fig)
28612846
.then(function() {
28622847
if(hasCssTransform) transformPlot(gd, cssTransform);
2863-
})
2864-
.then(function() {
2848+
28652849
return _run(hasCssTransform,
28662850
[[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]],
28672851
function() {
@@ -2957,8 +2941,7 @@ describe('Test select box and lasso per trace:', function() {
29572941
})
29582942
.then(function() {
29592943
if(hasCssTransform) transformPlot(gd, cssTransform);
2960-
})
2961-
.then(function() {
2944+
29622945
return _run(hasCssTransform,
29632946
[[l0, t], [l0, b], [r0, b], [r0, t], [l0, t]],
29642947
function() {
@@ -3026,8 +3009,7 @@ describe('Test select box and lasso per trace:', function() {
30263009
})
30273010
.then(function() {
30283011
if(hasCssTransform) transformPlot(gd, cssTransform);
3029-
})
3030-
.then(function() {
3012+
30313013
return _run(hasCssTransform,
30323014
[[5, 5], [395, 395]],
30333015
function() {
@@ -3078,8 +3060,7 @@ describe('Test select box and lasso per trace:', function() {
30783060
})
30793061
.then(function() {
30803062
if(hasCssTransform) transformPlot(gd, cssTransform);
3081-
})
3082-
.then(function() {
3063+
30833064
return _run(hasCssTransform,
30843065
[[10, 10], [100, 300]],
30853066
function() {
@@ -3109,8 +3090,7 @@ describe('Test select box and lasso per trace:', function() {
31093090
Plotly.plot(gd, fig)
31103091
.then(function() {
31113092
if(hasCssTransform) transformPlot(gd, cssTransform);
3112-
})
3113-
.then(function() {
3093+
31143094
// No groups initially
31153095
expect(gd._fullData[0].node.groups).toEqual([]);
31163096
})

0 commit comments

Comments
 (0)