Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1aa49ff

Browse files
committed
set dragmode via relayout()
1 parent 92ae900 commit 1aa49ff

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

test/jasmine/tests/polar_test.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,6 @@ describe('Test polar interactions:', function() {
11501150
it('should not respond to drag interactions on plot area when dragmode === false', function(done) {
11511151
var fig = Lib.extendDeep({}, require('@mocks/polar_scatter.json'));
11521152

1153-
fig.layout.dragmode = false;
1154-
11551153
// to avoid dragging on hover labels
11561154
fig.layout.hovermode = false;
11571155

@@ -1188,6 +1186,7 @@ describe('Test polar interactions:', function() {
11881186

11891187
_plot(fig)
11901188
.then(_assertBase)
1189+
.then(function() { return Plotly.relayout(gd, 'dragmode', false); })
11911190
.then(function() { return _drag(mid, [50, 50]); })
11921191
.then(function() {
11931192
_assertBase('from center move toward bottom-right');
@@ -1228,7 +1227,7 @@ describe('Test polar interactions:', function() {
12281227
.then(function() { _assertBase('from right edge to not far enough'); })
12291228
.then(function() {
12301229
expect(eventCnts.plotly_relayout)
1231-
.toBe(0, 'no new relayout events after *not far enough* cases');
1230+
.toBe(1, 'no new relayout events after *not far enough* cases');
12321231
})
12331232
.then(delay(20))
12341233
.then(function() { return _doubleClick(mid); })
@@ -1245,8 +1244,6 @@ describe('Test polar interactions:', function() {
12451244
it('should not respond to drag interactions on radial drag area when dragmode === false', function(done) {
12461245
var fig = Lib.extendDeep({}, require('@mocks/polar_scatter.json'));
12471246

1248-
fig.layout.dragmode = false;
1249-
12501247
// to avoid dragging on hover labels
12511248
fig.layout.hovermode = false;
12521249

@@ -1301,6 +1298,7 @@ describe('Test polar interactions:', function() {
13011298

13021299
_plot(fig)
13031300
.then(_assertBase)
1301+
.then(function() { return Plotly.relayout(gd, 'dragmode', false); })
13041302
.then(function() { return _drag(dragPos0, [-50, 0]); })
13051303
.then(function() {
13061304
_assertBase('move inward');
@@ -1322,14 +1320,13 @@ describe('Test polar interactions:', function() {
13221320
})
13231321
.then(_reset)
13241322
.then(function() {
1325-
expect(eventCnts.plotly_relayout).toBe(0, 'total # of relayout events');
1323+
expect(eventCnts.plotly_relayout).toBe(1, 'total # of relayout events');
13261324
})
13271325
.then(done, done.fail);
13281326
});
13291327

13301328
it('should not respond to drag interactions on inner radial drag area when dragmode === false', function(done) {
13311329
var fig = Lib.extendDeep({}, require('@mocks/polar_scatter.json'));
1332-
fig.layout.dragmode = false;
13331330
fig.layout.polar.hole = 0.2;
13341331
// to avoid dragging on hover labels
13351332
fig.layout.hovermode = false;
@@ -1359,6 +1356,8 @@ describe('Test polar interactions:', function() {
13591356
}
13601357

13611358
_plot(fig)
1359+
.then(_assertBase)
1360+
.then(function() { return Plotly.relayout(gd, 'dragmode', false); })
13621361
.then(function() { return _drag(dragPos0, [-50, 0]); })
13631362
.then(function() {
13641363
_assertBase('move inward');
@@ -1374,8 +1373,6 @@ describe('Test polar interactions:', function() {
13741373
it('should not respond to drag interactions on angular drag area when dragmode === false', function(done) {
13751374
var fig = Lib.extendDeep({}, require('@mocks/polar_scatter.json'));
13761375

1377-
fig.layout.dragmode = false;
1378-
13791376
// to avoid dragging on hover labels
13801377
fig.layout.hovermode = false;
13811378

@@ -1421,6 +1418,7 @@ describe('Test polar interactions:', function() {
14211418

14221419
_plot(fig)
14231420
.then(_assertBase)
1421+
.then(function() { return Plotly.relayout(gd, 'dragmode', false); })
14241422
.then(function() { return _drag(dragPos0, [-20, -20]); })
14251423
.then(function() {
14261424
_assertBase('move counterclockwise');
@@ -1432,7 +1430,7 @@ describe('Test polar interactions:', function() {
14321430
})
14331431
.then(_reset)
14341432
.then(function() {
1435-
expect(eventCnts.plotly_relayout).toBe(0, 'total # of relayout events');
1433+
expect(eventCnts.plotly_relayout).toBe(1, 'total # of relayout events');
14361434
})
14371435
.then(done, done.fail);
14381436
});

0 commit comments

Comments
 (0)