Skip to content

Commit add3faf

Browse files
committed
Added unit tests to test the newly supported style parameter.
1 parent d350794 commit add3faf

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/unit/specs/components/layerlist/LayerLegendImage.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,25 @@ describe('layerlist/LayerLegendImage.vue', () => {
170170
'SCALE=3571428.571428572&language=de&SLD_VERSION=1.1.0');
171171
});
172172

173+
it('legendURL supports WMS style parameter', async () => {
174+
await comp.setProps({ layer: wmsLayer });
175+
176+
expect(vm.legendURL).to.equal('https://ahocevar.com/geoserver/wms?' +
177+
'SERVICE=WMS&VERSION=1.3.0&REQUEST=GetLegendGraphic&FORMAT=image%2Fpng&LAYER=topp%3Astates&' +
178+
'SCALE=3571428.571428572&language=en&SLD_VERSION=1.1.0');
179+
180+
const source = wmsLayer.getSource();
181+
const params = source.getParams();
182+
source.updateParams({
183+
...params,
184+
STYLES: 'foo'
185+
});
186+
187+
expect(vm.legendURL).to.equal('https://ahocevar.com/geoserver/wms?' +
188+
'SERVICE=WMS&VERSION=1.3.0&REQUEST=GetLegendGraphic&FORMAT=image%2Fpng&LAYER=topp%3Astates&' +
189+
'SCALE=3571428.571428572&language=en&SLD_VERSION=1.1.0&STYLE=foo');
190+
})
191+
173192
afterEach(() => {
174193
vm.$i18n.locale = 'en';
175194
comp.unmount();

0 commit comments

Comments
 (0)