Skip to content

Commit b34eb2a

Browse files
committed
【update】 fix webmap UT review by songym
1 parent e125458 commit b34eb2a

File tree

3 files changed

+4
-65
lines changed

3 files changed

+4
-65
lines changed

src/mapboxgl/mapping/WebMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export class WebMap extends mapboxgl.Evented {
362362
let labelUrl = tiandituUrls['labelUrl'];
363363
let tiandituUrl = tiandituUrls['tiandituUrl'];
364364
this._addBaselayer(tiandituUrl, 'tianditu-layers-' + layerType);
365-
isLabel && this._addBaselayer([labelUrl], 'tianditu-label-layers-' + layerType);
365+
isLabel && this._addBaselayer(labelUrl, 'tianditu-label-layers-' + layerType);
366366
}
367367

368368
/**

test/mapboxgl/mapping/WebMapSpec.js

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ describe('mapboxgl_WebMap', () => {
5454
expect(+center.lng.toFixed(4)).toEqual(110);
5555
expect(datavizWebmap.mapParams.title).toBe('tianditu');
5656
expect(datavizWebmap.mapParams.description).toBe('');
57-
datavizWebmap.map = null;
58-
datavizWebmap = null;
5957
done();
6058
}, 1000)
6159
});
@@ -74,8 +72,6 @@ describe('mapboxgl_WebMap', () => {
7472
var datavizWebmap = new WebMap(id, options);
7573
setTimeout(() => {
7674
datavizWebmap.resize();
77-
datavizWebmap.map = null;
78-
datavizWebmap = null;
7975
done();
8076
},1000);
8177
});
@@ -94,8 +90,6 @@ describe('mapboxgl_WebMap', () => {
9490
setTimeout(() => {
9591
datavizWebmap.setMapId('testID');
9692
expect(datavizWebmap.mapId).toEqual('testID');
97-
datavizWebmap.map = null;
98-
datavizWebmap = null;
9993
done();
10094
},1000);
10195
});
@@ -114,8 +108,6 @@ describe('mapboxgl_WebMap', () => {
114108
setTimeout(() => {
115109
datavizWebmap.setWebMapOptions({ server: 'http://www.test.com' });
116110
expect(datavizWebmap.server).toEqual('http://www.test.com/');
117-
datavizWebmap.map = null;
118-
datavizWebmap = null;
119111
done();
120112
},1000);
121113
});
@@ -139,8 +131,6 @@ describe('mapboxgl_WebMap', () => {
139131
};
140132
setTimeout(() => {
141133
datavizWebmap.setMapOptions(mapOptions);
142-
datavizWebmap.map = null;
143-
datavizWebmap = null;
144134
done();
145135
},1000);
146136
});
@@ -167,8 +157,6 @@ describe('mapboxgl_WebMap', () => {
167157
expect(map.getZoom()).toBe(1);
168158
expect(datavizWebmap.mapParams.title).toBe('image_tianditu');
169159
expect(datavizWebmap.mapParams.description).toBe('This is a image');
170-
datavizWebmap.map = null;
171-
datavizWebmap = null;
172160
done();
173161
}, 1000)
174162
});
@@ -188,8 +176,6 @@ describe('mapboxgl_WebMap', () => {
188176

189177
setTimeout(() => {
190178
expect(datavizWebmap.mapParams.description).toBe('tianditu_ter');
191-
datavizWebmap.map = null;
192-
datavizWebmap = null;
193179
done();
194180
}, 1000)
195181
});
@@ -217,8 +203,6 @@ describe('mapboxgl_WebMap', () => {
217203
// expect(map.getCenter()).toEqual(new mapboxgl.LngLat(120.63222224999998, 30.389530096727963));
218204
expect(datavizWebmap.mapParams.title).toBe('openstreet');
219205
expect(datavizWebmap.mapParams.description).toBe('');
220-
datavizWebmap.map = null;
221-
datavizWebmap = null;
222206
done();
223207
}, 1000)
224208
});
@@ -236,8 +220,6 @@ describe('mapboxgl_WebMap', () => {
236220

237221
expect(datavizWebmap.credentialKey).toBeUndefined();
238222
expect(datavizWebmap.credentialValue).toBeUndefined();
239-
datavizWebmap.map = null;
240-
datavizWebmap = null;
241223
done();
242224
}, 1000)
243225
});
@@ -265,8 +247,6 @@ describe('mapboxgl_WebMap', () => {
265247
//expect(map.getCenter()).toEqual([0, -7.081154551613622e-10]);
266248
expect(datavizWebmap.mapParams.title).toBe('GAOD');
267249
expect(datavizWebmap.mapParams.description).toBe('');
268-
datavizWebmap.map = null;
269-
datavizWebmap = null;
270250
done();
271251
}, 1000)
272252
});
@@ -294,8 +274,6 @@ describe('mapboxgl_WebMap', () => {
294274
//expect(map.getCenter()).toEqual([0, -7.081154551613622e-10]);
295275
expect(datavizWebmap.mapParams.title).toBe('google_map');
296276
expect(datavizWebmap.mapParams.description).toBe('');
297-
datavizWebmap.map = null;
298-
datavizWebmap = null;
299277
done();
300278
}, 1000)
301279
});
@@ -319,8 +297,6 @@ describe('mapboxgl_WebMap', () => {
319297
expect(datavizWebmap.credentialValue).toBeUndefined();
320298
expect(datavizWebmap.mapParams.title).toBe('undefinedMap');
321299
expect(datavizWebmap.mapParams.description).toBe('');
322-
datavizWebmap.map = null;
323-
datavizWebmap = null;
324300
done();
325301
}, 1000)
326302
});
@@ -349,8 +325,6 @@ describe('mapboxgl_WebMap', () => {
349325
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(120.63222224999998, 30.389530096727963));
350326
expect(datavizWebmap.mapParams.title).toBe('theme_base');
351327
expect(datavizWebmap.mapParams.description).toBe('base style');
352-
datavizWebmap.map = null;
353-
datavizWebmap = null;
354328
done();
355329
}, 1000)
356330
});
@@ -379,8 +353,6 @@ describe('mapboxgl_WebMap', () => {
379353
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.39560889343755, 39.93917738600353));
380354
expect(datavizWebmap.mapParams.title).toBe('Line_basis');
381355
expect(datavizWebmap.mapParams.description).toBe('');
382-
datavizWebmap.map = null;
383-
datavizWebmap = null;
384356
done();
385357
}, 1000)
386358
});
@@ -420,8 +392,6 @@ describe('mapboxgl_WebMap', () => {
420392
var map = datavizWebmap.map;
421393
expect(map.getZoom()).toBe(6);
422394
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(120.63222224999998, 30.389530096727963));
423-
datavizWebmap.map = null;
424-
datavizWebmap = null;
425395
done();
426396
}, 5000)
427397
});
@@ -451,8 +421,6 @@ describe('mapboxgl_WebMap', () => {
451421
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.32442464111325, 39.98897628932847));
452422
expect(datavizWebmap.mapParams.title).toBe('Unique');
453423
expect(datavizWebmap.mapParams.description).toBe('');
454-
datavizWebmap.map = null;
455-
datavizWebmap = null;
456424
done();
457425
}, 1000)
458426
});
@@ -484,8 +452,6 @@ describe('mapboxgl_WebMap', () => {
484452
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.40097798513068, 39.900378604132094));
485453
expect(datavizWebmap.mapParams.title).toBe('RANGE_LABEL');
486454
expect(datavizWebmap.mapParams.description).toBe('');
487-
datavizWebmap.map = null;
488-
datavizWebmap = null;
489455
done();
490456
}, 1000)
491457
});
@@ -516,8 +482,6 @@ describe('mapboxgl_WebMap', () => {
516482
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(120.63222224999998, 30.389530096727963));
517483
expect(datavizWebmap.mapParams.title).toBe('Heat');
518484
expect(datavizWebmap.mapParams.description).toBe('');
519-
datavizWebmap.map = null;
520-
datavizWebmap = null;
521485
done();
522486
}, 1000)
523487
});
@@ -547,8 +511,6 @@ describe('mapboxgl_WebMap', () => {
547511
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(8.437500000000002, -7.710991655433243));
548512
expect(datavizWebmap.mapParams.title).toBe('标注图层');
549513
expect(datavizWebmap.mapParams.description).toBe('');
550-
datavizWebmap.map = null;
551-
datavizWebmap = null;
552514
done();
553515
}, 1000)
554516
});
@@ -582,8 +544,6 @@ describe('mapboxgl_WebMap', () => {
582544
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.46675928388001, 40.15816517545865));
583545
expect(datavizWebmap.mapParams.title).toBe('RestMap');
584546
expect(datavizWebmap.mapParams.description).toBe('');
585-
datavizWebmap.map = null;
586-
datavizWebmap = null;
587547
done();
588548
}, 1000)
589549
});
@@ -612,8 +572,6 @@ describe('mapboxgl_WebMap', () => {
612572
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.872606854085, 40.11626853496025));
613573
expect(datavizWebmap.mapParams.title).toBe('RestMap');
614574
expect(datavizWebmap.mapParams.description).toBe('restMap from jingjin');
615-
datavizWebmap.map = null;
616-
datavizWebmap = null;
617575
done();
618576
}, 1000)
619577
});
@@ -647,8 +605,6 @@ describe('mapboxgl_WebMap', () => {
647605
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(116.8995771532053, 39.700527641334965));
648606
expect(datavizWebmap.mapParams.title).toBe('RestData');
649607
expect(datavizWebmap.mapParams.description).toBe('');
650-
datavizWebmap.map = null;
651-
datavizWebmap = null;
652608
done();
653609
}, 1000)
654610
});
@@ -677,8 +633,6 @@ describe('mapboxgl_WebMap', () => {
677633
expect(map.getCenter()).toEqual(new mapboxgl.LngLat(0, 0));
678634
expect(datavizWebmap.mapParams.title).toBe('wms');
679635
expect(datavizWebmap.mapParams.description).toBe('');
680-
datavizWebmap.map = null;
681-
datavizWebmap = null;
682636
done();
683637
}, 1000)
684638
});
@@ -711,8 +665,6 @@ describe('mapboxgl_WebMap', () => {
711665
datavizWebmap._changeWeight(features, 'field');
712666
// expect(feature.get('weight')).toBe(1);
713667
done();
714-
datavizWebmap.map = null;
715-
datavizWebmap = null;
716668
}, 1000)
717669
});
718670

@@ -747,8 +699,6 @@ describe('mapboxgl_WebMap', () => {
747699
datavizWebmap._getRangeStyleGroup(JSON.parse(params), features);
748700
expect(ArrayStatistic.getArraySegments).toHaveBeenCalled();
749701
done();
750-
datavizWebmap.map = null;
751-
datavizWebmap = null;
752702
}, 1000)
753703
});
754704

@@ -771,8 +721,6 @@ describe('mapboxgl_WebMap', () => {
771721
expect(datavizWebmap._dashStyle(style[3]).length).toBe(2);
772722
expect(datavizWebmap._dashStyle(style[5]).length).toBe(2);
773723
expect(datavizWebmap._dashStyle(style[6]).length).toBe(4);
774-
datavizWebmap.map = null;
775-
datavizWebmap = null;
776724
done();
777725
})
778726
it('vector_svg', (done) => {
@@ -807,12 +755,9 @@ describe('mapboxgl_WebMap', () => {
807755
})
808756
})
809757
setTimeout(() => {
810-
811758
expect(datavizWebmap.credentialKey).toBeUndefined();
812759
expect(datavizWebmap.credentialValue).toBeUndefined();
813-
done();
814-
datavizWebmap.map = null;
815-
datavizWebmap = null;
760+
done();
816761
}, 1000)
817762
})
818763
it('vector_symbol', (done) => {
@@ -834,9 +779,7 @@ describe('mapboxgl_WebMap', () => {
834779

835780
expect(datavizWebmap.credentialKey).toBeUndefined();
836781
expect(datavizWebmap.credentialValue).toBeUndefined();
837-
done();
838-
datavizWebmap.map = null;
839-
datavizWebmap = null;
782+
done();
840783
}, 1000)
841784
})
842785
it('_getFiterFeatures', (done) => {
@@ -858,8 +801,6 @@ describe('mapboxgl_WebMap', () => {
858801

859802
expect(datavizWebmap.credentialKey).toBeUndefined();
860803
expect(datavizWebmap.credentialValue).toBeUndefined();
861-
datavizWebmap.map = null;
862-
datavizWebmap = null;
863804
done();
864805
}, 1000)
865806
})
@@ -881,8 +822,6 @@ describe('mapboxgl_WebMap', () => {
881822
setTimeout(() => {
882823
expect(datavizWebmap.credentialKey).toBeUndefined();
883824
expect(datavizWebmap.credentialValue).toBeUndefined();
884-
datavizWebmap.map = null;
885-
datavizWebmap = null;
886825
done();
887826
}, 1000)
888827
})

test/resources/WebMapV5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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