@@ -3,7 +3,7 @@ require('../../resources/chinaConsumptionLevel');
33
44var url = GlobeParameter . China4326URL ;
55describe ( 'openlayers_Graph' , function ( ) {
6- var testDiv , map ;
6+ var testDiv , map , tileLayer ;
77 beforeAll ( function ( ) {
88 testDiv = window . document . createElement ( "div" ) ;
99 testDiv . setAttribute ( "id" , "map" ) ;
@@ -21,16 +21,16 @@ describe('openlayers_Graph', function () {
2121 projection : "EPSG:4326"
2222 } )
2323 } ) ;
24- var layer = new ol . layer . Tile ( {
24+ tileLayer = new ol . layer . Tile ( {
2525 source : new ol . source . TileSuperMapRest ( {
2626 url : url
2727 } )
2828 } ) ;
29- map . addLayer ( layer ) ;
29+ map . addLayer ( tileLayer ) ;
3030 } ) ;
3131 afterAll ( function ( ) {
32+ map . removeLayer ( tileLayer ) ;
3233 window . document . body . removeChild ( testDiv ) ;
33- map . remove ( ) ;
3434 } ) ;
3535
3636 it ( 'constructor, destroy' , function ( done ) {
@@ -93,7 +93,7 @@ describe('openlayers_Graph', function () {
9393 } ,
9494 isOverLay : false
9595 } ) ;
96- expect ( graphThemeSource . isOverLay ) . toBeFalsy ( ) ;
96+ expect ( graphThemeSource . isOverLay ) . toBeFalsy ( ) ;
9797 //setOpacity
9898 graphThemeSource . setOpacity ( 0.6 ) ;
9999 expect ( graphThemeSource . opacity ) . toEqual ( 0.6 ) ;
@@ -134,6 +134,7 @@ describe('openlayers_Graph', function () {
134134 graphThemeSource . offset = 3 ;
135135 graphThemeSource . fire ( 'move' , event ) ;
136136 graphThemeSource . clear ( ) ;
137+ map . removeLayer ( layer ) ;
137138 done ( ) ;
138139 } ) ;
139140
@@ -244,6 +245,7 @@ describe('openlayers_Graph', function () {
244245 graphThemeSource . removeAllFeatures ( ) ;
245246 expect ( graphThemeSource . features . length ) . toEqual ( 0 ) ;
246247 graphThemeSource . clear ( ) ;
248+ map . removeLayer ( layer ) ;
247249 done ( ) ;
248250 } , 3000 ) ;
249251 } ) ;
@@ -322,6 +324,7 @@ describe('openlayers_Graph', function () {
322324 setTimeout ( function ( ) {
323325 expect ( graphThemeSource . context ) . not . toBeUndefined ( ) ;
324326 graphThemeSource . clear ( ) ;
327+ map . removeLayer ( layer ) ;
325328 done ( ) ;
326329 } , 3000 ) ;
327330 } ) ;
0 commit comments