@@ -1382,8 +1382,6 @@ describe('mapboxgl_WebMapV2', () => {
1382
1382
datavizWebmap . on ( 'mapcreatesucceeded' , callback ) ;
1383
1383
} ) ;
1384
1384
1385
-
1386
-
1387
1385
it ( 'updateOverlayLayer unique' , ( done ) => {
1388
1386
spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
1389
1387
if ( url . indexOf ( 'portal.json' ) > - 1 ) {
@@ -1492,7 +1490,7 @@ describe('mapboxgl_WebMapV2', () => {
1492
1490
} ) ;
1493
1491
} ) ;
1494
1492
1495
- it ( 'add zxytile layer' , ( done ) => {
1493
+ it ( 'add zxytile layer 3857全球剖分 ' , ( done ) => {
1496
1494
spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
1497
1495
if ( url . indexOf ( 'portal.json' ) > - 1 ) {
1498
1496
return Promise . resolve ( new Response ( JSON . stringify ( iportal_serviceProxy ) ) ) ;
@@ -1522,6 +1520,36 @@ describe('mapboxgl_WebMapV2', () => {
1522
1520
} ) ;
1523
1521
} ) ;
1524
1522
1523
+ it ( 'add zxytile layer 4326 world' , ( done ) => {
1524
+ spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
1525
+ if ( url . indexOf ( 'portal.json' ) > - 1 ) {
1526
+ return Promise . resolve ( new Response ( JSON . stringify ( iportal_serviceProxy ) ) ) ;
1527
+ } else if ( url . indexOf ( '/map.json' ) > - 1 ) {
1528
+ return Promise . resolve ( new Response ( datavizWebmap_ZXYTILE_4326 ) ) ;
1529
+ }
1530
+ return Promise . resolve ( new Response ( JSON . stringify ( { } ) ) ) ;
1531
+ } ) ;
1532
+ datavizWebmap = new WebMap (
1533
+ 'test' ,
1534
+ {
1535
+ target : 'map' ,
1536
+ serverUrl : 'http://fake/fakeiportal' ,
1537
+ withCredentials : false
1538
+ } ,
1539
+ {
1540
+ style : {
1541
+ version : 8 ,
1542
+ sources : { } ,
1543
+ layers : [ ]
1544
+ }
1545
+ }
1546
+ ) ;
1547
+ datavizWebmap . on ( 'mapcreatesucceeded' , ( { layers } ) => {
1548
+ expect ( layers . length ) . toBe ( 2 ) ;
1549
+ done ( ) ;
1550
+ } ) ;
1551
+ } ) ;
1552
+
1525
1553
it ( 'isvj-5215' , ( done ) => {
1526
1554
spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
1527
1555
if ( url . indexOf ( 'portal.json' ) > - 1 ) {
@@ -2683,28 +2711,69 @@ describe('mapboxgl_WebMapV2', () => {
2683
2711
} ) ;
2684
2712
} ) ;
2685
2713
2686
- it ( 'initial_xyzLayer' , ( done ) => {
2714
+ it ( 'initial_xyzLayer 3857全球剖分 ' , ( done ) => {
2687
2715
spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
2688
2716
if ( url . indexOf ( 'map.json' ) > - 1 ) {
2689
2717
return Promise . resolve ( new Response ( JSON . stringify ( xyzLayer ) ) ) ;
2690
2718
} else if ( url . indexOf ( 'portal.json' ) > - 1 ) {
2691
2719
return Promise . resolve ( new Response ( JSON . stringify ( iportal_serviceProxy ) ) ) ;
2692
2720
}
2693
- return Promise . resolve ( ) ;
2721
+ return Promise . resolve ( new Response ( JSON . stringify ( { } ) ) ) ;
2694
2722
} ) ;
2695
2723
datavizWebmap = new WebMap ( id , {
2696
2724
server : server
2697
2725
} ) ;
2698
2726
datavizWebmap . on ( 'mapcreatesucceeded' , ( { map } ) => {
2699
2727
const layers = map . getStyle ( ) . layers ;
2700
- expect ( layers . length ) . toBe ( 1 ) ;
2728
+ expect ( layers . length ) . toBe ( 2 ) ;
2701
2729
const xyzLayer = layers [ 0 ] ;
2702
2730
expect ( xyzLayer . id ) . toBe ( 'OpenStreetMap' ) ;
2703
2731
expect ( xyzLayer . type ) . toBe ( 'raster' ) ;
2732
+ const xyzLayer1 = layers [ 1 ] ;
2733
+ expect ( xyzLayer1 . id ) . toBe ( 'xyz' ) ;
2734
+ expect ( xyzLayer1 . type ) . toBe ( 'raster' ) ;
2735
+ done ( ) ;
2736
+ } ) ;
2737
+ } ) ;
2738
+ it ( 'initial_xyzLayer world 4326' , ( done ) => {
2739
+ spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
2740
+ if ( url . indexOf ( 'map.json' ) > - 1 ) {
2741
+ return Promise . resolve ( new Response ( JSON . stringify ( xyzLayer4326 ) ) ) ;
2742
+ } else if ( url . indexOf ( 'portal.json' ) > - 1 ) {
2743
+ return Promise . resolve ( new Response ( JSON . stringify ( iportal_serviceProxy ) ) ) ;
2744
+ }
2745
+ return Promise . resolve ( new Response ( JSON . stringify ( { } ) ) ) ;
2746
+ } ) ;
2747
+ datavizWebmap = new WebMap ( id , {
2748
+ server : server
2749
+ } ) ;
2750
+ datavizWebmap . on ( 'mapcreatesucceeded' , ( { map } ) => {
2751
+ const layers = map . getStyle ( ) . layers ;
2752
+ expect ( layers . length ) . toBe ( 2 ) ;
2753
+ const xyzLayer = layers [ 1 ] ;
2754
+ expect ( xyzLayer . id ) . toBe ( 'mapboxgl-256x2' ) ;
2755
+ expect ( xyzLayer . type ) . toBe ( 'raster' ) ;
2756
+ done ( ) ;
2757
+ } ) ;
2758
+ } ) ;
2759
+ it ( 'initial_xyzLayer jingjin 4326' , ( done ) => {
2760
+ spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
2761
+ if ( url . indexOf ( 'map.json' ) > - 1 ) {
2762
+ return Promise . resolve ( new Response ( JSON . stringify ( xyzLayerjingjin4326 ) ) ) ;
2763
+ } else if ( url . indexOf ( 'portal.json' ) > - 1 ) {
2764
+ return Promise . resolve ( new Response ( JSON . stringify ( iportal_serviceProxy ) ) ) ;
2765
+ }
2766
+ return Promise . resolve ( ) ;
2767
+ } ) ;
2768
+ datavizWebmap = new WebMap ( id , {
2769
+ server : server
2770
+ } ) ;
2771
+ datavizWebmap . on ( 'xyztilelayernotsupport' , ( e ) => {
2772
+ expect ( e . error ) . toBe ( `The resolutions or origin of layer jingjin on XYZ Tile does not match the map` ) ;
2773
+ expect ( e . error_code ) . toBe ( `XYZ_TILE_LAYER_NOT_SUPPORTED` ) ;
2704
2774
done ( ) ;
2705
2775
} ) ;
2706
2776
} ) ;
2707
-
2708
2777
it ( 'initial_mapboxstyleLayer' , ( done ) => {
2709
2778
spyOn ( FetchRequest , 'get' ) . and . callFake ( ( url ) => {
2710
2779
if ( url . indexOf ( 'map.json' ) > - 1 ) {
0 commit comments