Skip to content

Commit 42bc145

Browse files
committed
【ut】add
1 parent ee0d3bf commit 42bc145

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test/mapboxgl/mapping/WebMapV3Spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,27 @@ describe('mapboxgl-webmap3.0', () => {
10221022
});
10231023
});
10241024

1025+
it('changeBaseLayer should delegate to handler', () => {
1026+
spyOn(WebMap.prototype, '_initWebMap').and.stub();
1027+
mapstudioWebmap = new WebMap(id, {
1028+
server: server
1029+
});
1030+
const layerInfo = {
1031+
id: 'base-layer-1',
1032+
title: 'Base Layer'
1033+
};
1034+
const expected = { id: 'base-layer-2' };
1035+
const changeBaseLayerSpy = jasmine.createSpy('changeBaseLayer').and.returnValue(expected);
1036+
mapstudioWebmap._handler = {
1037+
changeBaseLayer: changeBaseLayerSpy
1038+
};
1039+
1040+
const result = mapstudioWebmap.changeBaseLayer(layerInfo);
1041+
1042+
expect(changeBaseLayerSpy).toHaveBeenCalledWith(layerInfo);
1043+
expect(result).toBe(expected);
1044+
});
1045+
10251046
it('test group', (done) => {
10261047
spyOn(FetchRequest, 'get').and.callFake((url) => {
10271048
if (url.indexOf('/sprite') > -1) {

0 commit comments

Comments
 (0)