Skip to content

Commit a1c7c88

Browse files
删除openlayers UT中的map.remove()方法
1 parent 663c1a9 commit a1c7c88

File tree

7 files changed

+8
-11
lines changed

7 files changed

+8
-11
lines changed

test/openlayers/overlay/GraphSpec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require('../../resources/chinaConsumptionLevel');
33

44
var url = GlobeParameter.China4326URL;
55
describe('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
});

test/openlayers/overlay/LabelSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ describe('openlayers_Label', function () {
123123
});
124124
afterAll(function () {
125125
window.document.body.removeChild(testDiv);
126-
map.remove();
127126
});
128127

129128
it('constructor, destroy', function () {

test/openlayers/overlay/RangeSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe('openlayers_Range', function () {
4040
});
4141
afterAll(function () {
4242
window.document.body.removeChild(testDiv);
43-
map.remove();
4443
});
4544

4645
var features = [{

test/openlayers/overlay/VectorTileSuperMapRestSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe('openlayers_VectorTileSuperMapRest', function () {
4040
});
4141
afterAll(function () {
4242
window.document.body.removeChild(testDiv);
43-
map.remove();
4443
});
4544

4645
it('initialize', function (done) {

test/openlayers/overlay/theme/GeoFeatureSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe('openlayers_GeoFeature', function () {
4040
});
4141
afterAll(function () {
4242
window.document.body.removeChild(testDiv);
43-
map.remove();
4443
});
4544

4645
var features = [{

test/openlayers/overlay/theme/ThemeFeatureSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe('openlayers_ThemeFeature', function () {
4040
});
4141
afterAll(function () {
4242
window.document.body.removeChild(testDiv);
43-
map.remove();
4443
});
4544

4645
it("toFeature", function () {

test/openlayers/overlay/theme/ThemeSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe('openlayers_Theme', function () {
4040
});
4141
afterAll(function () {
4242
window.document.body.removeChild(testDiv);
43-
map.remove();
4443
});
4544

4645
var features = [{

0 commit comments

Comments
 (0)