Skip to content

Commit d1934aa

Browse files
committed
classic增加UT
1 parent 67b1dd7 commit d1934aa

File tree

3 files changed

+231
-41
lines changed

3 files changed

+231
-41
lines changed

test/classic/overlay/MapVLayerSpec.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ describe('classic_MapVLayer', () => {
5959
},
6060
globalAlpha: 0.5,
6161
gradient: {0.25: "rgb(0,0,255)", 0.55: "rgb(0,255,0)", 0.85: "yellow", 1.0: "rgb(255,0,0)"},
62-
draw: 'honeycomb'
62+
draw: 'honeycomb',
63+
method: {
64+
click: {},
65+
mousemove: {}
66+
}
6367
};
6468
mapvLayer = new MapVLayer("mapv", {dataSet: dataSet, options: options});
6569
map.addLayer(mapvLayer);
@@ -150,21 +154,29 @@ describe('classic_MapVLayer', () => {
150154
expect(mapvLayer.maxHeight).toBeNull();
151155
});
152156

153-
//方法引用错误
154-
xit('removeData', (done) => {
155-
var filter = (data) => {
156-
if (mapvLayer.dataSet._data.indexOf(data) === 2) {
157-
return true
158-
}
159-
return false;
160-
}
161-
mapvLayer.removeData(filter);
157+
158+
it('removeData', (done) => {
159+
var data = [{
160+
geometry: {
161+
type: 'Point',
162+
coordinates: [109, 32]
163+
},
164+
count: 111
165+
}];
166+
167+
mapvLayer.setData(new DataSet(data));
168+
mapvLayer.removeData(() => {
169+
return true
170+
});
162171
setTimeout(() => {
163-
expect(mapvLayer.dataSet._data.length).toEqual(999);
172+
var data = mapvLayer.dataSet.get();
173+
expect(data).not.toBeNull();
174+
expect(data.length).toBe(0);
164175
done();
165-
}, 5000);
176+
}, 2000);
166177
});
167178

179+
168180
xit('setMap', () => {
169181
mapvLayer.setMap(map);
170182
expect(mapvLayer).not.toBeNull();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy