forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapExtendSpec.js
More file actions
54 lines (52 loc) · 1.56 KB
/
MapExtendSpec.js
File metadata and controls
54 lines (52 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import mapboxgl from 'mapbox-gl';
import '../../../src/mapboxgl/core/MapExtend';
import { L7Layer } from '../../../src/mapboxgl/overlay';
describe('MapExtend', () => {
var url = 'http://supermapiserver:8090/iserver/services/map-china400/rest/maps/China';
var testDiv, map;
beforeAll(() => {
testDiv = document.createElement('div');
testDiv.setAttribute('id', 'map');
testDiv.style.styleFloat = 'left';
testDiv.style.marginLeft = '8px';
testDiv.style.marginTop = '50px';
testDiv.style.width = '500px';
testDiv.style.height = '500px';
document.body.appendChild(testDiv);
map = new mapboxgl.Map({
container: 'map',
style: {
version: 8,
sources: {
'raster-tiles': {
type: 'raster',
tiles: [url + '/zxyTileImage.png?z={z}&x={x}&y={y}'],
tileSize: 256
}
},
layers: [
{
id: 'simple-tiles',
type: 'raster',
source: 'raster-tiles',
minzoom: 0,
maxzoom: 22
}
]
},
center: [116.4, 39.79],
zoom: 3
});
});
afterAll(() => {
window.document.body.removeChild(testDiv);
map && map.remove();
});
it('listLayers', (done) => {
map.style._order = ['raster', 'fill-1', 'circle-1', 'l7_layer_1'];
map.overlayLayersManager = { l7_layer_1: { id: 'l7_layer_1' }, heatmap_1: { id: 'heatmap_1' } };
const layers = map.listLayers();
expect(layers).toEqual(['raster', 'fill-1', 'circle-1', 'l7_layer_1', 'heatmap_1']);
done();
});
});