@@ -738,4 +738,61 @@ describe('@noCI @gl Test gl2d lasso/select:', function() {
738
738
. catch ( failTest )
739
739
. then ( done ) ;
740
740
} ) ;
741
+
742
+ it ( 'should work on gl text charts' , function ( done ) {
743
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/gl2d_text_chart_basic.json' ) ) ;
744
+ fig . layout . dragmode = 'select' ;
745
+ fig . layout . margin = { t : 0 , b : 0 , l : 0 , r : 0 } ;
746
+ fig . layout . height = 500 ;
747
+ fig . layout . width = 500 ;
748
+ gd = createGraphDiv ( ) ;
749
+
750
+ function _assertGlTextOpts ( msg , exp ) {
751
+ var scene = gd . calcdata [ 0 ] [ 0 ] . t . _scene ;
752
+ scene . glText . forEach ( function ( opts , i ) {
753
+ expect ( Array . from ( opts . color ) )
754
+ . toBeCloseToArray ( exp . rgba [ i ] , 2 , 'item ' + i + ' - ' + msg ) ;
755
+ } ) ;
756
+ }
757
+
758
+ Plotly . plot ( gd , fig )
759
+ . then ( delay ( 100 ) )
760
+ . then ( function ( ) {
761
+ _assertGlTextOpts ( 'base' , {
762
+ rgba : [
763
+ [ 68 , 68 , 68 , 255 ] ,
764
+ [ 68 , 68 , 68 , 255 ] ,
765
+ [ 68 , 68 , 68 , 255 ]
766
+ ]
767
+ } ) ;
768
+ } )
769
+ . then ( function ( ) { return select ( [ [ 100 , 100 ] , [ 250 , 250 ] ] ) ; } )
770
+ . then ( function ( eventData ) {
771
+ assertEventData ( eventData , {
772
+ points : [ { x : 1 , y : 2 } ]
773
+ } ) ;
774
+ _assertGlTextOpts ( 'after selection' , {
775
+ rgba : [
776
+ [
777
+ 68 , 68 , 68 , 51 ,
778
+ 68 , 68 , 68 , 51 ,
779
+ 68 , 68 , 68 , 51 ,
780
+ ] ,
781
+ [
782
+ 68 , 68 , 68 , 51 ,
783
+ // this is the selected pt!
784
+ 68 , 68 , 68 , 255 ,
785
+ 68 , 68 , 68 , 51
786
+ ] ,
787
+ [
788
+ 68 , 68 , 68 , 51 ,
789
+ 68 , 68 , 68 , 51 ,
790
+ 68 , 68 , 68 , 51
791
+ ]
792
+ ]
793
+ } ) ;
794
+ } )
795
+ . catch ( failTest )
796
+ . then ( done ) ;
797
+ } ) ;
741
798
} ) ;
0 commit comments