Skip to content

Commit 92d1558

Browse files
authored
fix: in filter parser should support string array (#1502)
* fix: in filter parser should support string array * refactor: fix tests
1 parent 4e3b43c commit 92d1558

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

projects/components/src/filtering/filter/parser/filter-parser-lookup.service.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@ describe('Filter Parser Lookup service', () => {
180180
value: 'myString'
181181
});
182182

183+
expect(
184+
spectator.service.lookup(FilterOperator.In).parseSplitFilter({
185+
attribute: getTestFilterAttribute(FilterAttributeType.StringArray),
186+
operator: FilterOperator.In,
187+
rhs: 'myStr, myString'
188+
})
189+
).toEqual({
190+
field: 'stringArrayAttribute',
191+
operator: FilterOperator.In,
192+
value: ['myStr', 'myString']
193+
});
194+
183195
expect(
184196
spectator.service.lookup(FilterOperator.In).parseSplitFilter({
185197
attribute: getTestFilterAttribute(FilterAttributeType.String),

projects/components/src/filtering/filter/parser/types/in-filter-parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export class InFilterParser extends AbstractFilterParser<PossibleValuesTypes> {
2222
case FilterAttributeType.Number:
2323
return this.parseNumberArrayValue(splitFilter.rhs);
2424
case FilterAttributeType.Boolean: // Unsupported
25-
case FilterAttributeType.StringArray: // Unsupported
25+
case FilterAttributeType.StringArray:
26+
return this.parseStringArrayValue(splitFilter.rhs);
2627
case FilterAttributeType.Timestamp: // Unsupported
2728
return undefined;
2829
default:

0 commit comments

Comments
 (0)