Ticket #549: clearMapDiv.patch
| File clearMapDiv.patch, 5.1 kB (added by euzuro, 2 years ago) |
|---|
-
tests/test_Map.html
old new 318 318 319 319 320 320 function test_99_Map_destroy (t) { 321 t.plan( 2);321 t.plan( 3 ); 322 322 map = new OpenLayers.Map('map'); 323 323 map.destroy(); 324 324 t.eq( map.layers, null, "map.layers is null after destroy" ); 325 325 t.eq( map.controls, null, "map.controls is null after destroy" ); 326 t.eq( map.div.innerHTML, "", "map's div cleared out"); 326 327 } 327 328 // --> 328 329 </script> -
tests/Control/test_OverviewMap.html
old new 21 21 t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" ); 22 22 t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" ); 23 23 24 map.destroy(); 24 25 } 25 26 function test_03_Control_PanZoom_control_events (t) { 26 27 t.plan( 10 ); … … 64 65 t.eq(overviewCenter.lat, 0, "Overviewmap center lat correct -- second zoom"); 65 66 t.eq(overviewZoom, 0, "Overviewmap zoomcorrect -- second zoom"); 66 67 68 map.destroy(); 67 69 68 70 } 69 71 // --> -
tests/test_Marker.html
old new 42 42 mlayer.addMarker(marker2); 43 43 44 44 t.ok( !marker2.onScreen(), "marker knows it's offscreen" ); 45 45 map.destroy(); 46 46 } 47 47 48 48 function test_03_Marker_setOpacity(t) { … … 70 70 marker.setOpacity(0.5); 71 71 72 72 t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works"); 73 map.destroy(); 73 74 } 74 75 function test_04_Marker_moveTo(t) { 75 76 t.plan( 6 ); … … 101 102 marker.moveTo(new OpenLayers.Pixel(0,0)); 102 103 t.eq(marker.lonlat.lon, map.getExtent().left, "on left edge of map"); 103 104 t.eq(marker.lonlat.lat, map.getExtent().top, "on top edge of map"); 105 map.destroy(); 104 106 105 107 } 106 108 -
tests/Layer/test_WMS.html
old new 62 62 url + "?" + OpenLayers.Util.getParameterString(tParams), 63 63 "div first child is correct image object" ); 64 64 t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." ); 65 map.destroy(); 65 66 } 66 67 67 68 function test_03_Layer_WMS_inittiles (t) { … … 72 73 map.setCenter(new OpenLayers.LonLat(0,0),5); 73 74 t.eq( layer.grid.length, 7, "Grid rows is correct." ); 74 75 t.eq( layer.grid[0].length, 6, "Grid cols is correct." ); 75 76 map.destroy(); 76 77 } 77 78 78 79 … … 101 102 t.eq( clone.alpha, layer.alpha, "alpha copied correctly"); 102 103 103 104 layer.grid = null; 105 map.destroy(); 104 106 } 105 107 106 108 function test_05_Layer_WMS_isBaseLayer(t) { … … 142 144 newParams.CHICKPEAS = 151; 143 145 144 146 t.eq( layer.params.CHICKPEAS, "image/png", "mergeNewParams() makes clean copy of hashtable"); 147 map.destroy(); 145 148 } 146 149 147 150 function test_07_Layer_WMS_getFullRequestString (t) { … … 171 174 t.eq(str, 172 175 tUrl + "?" + OpenLayers.Util.getParameterString(tParams), 173 176 "getFullRequestString() by default does *not* add SRS value if projection is 'none'"); 177 map.destroy(); 174 178 175 179 } 176 180 … … 196 200 tile.draw(); 197 201 t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly"); 198 202 203 map.destroy(); 199 204 } 200 205 201 206 function test_20_Layer_WMS_Reproject (t) { 202 207 t.plan(5); 208 203 209 var map = new OpenLayers.Map('map'); 204 210 var layer = new OpenLayers.Layer.Google("Google"); 205 211 map.addLayer(layer); … … 212 218 t.eq( tile.bounds.right, -11.25, "top side matches" ); 213 219 t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" ); 214 220 t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" ); 221 map.destroy(); 215 222 216 223 var map = new OpenLayers.Map('map'); 217 224 layer = new OpenLayers.Layer.WMS(name, url, params); … … 219 226 map.setCenter(new OpenLayers.LonLat(0,0), 5); 220 227 var tile = layer.grid[0][0]; 221 228 t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay"); 229 230 map.destroy(); 222 231 } 223 232 224 233 function test_99_Layer_WMS_destroy (t) { -
lib/OpenLayers/Map.js
old new 225 225 } 226 226 this.controls = null; 227 227 } 228 this.div.innerHTML = ""; 228 229 }, 229 230 230 231 /**
