Skip to content

Commit

Permalink
Added custom params to printed wms layers (#1259)
Browse files Browse the repository at this point in the history
* Fixes #1258: added custom params to printed wms layers

* Added unit test
  • Loading branch information
mbarto authored Nov 9, 2016
1 parent 64b5b84 commit 006cf4e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/client/utils/PrintUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const PrintUtils = {
"TILED": true,
"EXCEPTIONS": "application/vnd.ogc.se_inimage",
"scaleMethod": "accurate"
}, layer.baseParams || {})
}, layer.baseParams || {}, layer.params || {})
}),
legend: (layer, spec) => ({
"name": layer.title || layer.name,
Expand Down
29 changes: 29 additions & 0 deletions web/client/utils/__tests__/PrintUtils-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2016, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
const expect = require('expect');
const PrintUtils = require('../PrintUtils');

const layer = {
url: "http://mygeoserver",
name: "my:layer",
type: "wms",
params: {myparam: "myvalue"}
};


describe('PrintUtils', () => {

it('custom params are applied to wms layers', () => {

const specs = PrintUtils.getMapfishLayersSpecification([layer], {}, 'map');
expect(specs).toExist();
expect(specs.length).toBe(1);
expect(specs[0].customParams.myparam).toExist();
expect(specs[0].customParams.myparam).toBe("myvalue");
});
});

0 comments on commit 006cf4e

Please sign in to comment.