@@ -13,8 +13,9 @@ describe('maplibregl_GraphicLayer', () => {
1313 [ - 37.16 , 40.05 ] ,
1414 [ - 38.16 , 39.05 ]
1515 ] ;
16+ let testDiv , map ;
1617 function creatGraphicLayer ( ) {
17- let testDiv , map , graphics = [ ] , graphicLayer ;
18+ let graphics = [ ] , graphicLayer ;
1819 //构建数据
1920 for ( let i = 0 ; i < coors . length ; i ++ ) {
2021 let lngLat = {
@@ -35,7 +36,25 @@ describe('maplibregl_GraphicLayer', () => {
3536 window . document . body . appendChild ( testDiv ) ;
3637 map = new maplibregl . Map ( {
3738 container : 'map' ,
38- style : 'mapbox://styles/mapbox/streets-v9' ,
39+ style : {
40+ version : 8 ,
41+ sources : {
42+ 'raster-tiles' : {
43+ type : 'raster' ,
44+ tiles : [ GlobeParameter . ChinaURL + '/zxyTileImage.png?z={z}&x={x}&y={y}' ] ,
45+ tileSize : 256
46+ }
47+ } ,
48+ layers : [
49+ {
50+ id : 'simple-tiles' ,
51+ type : 'raster' ,
52+ source : 'raster-tiles' ,
53+ minzoom : 0 ,
54+ maxzoom : 22
55+ }
56+ ]
57+ } ,
3958 center : [ 13.413952 , 52.531913 ] ,
4059 zoom : 16.000000000000004 ,
4160 pitch : 33.2
@@ -51,11 +70,16 @@ describe('maplibregl_GraphicLayer', () => {
5170 jasmine . DEFAULT_TIMEOUT_INTERVAL = 50000 ;
5271 } ) ;
5372 afterEach ( ( ) => {
73+ if ( testDiv ) {
74+ document . body . removeChild ( testDiv ) ;
75+ testDiv = null ;
76+ }
5477 jasmine . DEFAULT_TIMEOUT_INTERVAL = originalTimeout ;
5578 } ) ;
5679 afterAll ( ( ) => {
57- document . body . removeChild ( document . getElementById ( 'map' ) ) ;
80+ // document.body.removeChild(document.getElementById('map'));
5881 // map.removeLayer("graphicLayer");
82+ map = null ;
5983 } ) ;
6084
6185 it ( 'constructor' , ( done ) => {
0 commit comments