@@ -328,7 +328,7 @@ describe('MapExtend mapboxgl', () => {
328328 sources : {
329329 'raster-tiles' : {
330330 type : 'raster' ,
331- tiles : [ GlobeParameter . ChinaURL + '/zxyTileImage .png?z={z}&x={x}&y={y} '] ,
331+ tiles : [ 'base/resources/img/baiduTileTest .png'] ,
332332 tileSize : 256
333333 }
334334 } ,
@@ -351,6 +351,8 @@ describe('MapExtend mapboxgl', () => {
351351 getSource : function ( ) {
352352 return { } ;
353353 } ,
354+ removeSource : function ( ) { } ,
355+ isSourceLoaded : function ( ) { return true ; } ,
354356 getLayer : function ( ) {
355357 return { } ;
356358 } ,
@@ -382,6 +384,8 @@ describe('MapExtend mapboxgl', () => {
382384 expect ( map . getSource ( 'l7_layer_1' ) ) . not . toBeUndefined ( ) ;
383385 expect ( map . getSource ( 'raster-tiles' ) ) . not . toBeUndefined ( ) ;
384386 expect ( options . getSource . calls . count ( ) ) . toEqual ( 1 ) ;
387+ expect ( map . isSourceLoaded ( 'l7_layer_1' ) ) . toBeTruthy ( ) ;
388+ expect ( map . isSourceLoaded ( 'raster-tiles' ) ) . toBeTruthy ( ) ;
385389 expect ( map . getLayer ( 'l7_layer_1' ) ) . not . toBeUndefined ( ) ;
386390 expect ( map . getLayer ( 'simple-tiles' ) ) . not . toBeUndefined ( ) ;
387391 expect ( map . getLayer ( 'heatmap_1' ) ) . toEqual ( map . overlayLayersManager [ 'heatmap_1' ] ) ;
@@ -404,6 +408,10 @@ describe('MapExtend mapboxgl', () => {
404408 map . off ( 'click' , 'l7_layer_1' , cb ) ;
405409 map . off ( 'click' , cb ) ;
406410 expect ( options . off . calls . count ( ) ) . toEqual ( 1 ) ;
411+ map . removeSource ( 'l7_layer_1' ) ;
412+ map . removeLayer ( 'simple-tiles' ) ;
413+ map . removeSource ( 'raster-tiles' ) ;
414+ expect ( options . removeSource . calls . count ( ) ) . toEqual ( 1 ) ;
407415 map . remove ( ) ;
408416 done ( ) ;
409417 } ) ;
0 commit comments