@@ -8,6 +8,8 @@ var d3 = require('d3');
8
8
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
9
9
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
10
10
var mouseEvent = require ( '../assets/mouse_event' ) ;
11
+ var click = require ( '../assets/click' ) ;
12
+ var delay = require ( '../assets/delay' ) ;
11
13
var failTest = require ( '../assets/fail_test' ) ;
12
14
var supplyAllDefaults = require ( '../assets/supply_defaults' ) ;
13
15
@@ -272,9 +274,14 @@ describe('mapbox credentials', function() {
272
274
var cnt = 0 ;
273
275
var msg = [
274
276
'An API access token is required to use Mapbox GL.' ,
275
- 'See https://www.mapbox.com/api-documentation/#access-tokens'
277
+ 'See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes '
276
278
] . join ( ' ' ) ;
277
279
280
+ // TODO potential new way of doing this:
281
+ // https://github.com/mapbox/mapbox-gl-js/pull/7594
282
+ //
283
+ // https://www.mapbox.com/atlas/#developing-with-atlas
284
+
278
285
Plotly . plot ( gd , [ {
279
286
type : 'scattermapbox' ,
280
287
lon : [ 10 , 20 , 30 ] ,
@@ -288,6 +295,11 @@ describe('mapbox credentials', function() {
288
295
} )
289
296
. catch ( function ( err ) {
290
297
cnt ++ ;
298
+ // Note that we get an error here on `new mapboxgl.Map`
299
+ // as we don't have an Atlas server running.
300
+ //
301
+ // In essence, we test that the `new mapboxgl.Map` throws
302
+ // as oppose to `findAccessToken`
291
303
expect ( err ) . toEqual ( new Error ( msg ) ) ;
292
304
} )
293
305
. then ( function ( ) {
@@ -524,6 +536,11 @@ describe('@noCI, mapbox plots', function() {
524
536
expect ( mapInfo . style . name ) . toEqual ( style ) ;
525
537
}
526
538
539
+ // TODO
540
+ // this one now logs:
541
+ // 'Unable to perform style diff: Unimplemented: setSprite.. Rebuilding the style from scratch.'
542
+ // https://github.com/mapbox/mapbox-gl-js/issues/6933
543
+
527
544
assertLayout ( 'Mapbox Dark' ) ;
528
545
529
546
Plotly . relayout ( gd , 'mapbox.style' , 'light' ) . then ( function ( ) {
@@ -735,6 +752,11 @@ describe('@noCI, mapbox plots', function() {
735
752
expect ( String ( layer . paint . _values [ 'fill-color' ] . value . value ) ) . toBe ( color , 'layer color' ) ;
736
753
}
737
754
755
+ // TODO
756
+ // this one now logs:
757
+ // 'Unable to perform style diff: Unimplemented: setSprite, setLayerProperty.. Rebuilding the style from scratch.'
758
+ // github.com/mapbox/mapbox-gl-js/issues/6933/
759
+
738
760
Plotly . react ( gd , makeFigure ( 'blue' ) ) . then ( function ( ) {
739
761
_assert ( 'rgba(0,0,255,1)' ) ;
740
762
return Plotly . react ( gd , makeFigure ( 'red' ) ) ;
@@ -936,15 +958,15 @@ describe('@noCI, mapbox plots', function() {
936
958
937
959
_drag ( pointPos , p1 , function ( ) {
938
960
expect ( relayoutCnt ) . toBe ( 1 , 'relayout cnt' ) ;
939
- expect ( relayoutingCnt ) . toBe ( 2 , 'relayouting cnt' ) ;
961
+ expect ( relayoutingCnt ) . toBe ( 1 , 'relayouting cnt' ) ;
940
962
expect ( doubleClickCnt ) . toBe ( 0 , 'double click cnt' ) ;
941
963
_assert ( [ - 19.651 , 13.751 ] , 1.234 ) ;
942
964
943
965
return _doubleClick ( p1 ) ;
944
966
} )
945
967
. then ( function ( ) {
946
968
expect ( relayoutCnt ) . toBe ( 2 , 'relayout cnt' ) ;
947
- expect ( relayoutingCnt ) . toBe ( 2 , 'relayouting cnt' ) ;
969
+ expect ( relayoutingCnt ) . toBe ( 1 , 'relayouting cnt' ) ;
948
970
expect ( doubleClickCnt ) . toBe ( 1 , 'double click cnt' ) ;
949
971
_assert ( [ - 4.710 , 19.475 ] , 1.234 ) ;
950
972
@@ -968,18 +990,21 @@ describe('@noCI, mapbox plots', function() {
968
990
ptData = eventData . points [ 0 ] ;
969
991
} ) ;
970
992
971
- _click ( blankPos , function ( ) {
993
+ Promise . resolve ( )
994
+ . then ( function ( ) { return click ( blankPos [ 0 ] , blankPos [ 1 ] ) ; } )
995
+ . then ( delay ( 100 ) )
996
+ . then ( function ( ) {
972
997
expect ( ptData ) . toBe ( undefined , 'not firing on blank points' ) ;
973
998
} )
999
+ . then ( delay ( 100 ) )
1000
+ . then ( function ( ) { return click ( pointPos [ 0 ] , pointPos [ 1 ] ) ; } )
974
1001
. then ( function ( ) {
975
- return _click ( pointPos , function ( ) {
976
- expect ( ptData ) . not . toBe ( undefined , 'firing on data points' ) ;
977
- expect ( Object . keys ( ptData ) ) . toEqual ( [
978
- 'data' , 'fullData' , 'curveNumber' , 'pointNumber' , 'pointIndex' , 'lon' , 'lat'
979
- ] , 'returning the correct event data keys' ) ;
980
- expect ( ptData . curveNumber ) . toEqual ( 0 , 'returning the correct curve number' ) ;
981
- expect ( ptData . pointNumber ) . toEqual ( 0 , 'returning the correct point number' ) ;
982
- } ) ;
1002
+ expect ( ptData ) . not . toBe ( undefined , 'firing on data points' ) ;
1003
+ expect ( Object . keys ( ptData ) ) . toEqual ( [
1004
+ 'data' , 'fullData' , 'curveNumber' , 'pointNumber' , 'pointIndex' , 'lon' , 'lat'
1005
+ ] , 'returning the correct event data keys' ) ;
1006
+ expect ( ptData . curveNumber ) . toEqual ( 0 , 'returning the correct curve number' ) ;
1007
+ expect ( ptData . pointNumber ) . toEqual ( 0 , 'returning the correct point number' ) ;
983
1008
} )
984
1009
. catch ( failTest )
985
1010
. then ( done ) ;
@@ -1150,11 +1175,6 @@ describe('@noCI, mapbox plots', function() {
1150
1175
} ) ;
1151
1176
}
1152
1177
1153
- function _click ( pos , cb ) {
1154
- mouseEvent ( 'mousemove' , pos [ 0 ] , pos [ 1 ] ) ;
1155
- return _mouseEvent ( 'click' , pos , cb ) ;
1156
- }
1157
-
1158
1178
function _doubleClick ( pos ) {
1159
1179
return _mouseEvent ( 'dblclick' , pos , noop ) ;
1160
1180
}
0 commit comments