Skip to content

Commit

Permalink
Revert "keep gradual newselection.mode in tests"
Browse files Browse the repository at this point in the history
This reverts commit 095cef0.
  • Loading branch information
archmoj committed Jul 12, 2022
1 parent 468a950 commit 22b00b3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 133 deletions.
46 changes: 14 additions & 32 deletions test/jasmine/tests/scattergl_select_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@ var delay = require('../assets/delay');
var mouseEvent = require('../assets/mouse_event');
var readPixel = require('../assets/read_pixel');

function _newPlot(gd, arg2, arg3, arg4) {
var fig;
if(Array.isArray(arg2)) {
fig = {
data: arg2,
layout: arg3,
config: arg4
};
} else fig = arg2;

if(!fig.layout) fig.layout = {};
if(!fig.layout.newselection) fig.layout.newselection = {};
fig.layout.newselection.mode = 'gradual';
// complex ouline creation are mainly tested in "gradual" mode here

return Plotly.newPlot(gd, fig);
}

function drag(gd, path) {
var len = path.length;
var el = d3Select(gd).select('rect.nsewdrag').node();
Expand Down Expand Up @@ -105,7 +87,7 @@ describe('Test gl2d lasso/select:', function() {
_mock.layout.dragmode = 'select';
gd = createGraphDiv();

_newPlot(gd, _mock)
Plotly.newPlot(gd, _mock)
.then(delay(20))
.then(function() {
expect(gd._fullLayout._plots.xy._scene.select2d).not.toBe(undefined, 'scatter2d renderer');
Expand All @@ -130,7 +112,7 @@ describe('Test gl2d lasso/select:', function() {
_mock.layout.dragmode = 'lasso';
gd = createGraphDiv();

_newPlot(gd, _mock)
Plotly.newPlot(gd, _mock)
.then(delay(20))
.then(function() {
return select(gd, lassoPath2);
Expand All @@ -153,7 +135,7 @@ describe('Test gl2d lasso/select:', function() {
_mock.layout.dragmode = 'select';
gd = createGraphDiv();

_newPlot(gd, _mock)
Plotly.newPlot(gd, _mock)
.then(delay(20))
.then(function() {
return select(gd, selectPath2);
Expand All @@ -172,7 +154,7 @@ describe('Test gl2d lasso/select:', function() {
_mock.layout.dragmode = 'lasso';
gd = createGraphDiv();

_newPlot(gd, _mock)
Plotly.newPlot(gd, _mock)
.then(delay(20))
.then(function() {
return select(gd, lassoPath);
Expand All @@ -193,7 +175,7 @@ describe('Test gl2d lasso/select:', function() {
fig.layout.width = 500;
gd = createGraphDiv();

_newPlot(gd, fig)
Plotly.newPlot(gd, fig)
.then(delay(20))
.then(function() { return select(gd, [[100, 100], [250, 250]]); })
.then(function(eventData) {
Expand Down Expand Up @@ -223,7 +205,7 @@ describe('Test gl2d lasso/select:', function() {
});
}

_newPlot(gd, fig)
Plotly.newPlot(gd, fig)
.then(delay(20))
.then(function() {
_assertGlTextOpts('base', {
Expand Down Expand Up @@ -305,7 +287,7 @@ describe('Test gl2d lasso/select:', function() {
});
}

_newPlot(gd, fig)
Plotly.newPlot(gd, fig)
.then(delay(20))
.then(function() {
_assertGlTextOpts('base', {
Expand Down Expand Up @@ -388,7 +370,7 @@ describe('Test gl2d lasso/select:', function() {
var scatterEventData = {};
var selectPath = [[150, 150], [250, 250]];

_newPlot(gd, _mock)
Plotly.newPlot(gd, _mock)
.then(delay(20))
.then(function() {
expect(gd._fullLayout[ax + 'axis'].type).toEqual(test[0]);
Expand Down Expand Up @@ -446,7 +428,7 @@ describe('Test displayed selections:', function() {

function readFocus() { return _read('.gl-canvas-focus'); }

_newPlot(gd, [{
Plotly.newPlot(gd, [{
type: 'scattergl',
mode: 'markers',
y: [2, 1, 2]
Expand Down Expand Up @@ -506,7 +488,7 @@ describe('Test displayed selections:', function() {
}
};

_newPlot(gd, mock)
Plotly.newPlot(gd, mock)
.then(select(gd, [[160, 100], [180, 100]]))
.then(function() {
expect(readPixel(gd.querySelector('.gl-canvas-context'), 168, 100)[3]).toBe(0);
Expand Down Expand Up @@ -551,7 +533,7 @@ describe('Test displayed selections:', function() {
}
};

_newPlot(gd, mock)
Plotly.newPlot(gd, mock)
.then(select(gd, [[160, 100], [180, 100]]))
.then(function() {
expect(readPixel(gd.querySelector('.gl-canvas-context'), 168, 100)[3]).toBe(0);
Expand Down Expand Up @@ -640,7 +622,7 @@ describe('Test selections during funky scenarios', function() {
it('@gl should behave correctly when doubleclick before selecting anything', function(done) {
gd = createGraphDiv();

_newPlot(gd, [{
Plotly.newPlot(gd, [{
type: 'scattergl',
mode: 'markers',
y: [1, 2, 1],
Expand Down Expand Up @@ -696,7 +678,7 @@ describe('Test selections during funky scenarios', function() {
tracker = [];
}

_newPlot(gd, [{
Plotly.newPlot(gd, [{
type: 'scattergl',
mode: 'markers',
y: [1, 2, 1],
Expand Down Expand Up @@ -748,7 +730,7 @@ describe('Test selections during funky scenarios', function() {

var scene, scene2;

_newPlot(gd, [{
Plotly.newPlot(gd, [{
x: [1, 2, 3],
y: [40, 50, 60],
type: 'scattergl',
Expand Down

0 comments on commit 22b00b3

Please sign in to comment.