@@ -4146,7 +4146,6 @@ describe('mapboxgl_WebMapV2', () => {
41464146 server : server
41474147 } ) ;
41484148 const callback = function ( ) {
4149- console . log ( datavizWebmap ) ;
41504149 const popupInfo = datavizWebmap . getPopupInfos ( ) ;
41514150 const data = [
41524151 {
@@ -4264,7 +4263,7 @@ describe('mapboxgl_WebMapV2', () => {
42644263 }
42654264 ] ,
42664265 title : '北京市(3)' ,
4267- id : '北京市(3)'
4266+ layerId : '北京市(3)'
42684267 } ,
42694268 {
42704269 elements : [
@@ -4278,7 +4277,103 @@ describe('mapboxgl_WebMapV2', () => {
42784277 }
42794278 ] ,
42804279 title : '北京市轨道交通线路-打印(3)' ,
4281- id : '北京市轨道交通线路-打印(3)'
4280+ layerId : '北京市轨道交通线路-打印(3)'
4281+ }
4282+ ] ;
4283+ expect ( popupInfo ) . toEqual ( data ) ;
4284+ done ( ) ;
4285+ } ;
4286+ datavizWebmap . on ( 'mapcreatesucceeded' , callback ) ;
4287+ datavizWebmap . on ( 'map' ) ;
4288+ } ) ;
4289+ it ( 'webmap2.0 popupinfo 没有配置弹窗' , ( done ) => {
4290+ spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
4291+ if ( url . indexOf ( 'map.json' ) > - 1 ) {
4292+ return Promise . resolve ( new Response ( JSON . stringify ( Webmap2_popupInfo_no ) ) ) ;
4293+ } else if ( url . indexOf ( '1168691327/content.json?' ) > - 1 ) {
4294+ return Promise . resolve ( new Response ( JSON . stringify ( chart_content ) ) ) ;
4295+ } else if ( url . indexOf ( '1371715657/content.json?' ) > - 1 ) {
4296+ return Promise . resolve ( new Response ( JSON . stringify ( layerData_geojson [ 'POINT_GEOJSON' ] ) ) ) ;
4297+ } else if ( url . indexOf ( 'portal.json' ) > - 1 ) {
4298+ return Promise . resolve ( new Response ( JSON . stringify ( iportal_serviceProxy ) ) ) ;
4299+ }
4300+ return Promise . resolve ( new Response ( JSON . stringify ( { } ) ) ) ;
4301+ } ) ;
4302+ datavizWebmap = new WebMap ( '123' , {
4303+ server : server
4304+ } ) ;
4305+ const callback = function ( ) {
4306+ const popupInfo = datavizWebmap . getPopupInfos ( ) ;
4307+ const data = [
4308+ {
4309+ elements : [
4310+ {
4311+ type : 'FIELD' ,
4312+ fieldName : 'parent' ,
4313+ fieldCaption : 'parent3121'
4314+ } ,
4315+ {
4316+ type : 'FIELD' ,
4317+ fieldName : 'adcode' ,
4318+ fieldCaption : 'adcode'
4319+ } ,
4320+ {
4321+ type : 'FIELD' ,
4322+ fieldName : 'level' ,
4323+ fieldCaption : 'level'
4324+ } ,
4325+ {
4326+ type : 'FIELD' ,
4327+ fieldName : 'childrenNum' ,
4328+ fieldCaption : 'childrenNum'
4329+ } ,
4330+ {
4331+ type : 'FIELD' ,
4332+ fieldName : 'smpid' ,
4333+ fieldCaption : 'smpid'
4334+ } ,
4335+ {
4336+ type : 'FIELD' ,
4337+ fieldName : 'centroid' ,
4338+ fieldCaption : 'centroid'
4339+ } ,
4340+ {
4341+ type : 'FIELD' ,
4342+ fieldName : 'center' ,
4343+ fieldCaption : 'center'
4344+ } ,
4345+ {
4346+ type : 'FIELD' ,
4347+ fieldName : 'subFeatureIndex' ,
4348+ fieldCaption : 'subFeatureIndex'
4349+ } ,
4350+ {
4351+ type : 'FIELD' ,
4352+ fieldName : 'name' ,
4353+ fieldCaption : 'name'
4354+ } ,
4355+ {
4356+ type : 'FIELD' ,
4357+ fieldName : 'acroutes' ,
4358+ fieldCaption : 'acroutes'
4359+ }
4360+ ] ,
4361+ layerId : '北京市(3)' ,
4362+ title : '北京市(3)'
4363+ } ,
4364+ {
4365+ elements : [
4366+ {
4367+ fieldName : 'SmID' ,
4368+ type : 'FIELD'
4369+ } ,
4370+ {
4371+ fieldName : '标准名称' ,
4372+ type : 'FIELD'
4373+ }
4374+ ] ,
4375+ title : '北京市轨道交通线路-打印(3)' ,
4376+ layerId : '北京市轨道交通线路-打印(3)'
42824377 }
42834378 ] ;
42844379 expect ( popupInfo ) . toEqual ( data ) ;
0 commit comments