| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 329e6ea commit 9ebd7d8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,6 +141,7 @@ describe('WebMapV2 - addLocalIdeographFontFamily', () => { | |||
| 141 | 141 | await inst._createMap(mapInfo); | |
| 142 | 142 | expect(capturedOptions).toBeDefined(); | |
| 143 | 143 | expect(capturedOptions.localIdeographFontFamily).toBe('sans-serif,微软雅黑,supermapol-icons'); | |
| 144 | + await inst.clean(false); | ||
| 144 | 145 | }); | |
| 145 | 146 | }); | |
| 146 | 147 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,11 @@ | |||
| 1 | 1 | import mapboxgl from 'mapbox-gl'; | |
| 2 | 2 | import mbglmap, { CRS, proj4, revertCRS } from '../../tool/mock_mapboxgl_map'; | |
| 3 | 3 | import { WebMap } from '../../../src/mapboxgl/mapping/WebMap'; | |
| 4 | + import { createWebMapV2Extending } from '../../../src/common/mapping/WebMapV2'; | ||
| 5 | + import { createWebMapV2BaseExtending } from '../../../src/common/mapping/WebMapV2Base'; | ||
| 6 | + import { createMapClassExtending } from '../../../src/common/mapping/MapBase'; | ||
| 7 | + import { CRSManager } from '../../../src/mapboxgl/mapping/webmap/CRSManager'; | ||
| 8 | + import { GraticuleLayer } from '../../../src/mapboxgl/overlay/GraticuleLayer'; | ||
| 4 | 9 | import * as MapManagerUtil from '../../../src/mapboxgl/mapping/webmap/MapManager'; | |
| 5 | 10 | import { ArrayStatistic } from '../../../src/common/util/ArrayStatistic'; | |
| 6 | 11 | import { FetchRequest } from '../../../src/common/util/FetchRequest'; | |
@@ -141,6 +146,20 @@ function DataFlowService(serviceUrl) { | |||
| 141 | 146 | }; | |
| 142 | 147 | } | |
| 143 | 148 | ||
| 149 | + function createMapboxWebMapV2Factory() { | ||
| 150 | + const crsManager = new CRSManager(); | ||
| 151 | + return createWebMapV2Extending( | ||
| 152 | + createWebMapV2BaseExtending(createMapClassExtending(mapboxgl.Evented), 'fire'), | ||
| 153 | + { | ||
| 154 | + MapManager: MapManagerUtil.default, | ||
| 155 | + mapRepo: mapboxgl, | ||
| 156 | + crsManager, | ||
| 157 | + DataFlowService: DataFlowServiceUtil.DataFlowService, | ||
| 158 | + GraticuleLayer | ||
| 159 | + } | ||
| 160 | + ); | ||
| 161 | + } | ||
| 162 | + | ||
| 144 | 163 | describe('mapboxgl_WebMapV2', () => { | |
| 145 | 164 | var originalTimeout, testDiv; | |
| 146 | 165 | var server = 'http://fack:8190/iportal/'; | |
@@ -336,7 +355,16 @@ describe('mapboxgl_WebMapV2', () => { | |||
| 336 | 355 | }); | |
| 337 | 356 | afterEach(() => { | |
| 338 | 357 | if (datavizWebmap) { | |
| 339 | - datavizWebmap.clean(); | ||
| 358 | + if (datavizWebmap._handler) { | ||
| 359 | + if (datavizWebmap._handler._sendMapToUser) { | ||
| 360 | + spyOn(datavizWebmap._handler, '_sendMapToUser').and.stub(); | ||
| 361 | + } | ||
| 362 | + datavizWebmap._handler.clean(false); | ||
| 363 | + datavizWebmap._handler = null; | ||
| 364 | + } | ||
| 365 | + if (datavizWebmap.map) { | ||
| 366 | + datavizWebmap.clean(); | ||
| 367 | + } | ||
| 340 | 368 | datavizWebmap.map = null; | |
| 341 | 369 | datavizWebmap = null; | |
| 342 | 370 | } | |
@@ -4619,8 +4647,7 @@ it('add rangeLayer last end === fieldValue', (done) => { | |||
| 4619 | 4647 | }); | |
| 4620 | 4648 | ||
| 4621 | 4649 | it('_getLabelFontFamily should collect labelStyle fontFamily', () => { | |
| 4622 | - datavizWebmap = new WebMap('', { ...commonOption }); | ||
| 4623 | - const WebMapV2 = datavizWebmap._createWebMapFactory('WebMap2'); | ||
| 4650 | + const WebMapV2 = createMapboxWebMapV2Factory(); | ||
| 4624 | 4651 | const webMapV2 = new WebMapV2('', commonOption, { crs: 'EPSG:3857' }); | |
| 4625 | 4652 | const mapInfo = { | |
| 4626 | 4653 | layers: [ | |
@@ -4632,8 +4659,7 @@ it('add rangeLayer last end === fieldValue', (done) => { | |||
| 4632 | 4659 | }); | |
| 4633 | 4660 | ||
| 4634 | 4661 | it('initializeMap should call addLocalIdeographFontFamily when appending to existing map', async () => { | |
| 4635 | - datavizWebmap = new WebMap('', { ...commonOption }); | ||
| 4636 | - const WebMapV2 = datavizWebmap._createWebMapFactory('WebMap2'); | ||
| 4662 | + const WebMapV2 = createMapboxWebMapV2Factory(); | ||
| 4637 | 4663 | const webMapV2 = new WebMapV2('', commonOption, { crs: 'EPSG:3857' }); | |
| 4638 | 4664 | spyOn(webMapV2, '_registerMapCRS').and.returnValue(Promise.resolve('EPSG:3857')); | |
| 4639 | 4665 | spyOn(webMapV2, '_loadLayers'); | |
@@ -4647,5 +4673,6 @@ it('add rangeLayer last end === fieldValue', (done) => { | |||
| 4647 | 4673 | await webMapV2.initializeMap(mapInfo, map); | |
| 4648 | 4674 | expect(webMapV2._appendLayers).toBe(true); | |
| 4649 | 4675 | expect(map.addLocalIdeographFontFamily).toHaveBeenCalledWith('sans-serif,微软雅黑,supermapol-icons'); | |
| 4676 | + webMapV2.clean(false); | ||
| 4650 | 4677 | }); | |
| 4651 | 4678 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments