@@ -8,7 +8,7 @@ var ScatterGl = require('@src/traces/scattergl');
88
99var createGraphDiv = require ( '../assets/create_graph_div' ) ;
1010var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
11- var fail = require ( '../assets/fail_test' ) ;
11+ var failTest = require ( '../assets/fail_test' ) ;
1212var mouseEvent = require ( '../assets/mouse_event' ) ;
1313var touchEvent = require ( '../assets/touch_event' ) ;
1414var drag = require ( '../assets/drag' ) ;
@@ -202,7 +202,7 @@ describe('@gl Test gl plot side effects', function() {
202202 . then ( function ( ) {
203203 expect ( gd . querySelector ( '.gl-canvas-context' ) . width ) . toBe ( 300 ) ;
204204 } )
205- . catch ( fail )
205+ . catch ( failTest )
206206 . then ( done ) ;
207207 } ) ;
208208} ) ;
@@ -350,7 +350,7 @@ describe('@gl Test gl2d plots', function() {
350350 'yaxis.range[1]' : jasmine . any ( Number )
351351 } ) ) ;
352352 } )
353- . catch ( fail )
353+ . catch ( failTest )
354354 . then ( done ) ;
355355 } ) ;
356356
@@ -381,7 +381,7 @@ describe('@gl Test gl2d plots', function() {
381381 . then ( function ( ) {
382382 expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 108 , 100 ) [ 0 ] ) . not . toBe ( 0 ) ;
383383 } )
384- . catch ( fail )
384+ . catch ( failTest )
385385 . then ( done ) ;
386386 } ) ;
387387
@@ -423,7 +423,7 @@ describe('@gl Test gl2d plots', function() {
423423 expect ( scene . error2d . draw ) . toHaveBeenCalledTimes ( 2 , 'twice for x AND y' ) ;
424424 expect ( scene . scatter2d . draw ) . toHaveBeenCalledTimes ( 3 , 'both traces have markers' ) ;
425425 } )
426- . catch ( fail )
426+ . catch ( failTest )
427427 . then ( done ) ;
428428 } ) ;
429429
@@ -451,7 +451,7 @@ describe('@gl Test gl2d plots', function() {
451451 expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 158 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
452452 expect ( readPixel ( gd . querySelector ( '.gl-canvas-focus' ) , 168 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
453453 } )
454- . catch ( fail )
454+ . catch ( failTest )
455455 . then ( done ) ;
456456 } ) ;
457457
@@ -490,7 +490,7 @@ describe('@gl Test gl2d plots', function() {
490490 expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 158 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
491491 expect ( readPixel ( gd . querySelector ( '.gl-canvas-focus' ) , 168 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
492492 } )
493- . catch ( fail )
493+ . catch ( failTest )
494494 . then ( done ) ;
495495 } ) ;
496496
@@ -514,7 +514,7 @@ describe('@gl Test gl2d plots', function() {
514514 expect ( countCanvases ( ) ) . toBe ( 0 ) ;
515515 expect ( d3 . selectAll ( '.scatterlayer > .trace' ) . size ( ) ) . toBe ( 1 ) ;
516516 } )
517- . catch ( fail )
517+ . catch ( failTest )
518518 . then ( done ) ;
519519 } ) ;
520520
@@ -567,7 +567,7 @@ describe('@gl Test gl2d plots', function() {
567567 expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ 6 , 8 ] , 3 ) ;
568568 expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ 5 , 7 ] , 3 ) ;
569569 } )
570- . catch ( fail )
570+ . catch ( failTest )
571571 . then ( done ) ;
572572 } ) ;
573573
@@ -634,7 +634,7 @@ describe('@gl Test gl2d plots', function() {
634634 expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 8.2 , 24.2 ] , 1 ) ;
635635 expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 0.12 , 16.1 ] , 1 ) ;
636636 } )
637- . catch ( fail )
637+ . catch ( failTest )
638638 . then ( done ) ;
639639 } ) ;
640640
@@ -690,7 +690,7 @@ describe('@gl Test gl2d plots', function() {
690690 . then ( function ( ) {
691691 assertAnnotation ( [ 327 , 331 ] ) ;
692692 } )
693- . catch ( fail )
693+ . catch ( failTest )
694694 . then ( done ) ;
695695 } ) ;
696696
@@ -744,7 +744,7 @@ describe('@gl Test gl2d plots', function() {
744744 expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
745745
746746 } )
747- . catch ( fail )
747+ . catch ( failTest )
748748 . then ( done ) ;
749749 } ) ;
750750
@@ -768,7 +768,7 @@ describe('@gl Test gl2d plots', function() {
768768 . then ( function ( ) {
769769 expect ( ScatterGl . calc ) . toHaveBeenCalledTimes ( 2 ) ;
770770 } )
771- . catch ( fail )
771+ . catch ( failTest )
772772 . then ( done ) ;
773773 } ) ;
774774
@@ -852,7 +852,7 @@ describe('@gl Test gl2d plots', function() {
852852 expect ( scene . selectBatch ) . toBe ( null , msg ) ;
853853 expect ( scene . unselectBatch ) . toBe ( null , msg ) ;
854854 } )
855- . catch ( fail )
855+ . catch ( failTest )
856856 . then ( done ) ;
857857 } ) ;
858858
@@ -869,7 +869,7 @@ describe('@gl Test gl2d plots', function() {
869869 . then ( function ( ) {
870870 expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 100 , 80 ) [ 0 ] ) . toBe ( 0 ) ;
871871 } )
872- . catch ( fail )
872+ . catch ( failTest )
873873 . then ( done ) ;
874874 } ) ;
875875
@@ -914,7 +914,7 @@ describe('@gl Test gl2d plots', function() {
914914 // and 105545275 after.
915915 expect ( total ) . toBeGreaterThan ( 4e6 ) ;
916916 } )
917- . catch ( fail )
917+ . catch ( failTest )
918918 . then ( done ) ;
919919 } ) ;
920920
@@ -945,7 +945,21 @@ describe('@gl Test gl2d plots', function() {
945945 expect ( opts . positions )
946946 . toBeCloseToArray ( [ 1 , 1 , 2 , 2 , 3 , 1 ] ) ;
947947 } )
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 )
949963 . then ( done ) ;
950964 } ) ;
951965} ) ;
@@ -987,7 +1001,7 @@ describe('Test scattergl autorange:', function() {
9871001 expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( glRangeX , 'x range' ) ;
9881002 expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( glRangeY , 'y range' ) ;
9891003 } )
990- . catch ( fail )
1004+ . catch ( failTest )
9911005 . then ( done ) ;
9921006 } ) ;
9931007 } ) ;
@@ -1026,7 +1040,7 @@ describe('Test scattergl autorange:', function() {
10261040 expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.079 , 1.079 ] , 2 , 'x range' ) ;
10271041 expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( [ - 0.105 , 1.105 ] , 2 , 'y range' ) ;
10281042 } )
1029- . catch ( fail )
1043+ . catch ( failTest )
10301044 . then ( done ) ;
10311045 } ) ;
10321046
@@ -1044,7 +1058,7 @@ describe('Test scattergl autorange:', function() {
10441058 expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.119 , 1.119 ] , 2 , 'x range' ) ;
10451059 expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( [ - 0.199 , 1.199 ] , 2 , 'y range' ) ;
10461060 } )
1047- . catch ( fail )
1061+ . catch ( failTest )
10481062 . then ( done ) ;
10491063 } ) ;
10501064 } ) ;
0 commit comments