Skip to content

Commit

Permalink
#9020 Change style for 3D tiles or WFS layer on geostory and dashboard (
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored Apr 7, 2023
1 parent 5e3c57e commit 76e114f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,25 @@ describe('nodeEditor enhancer', () => {
map={{ groups: [{ id: 'GROUP' }], layers: [{ id: "LAYER", group: "GROUP", options: {} }] }} />, document.getElementById("container"));
expect(spyonChange).toHaveBeenCalledWith("map.layers[0].something", "newValue");
});
it('should return only the visible tabs based on node type', () => {

const defaultMap = { groups: [{ id: 'GROUP' }], layers: [{ id: "LAYER:WMS", type: 'wms', group: "GROUP", options: {} }, { id: "LAYER", group: "GROUP", options: {} }] };

const TestComponent = nodeEditor(({ tabs }) => {
return (<ul>{tabs.map(({ id }) => <li key={id}>{id}</li>)}</ul>);
});

ReactDOM.render(<TestComponent editNode={"GROUP"} map={defaultMap}/>, document.getElementById("container"));

expect([...document.querySelectorAll('li')].map(node => node.innerHTML)).toEqual(['general']);

ReactDOM.render(<TestComponent editNode={"LAYER"} map={defaultMap}/>, document.getElementById("container"));

expect([...document.querySelectorAll('li')].map(node => node.innerHTML)).toEqual(['general', 'display']);

ReactDOM.render(<TestComponent editNode={"LAYER:WMS"} map={defaultMap}/>, document.getElementById("container"));

expect([...document.querySelectorAll('li')].map(node => node.innerHTML)).toEqual(['general', 'display', 'style']);

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import withSelectedNode from './withSelectedNode';
const WMSStyle = withCapabilitiesRetrieval(WMSStyleComp);

const withDefaultTabs = withProps((props) => ({
tabs: props.tabs || [{
tabs: (props.tabs || [{
id: 'general',
titleId: 'layerProperties.general',
tooltipId: 'layerProperties.general',
Expand All @@ -47,7 +47,7 @@ const withDefaultTabs = withProps((props) => ({
glyph: 'dropper',
visible: props.settings && props.settings.nodeType === 'layers' && props.element && props.element.type === "wms",
Component: WMSStyle
}]
}]).filter(({ visible }) => !!visible)
}));

/**
Expand Down

0 comments on commit 76e114f

Please sign in to comment.