Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xilanhuaweidapao committed Sep 30, 2024
1 parent 9f0a5c4 commit 7e9dacd
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,50 @@ describe('AnimateMarkerLayer.vue', () => {
expect(wrapper.vm.viewModel.layerId).toBe('test-id2');
done();
});

it('change marker opacity', async done => {
const newFeatures= {
features: [
{
geometry: {
type: 'Point',
coordinates: [122, 53]
},
properties: {
SmID: '10'
},
type: 'Feature'
}
],
type: 'FeatureCollection'
};
wrapper = mount(SmAnimateMarkerLayer, {
propsData: {
features: newFeatures,
mapTarget: 'map',
textField: 'name',
layerId: 'test-id1'
}
});
await mapSubComponentLoaded(wrapper);
jest.spyOn(wrapper.vm.map, 'getLayer').mockImplementation(() => {
return {
visibility: 'visible',
getPaintProperty() {
return 0.5;
}
};
});
const spy2 = jest.spyOn(wrapper.vm.viewModel.markers[0], 'getElement').mockImplementation(() => {
return {
style: {
display: 'block',
opacity: undefined
}
};
});
wrapper.vm.viewModel._updateLayer();
expect(spy2).toHaveBeenCalledTimes(3);
done();
});
});

0 comments on commit 7e9dacd

Please sign in to comment.