diff --git a/web/client/plugins/DynamicLegend/components/DynamicLegend.jsx b/web/client/plugins/DynamicLegend/components/DynamicLegend.jsx index f964641d27..8a6c39f4dd 100644 --- a/web/client/plugins/DynamicLegend/components/DynamicLegend.jsx +++ b/web/client/plugins/DynamicLegend/components/DynamicLegend.jsx @@ -19,6 +19,8 @@ import { DEFAULT_PANEL_WIDTH } from '../../../utils/LayoutUtils'; import '../assets/dynamicLegend.css'; import Text from '../../../components/layout/Text'; +export const DYNAMIC_LEGEND_WMS_OPTIONS = "forceLabels:on;countMatched:true;fontAntiAliasing:true;"; + /** * Main component for the DynamicLegend plugin. * @@ -105,7 +107,7 @@ const DynamicLegend = ({ zoom: currentZoomLvl, layerOptions: { legendOptions: { - WMSLegendOptions: "countMatched:true;fontAntiAliasing:true;", + WMSLegendOptions: DYNAMIC_LEGEND_WMS_OPTIONS, legendWidth: 12, legendHeight: 12, mapBbox diff --git a/web/client/plugins/DynamicLegend/components/__tests__/DynamicLegend-test.jsx b/web/client/plugins/DynamicLegend/components/__tests__/DynamicLegend-test.jsx index e487ffa984..6c8867fbfe 100644 --- a/web/client/plugins/DynamicLegend/components/__tests__/DynamicLegend-test.jsx +++ b/web/client/plugins/DynamicLegend/components/__tests__/DynamicLegend-test.jsx @@ -10,7 +10,7 @@ import expect from 'expect'; import React from 'react'; import ReactDOM from 'react-dom'; -import DynamicLegend from '../DynamicLegend'; +import DynamicLegend, { DYNAMIC_LEGEND_WMS_OPTIONS } from '../DynamicLegend'; describe('DynamicLegend Component', () => { let container; @@ -76,4 +76,8 @@ describe('DynamicLegend Component', () => { const layerTreeIsExisting = container.querySelectorAll('.ms-layers-tree'); expect(layerTreeIsExisting).toBeTruthy(); }); + + it('should preserve forced labels in dynamic legend WMS options', () => { + expect(DYNAMIC_LEGEND_WMS_OPTIONS).toBe('forceLabels:on;countMatched:true;fontAntiAliasing:true;'); + }); });