@@ -8,6 +8,8 @@ var d3 = require('d3');
88var createGraphDiv = require ( '../assets/create_graph_div' ) ;
99var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
1010var mouseEvent = require ( '../assets/mouse_event' ) ;
11+ var click = require ( '../assets/click' ) ;
12+ var delay = require ( '../assets/delay' ) ;
1113var failTest = require ( '../assets/fail_test' ) ;
1214var supplyAllDefaults = require ( '../assets/supply_defaults' ) ;
1315
@@ -272,9 +274,14 @@ describe('mapbox credentials', function() {
272274 var cnt = 0 ;
273275 var msg = [
274276 '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 '
276278 ] . join ( ' ' ) ;
277279
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+
278285 Plotly . plot ( gd , [ {
279286 type : 'scattermapbox' ,
280287 lon : [ 10 , 20 , 30 ] ,
@@ -288,6 +295,11 @@ describe('mapbox credentials', function() {
288295 } )
289296 . catch ( function ( err ) {
290297 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`
291303 expect ( err ) . toEqual ( new Error ( msg ) ) ;
292304 } )
293305 . then ( function ( ) {
@@ -524,6 +536,11 @@ describe('@noCI, mapbox plots', function() {
524536 expect ( mapInfo . style . name ) . toEqual ( style ) ;
525537 }
526538
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+
527544 assertLayout ( 'Mapbox Dark' ) ;
528545
529546 Plotly . relayout ( gd , 'mapbox.style' , 'light' ) . then ( function ( ) {
@@ -735,6 +752,11 @@ describe('@noCI, mapbox plots', function() {
735752 expect ( String ( layer . paint . _values [ 'fill-color' ] . value . value ) ) . toBe ( color , 'layer color' ) ;
736753 }
737754
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+
738760 Plotly . react ( gd , makeFigure ( 'blue' ) ) . then ( function ( ) {
739761 _assert ( 'rgba(0,0,255,1)' ) ;
740762 return Plotly . react ( gd , makeFigure ( 'red' ) ) ;
@@ -936,15 +958,15 @@ describe('@noCI, mapbox plots', function() {
936958
937959 _drag ( pointPos , p1 , function ( ) {
938960 expect ( relayoutCnt ) . toBe ( 1 , 'relayout cnt' ) ;
939- expect ( relayoutingCnt ) . toBe ( 2 , 'relayouting cnt' ) ;
961+ expect ( relayoutingCnt ) . toBe ( 1 , 'relayouting cnt' ) ;
940962 expect ( doubleClickCnt ) . toBe ( 0 , 'double click cnt' ) ;
941963 _assert ( [ - 19.651 , 13.751 ] , 1.234 ) ;
942964
943965 return _doubleClick ( p1 ) ;
944966 } )
945967 . then ( function ( ) {
946968 expect ( relayoutCnt ) . toBe ( 2 , 'relayout cnt' ) ;
947- expect ( relayoutingCnt ) . toBe ( 2 , 'relayouting cnt' ) ;
969+ expect ( relayoutingCnt ) . toBe ( 1 , 'relayouting cnt' ) ;
948970 expect ( doubleClickCnt ) . toBe ( 1 , 'double click cnt' ) ;
949971 _assert ( [ - 4.710 , 19.475 ] , 1.234 ) ;
950972
@@ -968,18 +990,21 @@ describe('@noCI, mapbox plots', function() {
968990 ptData = eventData . points [ 0 ] ;
969991 } ) ;
970992
971- _click ( blankPos , function ( ) {
993+ Promise . resolve ( )
994+ . then ( function ( ) { return click ( blankPos [ 0 ] , blankPos [ 1 ] ) ; } )
995+ . then ( delay ( 100 ) )
996+ . then ( function ( ) {
972997 expect ( ptData ) . toBe ( undefined , 'not firing on blank points' ) ;
973998 } )
999+ . then ( delay ( 100 ) )
1000+ . then ( function ( ) { return click ( pointPos [ 0 ] , pointPos [ 1 ] ) ; } )
9741001 . 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' ) ;
9831008 } )
9841009 . catch ( failTest )
9851010 . then ( done ) ;
@@ -1150,11 +1175,6 @@ describe('@noCI, mapbox plots', function() {
11501175 } ) ;
11511176 }
11521177
1153- function _click ( pos , cb ) {
1154- mouseEvent ( 'mousemove' , pos [ 0 ] , pos [ 1 ] ) ;
1155- return _mouseEvent ( 'click' , pos , cb ) ;
1156- }
1157-
11581178 function _doubleClick ( pos ) {
11591179 return _mouseEvent ( 'dblclick' , pos , noop ) ;
11601180 }
0 commit comments