@@ -8,7 +8,7 @@ var ScatterGl = require('@src/traces/scattergl');
8
8
9
9
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
10
10
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
11
- var fail = require ( '../assets/fail_test' ) ;
11
+ var failTest = require ( '../assets/fail_test' ) ;
12
12
var mouseEvent = require ( '../assets/mouse_event' ) ;
13
13
var touchEvent = require ( '../assets/touch_event' ) ;
14
14
var drag = require ( '../assets/drag' ) ;
@@ -202,7 +202,7 @@ describe('@gl Test gl plot side effects', function() {
202
202
. then ( function ( ) {
203
203
expect ( gd . querySelector ( '.gl-canvas-context' ) . width ) . toBe ( 300 ) ;
204
204
} )
205
- . catch ( fail )
205
+ . catch ( failTest )
206
206
. then ( done ) ;
207
207
} ) ;
208
208
} ) ;
@@ -350,7 +350,7 @@ describe('@gl Test gl2d plots', function() {
350
350
'yaxis.range[1]' : jasmine . any ( Number )
351
351
} ) ) ;
352
352
} )
353
- . catch ( fail )
353
+ . catch ( failTest )
354
354
. then ( done ) ;
355
355
} ) ;
356
356
@@ -381,7 +381,7 @@ describe('@gl Test gl2d plots', function() {
381
381
. then ( function ( ) {
382
382
expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 108 , 100 ) [ 0 ] ) . not . toBe ( 0 ) ;
383
383
} )
384
- . catch ( fail )
384
+ . catch ( failTest )
385
385
. then ( done ) ;
386
386
} ) ;
387
387
@@ -423,7 +423,7 @@ describe('@gl Test gl2d plots', function() {
423
423
expect ( scene . error2d . draw ) . toHaveBeenCalledTimes ( 2 , 'twice for x AND y' ) ;
424
424
expect ( scene . scatter2d . draw ) . toHaveBeenCalledTimes ( 3 , 'both traces have markers' ) ;
425
425
} )
426
- . catch ( fail )
426
+ . catch ( failTest )
427
427
. then ( done ) ;
428
428
} ) ;
429
429
@@ -451,7 +451,7 @@ describe('@gl Test gl2d plots', function() {
451
451
expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 158 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
452
452
expect ( readPixel ( gd . querySelector ( '.gl-canvas-focus' ) , 168 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
453
453
} )
454
- . catch ( fail )
454
+ . catch ( failTest )
455
455
. then ( done ) ;
456
456
} ) ;
457
457
@@ -490,7 +490,7 @@ describe('@gl Test gl2d plots', function() {
490
490
expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 158 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
491
491
expect ( readPixel ( gd . querySelector ( '.gl-canvas-focus' ) , 168 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
492
492
} )
493
- . catch ( fail )
493
+ . catch ( failTest )
494
494
. then ( done ) ;
495
495
} ) ;
496
496
@@ -514,7 +514,7 @@ describe('@gl Test gl2d plots', function() {
514
514
expect ( countCanvases ( ) ) . toBe ( 0 ) ;
515
515
expect ( d3 . selectAll ( '.scatterlayer > .trace' ) . size ( ) ) . toBe ( 1 ) ;
516
516
} )
517
- . catch ( fail )
517
+ . catch ( failTest )
518
518
. then ( done ) ;
519
519
} ) ;
520
520
@@ -567,7 +567,7 @@ describe('@gl Test gl2d plots', function() {
567
567
expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ 6 , 8 ] , 3 ) ;
568
568
expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ 5 , 7 ] , 3 ) ;
569
569
} )
570
- . catch ( fail )
570
+ . catch ( failTest )
571
571
. then ( done ) ;
572
572
} ) ;
573
573
@@ -634,7 +634,7 @@ describe('@gl Test gl2d plots', function() {
634
634
expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 8.2 , 24.2 ] , 1 ) ;
635
635
expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 0.12 , 16.1 ] , 1 ) ;
636
636
} )
637
- . catch ( fail )
637
+ . catch ( failTest )
638
638
. then ( done ) ;
639
639
} ) ;
640
640
@@ -690,7 +690,7 @@ describe('@gl Test gl2d plots', function() {
690
690
. then ( function ( ) {
691
691
assertAnnotation ( [ 327 , 331 ] ) ;
692
692
} )
693
- . catch ( fail )
693
+ . catch ( failTest )
694
694
. then ( done ) ;
695
695
} ) ;
696
696
@@ -744,7 +744,7 @@ describe('@gl Test gl2d plots', function() {
744
744
expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
745
745
746
746
} )
747
- . catch ( fail )
747
+ . catch ( failTest )
748
748
. then ( done ) ;
749
749
} ) ;
750
750
@@ -768,7 +768,7 @@ describe('@gl Test gl2d plots', function() {
768
768
. then ( function ( ) {
769
769
expect ( ScatterGl . calc ) . toHaveBeenCalledTimes ( 2 ) ;
770
770
} )
771
- . catch ( fail )
771
+ . catch ( failTest )
772
772
. then ( done ) ;
773
773
} ) ;
774
774
@@ -852,7 +852,7 @@ describe('@gl Test gl2d plots', function() {
852
852
expect ( scene . selectBatch ) . toBe ( null , msg ) ;
853
853
expect ( scene . unselectBatch ) . toBe ( null , msg ) ;
854
854
} )
855
- . catch ( fail )
855
+ . catch ( failTest )
856
856
. then ( done ) ;
857
857
} ) ;
858
858
@@ -869,7 +869,7 @@ describe('@gl Test gl2d plots', function() {
869
869
. then ( function ( ) {
870
870
expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 100 , 80 ) [ 0 ] ) . toBe ( 0 ) ;
871
871
} )
872
- . catch ( fail )
872
+ . catch ( failTest )
873
873
. then ( done ) ;
874
874
} ) ;
875
875
@@ -914,7 +914,7 @@ describe('@gl Test gl2d plots', function() {
914
914
// and 105545275 after.
915
915
expect ( total ) . toBeGreaterThan ( 4e6 ) ;
916
916
} )
917
- . catch ( fail )
917
+ . catch ( failTest )
918
918
. then ( done ) ;
919
919
} ) ;
920
920
@@ -945,7 +945,21 @@ describe('@gl Test gl2d plots', function() {
945
945
expect ( opts . positions )
946
946
. toBeCloseToArray ( [ 1 , 1 , 2 , 2 , 3 , 1 ] ) ;
947
947
} )
948
- . catch ( fail )
948
+ . catch ( failTest )
949
+ . then ( done ) ;
950
+ } ) ;
951
+
952
+ it ( 'should create two WebGL contexts per graph' , function ( done ) {
953
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/gl2d_stacked_subplots.json' ) ) ;
954
+
955
+ Plotly . plot ( gd , fig ) . then ( function ( ) {
956
+ var cnt = 0 ;
957
+ d3 . select ( gd ) . selectAll ( 'canvas' ) . each ( function ( d ) {
958
+ if ( d . regl ) cnt ++ ;
959
+ } ) ;
960
+ expect ( cnt ) . toBe ( 2 ) ;
961
+ } )
962
+ . catch ( failTest )
949
963
. then ( done ) ;
950
964
} ) ;
951
965
} ) ;
@@ -987,7 +1001,7 @@ describe('Test scattergl autorange:', function() {
987
1001
expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( glRangeX , 'x range' ) ;
988
1002
expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( glRangeY , 'y range' ) ;
989
1003
} )
990
- . catch ( fail )
1004
+ . catch ( failTest )
991
1005
. then ( done ) ;
992
1006
} ) ;
993
1007
} ) ;
@@ -1026,7 +1040,7 @@ describe('Test scattergl autorange:', function() {
1026
1040
expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.079 , 1.079 ] , 2 , 'x range' ) ;
1027
1041
expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( [ - 0.105 , 1.105 ] , 2 , 'y range' ) ;
1028
1042
} )
1029
- . catch ( fail )
1043
+ . catch ( failTest )
1030
1044
. then ( done ) ;
1031
1045
} ) ;
1032
1046
@@ -1044,7 +1058,7 @@ describe('Test scattergl autorange:', function() {
1044
1058
expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.119 , 1.119 ] , 2 , 'x range' ) ;
1045
1059
expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( [ - 0.199 , 1.199 ] , 2 , 'y range' ) ;
1046
1060
} )
1047
- . catch ( fail )
1061
+ . catch ( failTest )
1048
1062
. then ( done ) ;
1049
1063
} ) ;
1050
1064
} ) ;
0 commit comments