@@ -964,5 +964,78 @@ describe('@noCI, mapbox plots', function() {
964
964
} , MOUSE_DELAY ) ;
965
965
} ) ;
966
966
}
967
+ } ) ;
968
+
969
+ describe ( '@noCI, mapbox toImage' , function ( ) {
970
+ var MINIMUM_LENGTH = 1e5 ;
971
+
972
+ var gd ;
973
+
974
+ beforeEach ( function ( ) {
975
+ gd = createGraphDiv ( ) ;
976
+ } ) ;
977
+
978
+ afterEach ( function ( ) {
979
+ Plotly . purge ( gd ) ;
980
+ Plotly . setPlotConfig ( { mapboxAccessToken : null } ) ;
981
+ destroyGraphDiv ( ) ;
982
+ } ) ;
983
+
984
+ it ( 'should generate image data with global credentials' , function ( done ) {
985
+ Plotly . setPlotConfig ( {
986
+ mapboxAccessToken : MAPBOX_ACCESS_TOKEN
987
+ } ) ;
988
+
989
+ Plotly . newPlot ( gd , [ {
990
+ type : 'scattermapbox' ,
991
+ lon : [ 0 , 10 , 20 ] ,
992
+ lat : [ - 10 , 10 , - 10 ]
993
+ } ] )
994
+ . then ( function ( ) {
995
+ return Plotly . toImage ( gd ) ;
996
+ } )
997
+ . then ( function ( imgData ) {
998
+ expect ( imgData . length ) . toBeGreaterThan ( MINIMUM_LENGTH ) ;
999
+ } )
1000
+ . catch ( failTest )
1001
+ . then ( done ) ;
1002
+ } , LONG_TIMEOUT_INTERVAL ) ;
1003
+
1004
+ it ( 'should generate image data with config credentials' , function ( done ) {
1005
+ Plotly . newPlot ( gd , [ {
1006
+ type : 'scattermapbox' ,
1007
+ lon : [ 0 , 10 , 20 ] ,
1008
+ lat : [ - 10 , 10 , - 10 ]
1009
+ } ] , { } , {
1010
+ mapboxAccessToken : MAPBOX_ACCESS_TOKEN
1011
+ } )
1012
+ . then ( function ( ) {
1013
+ return Plotly . toImage ( gd ) ;
1014
+ } )
1015
+ . then ( function ( imgData ) {
1016
+ expect ( imgData . length ) . toBeGreaterThan ( MINIMUM_LENGTH ) ;
1017
+ } )
1018
+ . catch ( failTest )
1019
+ . then ( done ) ;
1020
+ } , LONG_TIMEOUT_INTERVAL ) ;
967
1021
1022
+ it ( 'should generate image data with layout credentials' , function ( done ) {
1023
+ Plotly . newPlot ( gd , [ {
1024
+ type : 'scattermapbox' ,
1025
+ lon : [ 0 , 10 , 20 ] ,
1026
+ lat : [ - 10 , 10 , - 10 ]
1027
+ } ] , {
1028
+ mapbox : {
1029
+ accesstoken : MAPBOX_ACCESS_TOKEN
1030
+ }
1031
+ } )
1032
+ . then ( function ( ) {
1033
+ return Plotly . toImage ( gd ) ;
1034
+ } )
1035
+ . then ( function ( imgData ) {
1036
+ expect ( imgData . length ) . toBeGreaterThan ( MINIMUM_LENGTH ) ;
1037
+ } )
1038
+ . catch ( failTest )
1039
+ . then ( done ) ;
1040
+ } , LONG_TIMEOUT_INTERVAL ) ;
968
1041
} ) ;
0 commit comments