MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / callback

Function callback

test/mapboxgl/mapping/WebMapSpec.js:1132–1189  ·  view source on GitHub ↗
({ map: map1 })

Source from the content-addressed store, hash-verified

1130 commonMapOptions
1131 );
1132 const callback = function ({ map: map1 }) {
1133 let zoom = datavizWebmap.mapOptions.zoom;
1134 let center = datavizWebmap.mapOptions.center;
1135 expect(zoom).toBe(commonMapOptions.zoom);
1136 expect(center).toEqual(commonMapOptions.center);
1137 datavizWebmap.setStyle({});
1138 expect(datavizWebmap.webMapInfo).toBeFalsy();
1139 expect(datavizWebmap.mapOptions.zoom).toBeNull();
1140 expect(datavizWebmap.mapOptions.center).toBeNull();
1141 datavizWebmap.once('mapcreatesucceeded', ({ map }) => {
1142 center = [116, 30];
1143 zoom = 16;
1144 datavizWebmap.setCenter(center);
1145 expect(datavizWebmap.mapOptions.center).toEqual(center);
1146 datavizWebmap.setZoom(zoom);
1147 expect(datavizWebmap.mapOptions.zoom).toBe(zoom);
1148 datavizWebmap.setMapId('');
1149 datavizWebmap.setStyle({
1150 version: 8,
1151 sources: {
1152 source1: {
1153 type: 'raster',
1154 tileSize: 256,
1155 tiles: ['base/resources/img/baiduTileTest.png']
1156 }
1157 },
1158 layers: [
1159 {
1160 id: 'layer1',
1161 type: 'raster',
1162 source: 'source1',
1163 minzoom: 0,
1164 maxzoom: 22
1165 }
1166 ]
1167 });
1168 expect(datavizWebmap.webMapInfo).toBeFalsy();
1169 expect(datavizWebmap.mapOptions.zoom).toBe(zoom);
1170 expect(datavizWebmap.mapOptions.center).toEqual(center);
1171 datavizWebmap.map = map;
1172 spyOn( map, 'setCRS');
1173 spyOn(map, 'getCRS').and.callFake((crs) => {
1174 if (crs === 'EPSG:4326') {
1175 return crs;
1176 }
1177 return null;
1178 });
1179 datavizWebmap.setCRS('EPSG:3857');
1180 expect(map.setCRS).toHaveBeenCalled();
1181 datavizWebmap.map = null;
1182 datavizWebmap.once('mapcreatesucceeded', ({ map: map2, layers }) => {
1183 expect(map2).not.toEqual(map1);
1184 expect(datavizWebmap.webMapInfo).toBeFalsy();
1185 expect(layers.length).toBe(1);
1186 done();
1187 });
1188 });
1189 };

Callers 13

WebMapV22Spec.jsFile · 0.70
MapFunction · 0.50
onMethod · 0.50
MapFunction · 0.50
getImageFunction · 0.50
getImage$1Function · 0.50
doneFunction · 0.50
animateToFunction · 0.50
doneFunction · 0.50
animateToFunction · 0.50
common.jsFile · 0.50
initializeI18NFunction · 0.50

Calls 15

expectFunction · 0.85
spyOnFunction · 0.85
getWebMapTypeMethod · 0.80
doneFunction · 0.50
setStyleMethod · 0.45
onceMethod · 0.45
setCenterMethod · 0.45
setZoomMethod · 0.45
setMapIdMethod · 0.45
setCRSMethod · 0.45
getLayersMethod · 0.45
getStyleMethod · 0.45

Tested by

no test coverage detected