diff --git a/test/mapboxgl/mapping/WebMapV2Spec.js b/test/mapboxgl/mapping/WebMapV2Spec.js index 209fb0947..993363fe0 100644 --- a/test/mapboxgl/mapping/WebMapV2Spec.js +++ b/test/mapboxgl/mapping/WebMapV2Spec.js @@ -1414,39 +1414,7 @@ describe('mapboxgl_WebMapV2', () => { datavizWebmap.on('mapcreatesucceeded', callback); }); - xit('updateOverlayLayer featureProjection', (done) => { - spyOn(FetchRequest, 'get').and.callFake((url) => { - if (url.indexOf('portal.json') > -1) { - return Promise.resolve(new Response(JSON.stringify(iportal_serviceProxy))); - } else if (url.indexOf('1788054202/map.json') > -1) { - uniqueLayer_polygon.layers.map(item => { - item.projection='EPSG:3857' - }) - return Promise.resolve(new Response(JSON.stringify(uniqueLayer_polygon))); - } else if (url.indexOf('datas/1960447494/content.json') > -1) { - return Promise.resolve(new Response(layerData_CSV)); - } else if (url.indexOf('datas/144371940/content.json')) { - return Promise.resolve(new Response(JSON.stringify(layerData_geojson['LINE_GEOJSON']))); - } - }); - datavizWebmap = new WebMap(id, { ...commonOption, map: commonMap }, { ...commonMapOptions }); - - const callback = function (data) { - const spy = spyOn(datavizWebmap._handler, 'transformFeatures').and.callThrough(); - datavizWebmap.updateOverlayLayer( - { id: uniqueLayer_polygon.layers[0].name, projection: 'EPSG:3857' }, - { - type: 'FeatureCollection', - features: [{ type: 'Feature', geometry: { type: 'Point', coordinates: [110, 10] }, properties: {} }] - }, - '', - 'EPSG:4326' - ); - expect(spy).not.toHaveBeenCalled(); - done(); - }; - datavizWebmap.on('mapcreatesucceeded', callback); - }); + it('updateOverlayLayer unique', (done) => { spyOn(FetchRequest, 'get').and.callFake((url) => { @@ -3221,4 +3189,36 @@ describe('mapboxgl_WebMapV2', () => { }); }); }); + + it('updateOverlayLayer featureProjection', (done) => { + spyOn(FetchRequest, 'get').and.callFake((url) => { + if (url.indexOf('map.json') > -1) { + webmap_rangeLayer.layers.map(item => { + item.projection = 'EPSG:3857'; + }); + return Promise.resolve(new Response(JSON.stringify(webmap_rangeLayer))); + } else if (url.indexOf('content.json') > -1) { + return Promise.resolve(new Response(JSON.stringify(chart_content))); + } else if (url.indexOf('portal.json') > -1) { + return Promise.resolve(new Response(JSON.stringify(iportal_serviceProxy))); + } else if (url.indexOf('ChinaDark.json') > -1) { + return Promise.resolve(new Response(JSON.stringify({}))); + } + return Promise.resolve(new Response(JSON.stringify({}))); + }); + datavizWebmap = new WebMap(id, { + server: server + }); + datavizWebmap.on('mapcreatesucceeded', ({ map }) => { + const spy = spyOn(datavizWebmap._handler, 'transformFeatures').and.callThrough(); + datavizWebmap.updateOverlayLayer( + { id: webmap_rangeLayer.layers[0].name }, + [{ type: 'Feature', geometry: { type: 'Point', coordinates: [110, 10] }, properties: {} }], + '', + 'EPSG:4326' + ); + expect(spy).not.toHaveBeenCalled(); + done(); + }); + }); });