Skip to content

Commit 6531d1e

Browse files
committed
【fix】UT
1 parent 19172e2 commit 6531d1e

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

test/tool/mock_mapboxgl_map.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const Map = function (options) {
3131
this._sources = {};
3232
this._collectResourceTiming = !!this.options.collectResourceTiming;
3333
this.zoom = this.options.zoom || 0;
34+
this.maxZoom = this.options.maxZoom || 22;
3435
this._container = this.options.container || 'map';
3536
this._layers = {};
3637
this._layersList = [];
@@ -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'
@@ -129,6 +130,12 @@ const Map = function (options) {
129130
layers: this._layersList
130131
};
131132
};
133+
this.getMaxZoom = function () {
134+
return this.maxZoom;
135+
};
136+
this.setMaxZoom = function (zoom) {
137+
this.maxZoom = zoom ;
138+
};
132139

133140
this.getContainer = function () {
134141
const container = {
@@ -278,9 +285,6 @@ const Map = function (options) {
278285
this.getMinZoom = function () {
279286
return 0;
280287
};
281-
this.getMaxZoom = function () {
282-
return 22;
283-
};
284288
this.doubleClickZoom = {
285289
disable: function () {},
286290
enable: function () {}

0 commit comments

Comments
 (0)