Skip to content

Commit 588ffcd

Browse files
committed
【fix】UT
1 parent 6531d1e commit 588ffcd

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
@@ -202,7 +202,11 @@ describe('maplibregl_WebMapV2', () => {
202202
getZoom: () => {
203203
return 2;
204204
},
205+
getMaxZoom: () => {
206+
return 22;
207+
},
205208
setZoom: jasmine.createSpy('setZoom').and.callFake(() => {}),
209+
setMaxZoom: jasmine.createSpy('setMaxZoom').and.callFake(() => {}),
206210
setCRS: jasmine.createSpy('setCRS').and.callFake(() => {}),
207211
getCenter: () => {
208212
return {

test/tool/mock_maplibregl_map.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const Map = function (options) {
3333
this.zoom = this.options.zoom || 0;
3434
this._container = this.options.container || 'map';
3535
this._layers = {};
36+
this.maxZoom = 22;
3637
this._layersList = [];
3738
this.getContainer = function () {
3839
return this._container;
@@ -94,7 +95,7 @@ const Map = function (options) {
9495
// Settings
9596
'setMaxBounds',
9697
'setMinZoom',
97-
'setMaxZoom',
98+
// 'setMaxZoom',
9899
// Layer properties
99100
'setLayoutProperty',
100101
'setPaintProperty'
@@ -279,7 +280,10 @@ const Map = function (options) {
279280
return 0;
280281
};
281282
this.getMaxZoom = function () {
282-
return 22;
283+
return this.maxZoom || 22;
284+
};
285+
this.setMaxZoom = function (maxZoom) {
286+
this.maxZoom = maxZoom;
283287
};
284288
this.doubleClickZoom = {
285289
disable: function () {},

0 commit comments

Comments
 (0)