diff --git a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js index dfdd58c0..3819c7c1 100644 --- a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js +++ b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js @@ -60,8 +60,15 @@ const commonMap = { getPitch: () => 2, setPitch: () => jest.fn(), getStyle: () => { + let layers = []; + if (layerIdMapList) { + for (const key in layerIdMapList) { + layers.push(layerIdMapList[key]); + } + } return { - sources: sourceIdMapList + sources: sourceIdMapList, + layers }; }, addSource: (sourceId, sourceInfo) => { @@ -421,6 +428,23 @@ describe('WebMapViewModel.spec', () => { viewModel.on({ addlayerssucceeded: callback }); }); + it('add markerLayer layerOrder correctly', done => { + const fetchResource = { + 'https://fakeiportal.supermap.io/iportal/web/datas/123456/content.json?pageSize=9999999¤tPage=1&parentResType=MAP&parentResId=undefined': + layerData_geojson['MARKER_GEOJSON'] + }; + mockFetch(fetchResource); + const id = markerLayer; + const callback = function (data) { + expect(data.layers.length).toBe(id.layers.length); + const layers = data.map.getStyle().layers; + expect(layers[layers.length - 2].id).toBe('POLYGON-6-strokeLine'); + done(); + }; + const viewModel = new WebMapViewModel(id, { ...commonOption }, { ...commonMapOptions }, { ...commonMap }); + viewModel.on({ addlayerssucceeded: callback }); + }); + it('markerLayer url is error', done => { const newLayerData_geojson = { ...layerData_geojson['MARKER_GEOJSON'],