@@ -615,11 +615,37 @@ describe('Click-to-select', function() {
615615
616616 describe ( 'is supported by' , function ( ) {
617617
618+ function _run ( testCase , doneFn ) {
619+ Plotly . plot ( gd , testCase . mock . data , testCase . mock . layout , testCase . mock . config )
620+ . then ( function ( ) {
621+ return _immediateClickPt ( testCase ) ;
622+ } )
623+ . then ( function ( ) {
624+ assertSelectedPoints ( testCase . expectedPts ) ;
625+ return Plotly . relayout ( gd , 'dragmode' , 'lasso' ) ;
626+ } )
627+ . then ( function ( ) {
628+ _clickPt ( testCase ) ;
629+ return deselectPromise ;
630+ } )
631+ . then ( function ( ) {
632+ assertSelectionCleared ( ) ;
633+ return _clickPt ( testCase ) ;
634+ } )
635+ . then ( function ( ) {
636+ assertSelectedPoints ( testCase . expectedPts ) ;
637+ } )
638+ . catch ( failTest )
639+ . then ( doneFn ) ;
640+ }
641+
618642 // On loading mocks:
619643 // - Note, that `require` function calls are resolved at compile time
620644 // and thus dynamically concatenated mock paths won't work.
621645 // - Some mocks don't specify a width and height, so this needs
622646 // to be set explicitly to ensure click coordinates fit.
647+
648+ // The non-gl traces: use @flaky CI annotation
623649 [
624650 testCase ( 'histrogram' , require ( '@mocks/histogram_colorscale.json' ) , 355 , 301 , [ 3 , 4 , 5 ] ) ,
625651 testCase ( 'box' , require ( '@mocks/box_grouped_horz.json' ) , 610 , 342 , [ [ 2 ] , [ ] , [ ] ] ,
@@ -643,34 +669,22 @@ describe('Click-to-select', function() {
643669 // so set dragmode to zoom
644670 testCase ( 'scatterpolar' , require ( '@mocks/polar_scatter.json' ) , 130 , 290 ,
645671 [ [ ] , [ ] , [ ] , [ 19 ] , [ ] , [ ] ] , { dragmode : 'zoom' } ) ,
672+ ]
673+ . forEach ( function ( testCase ) {
674+ it ( '@flaky trace type ' + testCase . label , function ( done ) {
675+ _run ( testCase , done ) ;
676+ } ) ;
677+ } ) ;
678+
679+ // The gl traces: use @gl CI annotation
680+ [
646681 testCase ( 'scatterpolargl' , require ( '@mocks/glpolar_scatter.json' ) , 130 , 290 ,
647- [ [ ] , [ ] , [ ] , [ 19 ] , [ ] , [ ] ] , { dragmode : 'zoom' } ) . enableGl ( ) ,
648- testCase ( 'splom' , require ( '@mocks/splom_lower.json' ) , 427 , 400 , [ [ ] , [ 7 ] , [ ] ] ) . enableGl ( )
682+ [ [ ] , [ ] , [ ] , [ 19 ] , [ ] , [ ] ] , { dragmode : 'zoom' } ) ,
683+ testCase ( 'splom' , require ( '@mocks/splom_lower.json' ) , 427 , 400 , [ [ ] , [ 7 ] , [ ] ] )
649684 ]
650685 . forEach ( function ( testCase ) {
651- var ciAnnotation = testCase . gl ? 'gl' : 'flaky' ;
652- it ( '@' + ciAnnotation + ' trace type ' + testCase . label , function ( done ) {
653- Plotly . plot ( gd , testCase . mock . data , testCase . mock . layout , testCase . mock . config )
654- . then ( function ( ) {
655- return _immediateClickPt ( testCase ) ;
656- } )
657- . then ( function ( ) {
658- assertSelectedPoints ( testCase . expectedPts ) ;
659- return Plotly . relayout ( gd , 'dragmode' , 'lasso' ) ;
660- } )
661- . then ( function ( ) {
662- _clickPt ( testCase ) ;
663- return deselectPromise ;
664- } )
665- . then ( function ( ) {
666- assertSelectionCleared ( ) ;
667- return _clickPt ( testCase ) ;
668- } )
669- . then ( function ( ) {
670- assertSelectedPoints ( testCase . expectedPts ) ;
671- } )
672- . catch ( failTest )
673- . then ( done ) ;
686+ it ( '@gl trace type ' + testCase . label , function ( done ) {
687+ _run ( testCase , done ) ;
674688 } ) ;
675689 } ) ;
676690 } ) ;
@@ -737,12 +751,7 @@ describe('Click-to-select', function() {
737751 x : x ,
738752 y : y ,
739753 expectedPts : expectedPts ,
740- configOptions : configOptions ,
741- gl : false ,
742- enableGl : function ( ) {
743- this . gl = true ;
744- return this ;
745- }
754+ configOptions : configOptions
746755 } ;
747756 }
748757} ) ;
0 commit comments