@@ -558,6 +558,32 @@ describe('Test gl3d plots', function() {
558
558
. catch ( failTest )
559
559
. then ( done ) ;
560
560
} ) ;
561
+
562
+ it ( '@gl should only accept texts for textposition otherwise textposition is set to middle center before passing to webgl' , function ( done ) {
563
+ Plotly . plot ( gd , [ {
564
+ type : 'scatter3d' ,
565
+ mode : 'markers+text+lines' ,
566
+ x : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 ] ,
567
+ y : [ - 1 , - 2 , - 3 , - 4 , - 5 , - 6 , - 7 , - 8 , - 9 , - 10 , - 11 , - 12 , - 13 , - 14 , - 15 , - 16 ] ,
568
+ z : [ 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 ] ,
569
+ text : [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' ] ,
570
+ textposition : [ "left top" , "right top" , "left bottom" , "right bottom" , null , undefined , , true , false , [ ] , { } , NaN , Infinity , 0 ]
571
+ } ] )
572
+ . then ( function ( ) {
573
+ var AllTextpositions = gd . _fullData [ 0 ] . textposition
574
+
575
+ expect ( AllTextpositions [ 0 ] ) . toBe ( "top left" , 'is not top left' ) ;
576
+ expect ( AllTextpositions [ 1 ] ) . toBe ( "top right" , 'is not top right' ) ;
577
+ expect ( AllTextpositions [ 2 ] ) . toBe ( "bottom left" , 'is not bottom left' ) ;
578
+ expect ( AllTextpositions [ 3 ] ) . toBe ( "bottom right" , 'is not bottom right' ) ;
579
+ for ( var i = 4 ; i < AllTextpositions . length ; i ++ ) {
580
+ expect ( AllTextpositions [ i ] ) . toBe ( "middle center" , 'is not middle center' ) ;
581
+ }
582
+ } )
583
+ . catch ( failTest )
584
+ . then ( done ) ;
585
+ } ) ;
586
+
561
587
} ) ;
562
588
563
589
describe ( 'Test gl3d modebar handlers' , function ( ) {
0 commit comments