@@ -11,24 +11,6 @@ var delay = require('../assets/delay');
11
11
var mouseEvent = require ( '../assets/mouse_event' ) ;
12
12
var readPixel = require ( '../assets/read_pixel' ) ;
13
13
14
- function _newPlot ( gd , arg2 , arg3 , arg4 ) {
15
- var fig ;
16
- if ( Array . isArray ( arg2 ) ) {
17
- fig = {
18
- data : arg2 ,
19
- layout : arg3 ,
20
- config : arg4
21
- } ;
22
- } else fig = arg2 ;
23
-
24
- if ( ! fig . layout ) fig . layout = { } ;
25
- if ( ! fig . layout . newselection ) fig . layout . newselection = { } ;
26
- fig . layout . newselection . mode = 'gradual' ;
27
- // complex ouline creation are mainly tested in "gradual" mode here
28
-
29
- return Plotly . newPlot ( gd , fig ) ;
30
- }
31
-
32
14
function drag ( gd , path ) {
33
15
var len = path . length ;
34
16
var el = d3Select ( gd ) . select ( 'rect.nsewdrag' ) . node ( ) ;
@@ -105,7 +87,7 @@ describe('Test gl2d lasso/select:', function() {
105
87
_mock . layout . dragmode = 'select' ;
106
88
gd = createGraphDiv ( ) ;
107
89
108
- _newPlot ( gd , _mock )
90
+ Plotly . newPlot ( gd , _mock )
109
91
. then ( delay ( 20 ) )
110
92
. then ( function ( ) {
111
93
expect ( gd . _fullLayout . _plots . xy . _scene . select2d ) . not . toBe ( undefined , 'scatter2d renderer' ) ;
@@ -130,7 +112,7 @@ describe('Test gl2d lasso/select:', function() {
130
112
_mock . layout . dragmode = 'lasso' ;
131
113
gd = createGraphDiv ( ) ;
132
114
133
- _newPlot ( gd , _mock )
115
+ Plotly . newPlot ( gd , _mock )
134
116
. then ( delay ( 20 ) )
135
117
. then ( function ( ) {
136
118
return select ( gd , lassoPath2 ) ;
@@ -153,7 +135,7 @@ describe('Test gl2d lasso/select:', function() {
153
135
_mock . layout . dragmode = 'select' ;
154
136
gd = createGraphDiv ( ) ;
155
137
156
- _newPlot ( gd , _mock )
138
+ Plotly . newPlot ( gd , _mock )
157
139
. then ( delay ( 20 ) )
158
140
. then ( function ( ) {
159
141
return select ( gd , selectPath2 ) ;
@@ -172,7 +154,7 @@ describe('Test gl2d lasso/select:', function() {
172
154
_mock . layout . dragmode = 'lasso' ;
173
155
gd = createGraphDiv ( ) ;
174
156
175
- _newPlot ( gd , _mock )
157
+ Plotly . newPlot ( gd , _mock )
176
158
. then ( delay ( 20 ) )
177
159
. then ( function ( ) {
178
160
return select ( gd , lassoPath ) ;
@@ -193,7 +175,7 @@ describe('Test gl2d lasso/select:', function() {
193
175
fig . layout . width = 500 ;
194
176
gd = createGraphDiv ( ) ;
195
177
196
- _newPlot ( gd , fig )
178
+ Plotly . newPlot ( gd , fig )
197
179
. then ( delay ( 20 ) )
198
180
. then ( function ( ) { return select ( gd , [ [ 100 , 100 ] , [ 250 , 250 ] ] ) ; } )
199
181
. then ( function ( eventData ) {
@@ -223,7 +205,7 @@ describe('Test gl2d lasso/select:', function() {
223
205
} ) ;
224
206
}
225
207
226
- _newPlot ( gd , fig )
208
+ Plotly . newPlot ( gd , fig )
227
209
. then ( delay ( 20 ) )
228
210
. then ( function ( ) {
229
211
_assertGlTextOpts ( 'base' , {
@@ -305,7 +287,7 @@ describe('Test gl2d lasso/select:', function() {
305
287
} ) ;
306
288
}
307
289
308
- _newPlot ( gd , fig )
290
+ Plotly . newPlot ( gd , fig )
309
291
. then ( delay ( 20 ) )
310
292
. then ( function ( ) {
311
293
_assertGlTextOpts ( 'base' , {
@@ -388,7 +370,7 @@ describe('Test gl2d lasso/select:', function() {
388
370
var scatterEventData = { } ;
389
371
var selectPath = [ [ 150 , 150 ] , [ 250 , 250 ] ] ;
390
372
391
- _newPlot ( gd , _mock )
373
+ Plotly . newPlot ( gd , _mock )
392
374
. then ( delay ( 20 ) )
393
375
. then ( function ( ) {
394
376
expect ( gd . _fullLayout [ ax + 'axis' ] . type ) . toEqual ( test [ 0 ] ) ;
@@ -446,7 +428,7 @@ describe('Test displayed selections:', function() {
446
428
447
429
function readFocus ( ) { return _read ( '.gl-canvas-focus' ) ; }
448
430
449
- _newPlot ( gd , [ {
431
+ Plotly . newPlot ( gd , [ {
450
432
type : 'scattergl' ,
451
433
mode : 'markers' ,
452
434
y : [ 2 , 1 , 2 ]
@@ -506,7 +488,7 @@ describe('Test displayed selections:', function() {
506
488
}
507
489
} ;
508
490
509
- _newPlot ( gd , mock )
491
+ Plotly . newPlot ( gd , mock )
510
492
. then ( select ( gd , [ [ 160 , 100 ] , [ 180 , 100 ] ] ) )
511
493
. then ( function ( ) {
512
494
expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 168 , 100 ) [ 3 ] ) . toBe ( 0 ) ;
@@ -551,7 +533,7 @@ describe('Test displayed selections:', function() {
551
533
}
552
534
} ;
553
535
554
- _newPlot ( gd , mock )
536
+ Plotly . newPlot ( gd , mock )
555
537
. then ( select ( gd , [ [ 160 , 100 ] , [ 180 , 100 ] ] ) )
556
538
. then ( function ( ) {
557
539
expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 168 , 100 ) [ 3 ] ) . toBe ( 0 ) ;
@@ -640,7 +622,7 @@ describe('Test selections during funky scenarios', function() {
640
622
it ( '@gl should behave correctly when doubleclick before selecting anything' , function ( done ) {
641
623
gd = createGraphDiv ( ) ;
642
624
643
- _newPlot ( gd , [ {
625
+ Plotly . newPlot ( gd , [ {
644
626
type : 'scattergl' ,
645
627
mode : 'markers' ,
646
628
y : [ 1 , 2 , 1 ] ,
@@ -696,7 +678,7 @@ describe('Test selections during funky scenarios', function() {
696
678
tracker = [ ] ;
697
679
}
698
680
699
- _newPlot ( gd , [ {
681
+ Plotly . newPlot ( gd , [ {
700
682
type : 'scattergl' ,
701
683
mode : 'markers' ,
702
684
y : [ 1 , 2 , 1 ] ,
@@ -748,7 +730,7 @@ describe('Test selections during funky scenarios', function() {
748
730
749
731
var scene , scene2 ;
750
732
751
- _newPlot ( gd , [ {
733
+ Plotly . newPlot ( gd , [ {
752
734
x : [ 1 , 2 , 3 ] ,
753
735
y : [ 40 , 50 , 60 ] ,
754
736
type : 'scattergl' ,
0 commit comments