Skip to content

Commit

Permalink
geosolutions-it#10488: 'ilike' as default operator for text field in …
Browse files Browse the repository at this point in the history
…attribute table quick filter

Description:
- handling specifying ilike as the default operator in DD operators in attribute table for the text fields
  • Loading branch information
mahmoudadel54 committed Jul 25, 2024
1 parent 0b28a76 commit 61fac34
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AttributeFilter extends React.PureComponent {
booleanOperators: ["="],
defaultOperators: ["=", ">", "<", ">=", "<=", "<>", "isNull"],
timeDateOperators: ["=", ">", "<", ">=", "<=", "<>", "><", "isNull"],
operator: this.props.isWithinAttrTbl ? "=" : "",
operator: this.props.isWithinAttrTbl ? (this.props.operator || '=') : "",
isInputValid: true
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { trim } from 'lodash';
export default compose(
defaultProps({
onValueChange: () => {},
placeholderMsgId: "featuregrid.filter.placeholders.string"
placeholderMsgId: "featuregrid.filter.placeholders.string",
operator: 'ilike'
}),
withHandlers({
onChange: props => ({value, attribute, inputOperator} = {}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ describe('Test for StringFilter component', () => {
expect(el).toExist();
expect(el.value).toBe("TEST");
});
it('test the text field with the ilike default operator in attribute table', () => {
ReactDOM.render(<StringFilter value={"TEST"} type="string" isWithinAttrTbl />, document.getElementById("container"));
const el = document.getElementsByClassName("form-control input-sm")[0];
expect(el).toExist();
expect(el.value).toBe("TEST");
const operatorEl = document.querySelector('.rw-input');
expect(operatorEl).toExist();
expect(operatorEl.innerHTML).toEqual("ilike");
});
it('Test StringFilter onChange', () => {
const actions = {
onChange: () => {}
Expand Down

0 comments on commit 61fac34

Please sign in to comment.