Skip to content

Commit 1f8838a

Browse files
committed
【fix】UT
1 parent 217e41d commit 1f8838a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

test/mapboxgl/mapping/WebMapV2Spec.js

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

test/tool/mock_mapboxgl_map.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const Map = function (options) {
3333
this._sources = {};
3434
this._collectResourceTiming = !!this.options.collectResourceTiming;
3535
this.zoom = this.options.zoom || 0;
36+
this.maxZoom = this.options.maxZoom || 22;
3637
this._container = this.options.container || 'map';
3738
this._layers = {};
3839
this._layersList = [];
@@ -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'
@@ -142,6 +143,12 @@ const Map = function (options) {
142143
layers: this._layersList
143144
};
144145
};
146+
this.getMaxZoom = function () {
147+
return this.maxZoom;
148+
};
149+
this.setMaxZoom = function (zoom) {
150+
this.maxZoom = zoom ;
151+
};
145152

146153
this.getContainer = function () {
147154
const container = {
@@ -291,9 +298,6 @@ const Map = function (options) {
291298
this.getMinZoom = function () {
292299
return 0;
293300
};
294-
this.getMaxZoom = function () {
295-
return 22;
296-
};
297301
this.doubleClickZoom = {
298302
disable: function () {},
299303
enable: function () {}

0 commit comments

Comments
 (0)