Skip to content

Commit c5eef5a

Browse files
committed
【fix】UT
1 parent 1f8838a commit c5eef5a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/maplibregl/mapping/WebMapV2Spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ describe('maplibregl_WebMapV2', () => {
203203
getZoom: () => {
204204
return 2;
205205
},
206+
getMaxZoom: () => {
207+
return 22;
208+
},
206209
setZoom: jasmine.createSpy('setZoom').and.callFake(() => {}),
210+
setMaxZoom: jasmine.createSpy('setMaxZoom').and.callFake(() => {}),
207211
setCRS: jasmine.createSpy('setCRS').and.callFake(() => {}),
208212
getCenter: () => {
209213
return {

test/tool/mock_maplibregl_map.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const Map = function (options) {
3535
this.zoom = this.options.zoom || 0;
3636
this._container = this.options.container || 'map';
3737
this._layers = {};
38+
this.maxZoom = 22;
3839
this._layersList = [];
3940
this.getContainer = function () {
4041
return this._container;
@@ -107,7 +108,7 @@ const Map = function (options) {
107108
// Settings
108109
'setMaxBounds',
109110
'setMinZoom',
110-
'setMaxZoom',
111+
// 'setMaxZoom',
111112
// Layer properties
112113
'setLayoutProperty',
113114
'setPaintProperty'
@@ -292,7 +293,10 @@ const Map = function (options) {
292293
return 0;
293294
};
294295
this.getMaxZoom = function () {
295-
return 22;
296+
return this.maxZoom || 22;
297+
};
298+
this.setMaxZoom = function (maxZoom) {
299+
this.maxZoom = maxZoom;
296300
};
297301
this.doubleClickZoom = {
298302
disable: function () {},

0 commit comments

Comments
 (0)