Skip to content

Commit

Permalink
geosolutions-it#10026: Interactive legend for TOC layers [Resolve rev…
Browse files Browse the repository at this point in the history
…iew comments]

- fix FE failure
  • Loading branch information
mahmoudadel54 committed Apr 19, 2024
1 parent ff42bc6 commit 7b9bc99
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 132 deletions.
48 changes: 0 additions & 48 deletions web/client/components/styleeditor/__tests__/StyleList-test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,54 +162,6 @@ describe('test StyleList module component', () => {
expect(spyOnSelect).toHaveBeenCalledWith({ style: 'point' }, true);
});

it('test StyleList onResetLegendFilterStyle', () => {

const testHandlers = {
onResetLegendFilterStyle: () => {},
onSelect: () => {}
};

const spyonResetLegendFilterStyle = expect.spyOn(testHandlers, 'onResetLegendFilterStyle');

ReactDOM.render(<StyleList
defaultStyle="point"
enabledStyle="square"
onSelect={testHandlers.onSelect}
onResetLegendFilterStyle={testHandlers.onResetLegendFilterStyle}
availableStyles={
[
{
name: 'point',
filename: 'default_point.sld',
format: 'sld',
title: 'A boring default style',
_abstract: 'A sample style that just prints out a purple square'
},
{
name: 'square',
filename: 'square.css',
format: 'css',
title: 'Square',
_abstract: 'Simple square'
},
{
name: 'circle',
filename: 'circle.css',
format: 'css',
title: 'Circle',
_abstract: 'Simple circle'
}
]
}/>, document.getElementById("container"));

const cards = document.querySelectorAll('.mapstore-side-card');
expect(cards.length).toBe(3);

TestUtils.Simulate.click(cards[2]);

expect(spyonResetLegendFilterStyle).toHaveBeenCalledWith('style', 'circle');
});

it('test StyleList showDefaultStyleIcon', () => {

ReactDOM.render(<StyleList
Expand Down
84 changes: 0 additions & 84 deletions web/client/reducers/__tests__/queryform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,50 +633,6 @@ describe('Test the queryform reducer', () => {
expect(state.spatialField.attribute).toEqual("GEOMETRY");
});

it('Query Form Reset and keeping legend filter is exist', () => {
let testAction = {
type: "QUERY_FORM_RESET"
};

const initialState = {
test: true,
spatialField: {
attribute: "GEOMETRY"
},
filters: [
{
format: "logic",
logic: "AND",
filters: [{
format: 'cql',
body: 'ATTRIBUTE1 = \'VALUE1\''
}]
},
{
"id": "interactiveLegend",
"format": "logic",
"version": "1.0.0",
"logic": "AND",
"filters": [
{
"format": "cql",
"version": "1.0.0",
"body": "FIELD_01 >= '5' AND FIELD_01 < '1'",
"id": "[FIELD_01 >= '5' AND FIELD_01 < '1']"
}
]
}
]
};

let state = queryform(initialState, testAction);
expect(state).toBeTruthy();

expect(state.test).toEqual(true);
expect(state.spatialField.attribute).toEqual("GEOMETRY");
expect(state.filters.length).toEqual(1);
});

it('Show Generated Filter', () => {
let testAction = {
type: "SHOW_GENERATED_FILTER",
Expand Down Expand Up @@ -1159,46 +1115,6 @@ describe('Test the queryform reducer', () => {
const newState2 = queryform(newState1, action2);
expect(newState2.filters.length).toBe(0);
});
it('test loadFilter when crossLayerExpanded is undefined', () => {
const newFilter = {
crossLayerFilter: {
collectGeometries: {
queryCollection: {

}
}
},
filters: [{
format: "logic",
logic: "AND",
filters: [{
format: 'cql',
body: 'ATTRIBUTE1 = \'VALUE1\''
}]
}],
spatialField: {
method: "BBOX",
operation: "DWITHIN",
geometry: '{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-635956.0753326667,5466776.262955805],[-635956.0753326667,4723196.8517976105],[-29351.81886150781,4723196.8517976105],[-29351.81886150781,5466776.262955805],[-635956.0753326667,5466776.262955805]]]},"properties":null}'
}

};
const initialState = {
crossLayerExpanded: undefined,
crossLayerFilter: {
attribute: "ATTRIBUTE1"
},
spatialField: {
attribute: "GEOMETRY"
}
};
let action = loadFilter(newFilter);
let newState = queryform(initialState, action);
expect(newState.crossLayerFilter.attribute).toBe("ATTRIBUTE1");
expect(newState.spatialField.attribute).toBe("GEOMETRY");
expect(newState.spatialField.method).toBe("BBOX");
expect(newState.filters).toEqual(newFilter.filters);
});


/* it('Open Zones Menu', () => {
Expand Down

0 comments on commit 7b9bc99

Please sign in to comment.