Geomap: use string comparison for eq operator (#43181) (#43238)

(cherry picked from commit be498f312e)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-12-16 10:25:03 -08:00
committed by GitHub
co-authored by Ryan McKinley
parent 0b12ef7d70
commit 807f5fed8d
3 changed files with 12 additions and 2 deletions
@@ -152,7 +152,7 @@ export const StyleRuleEditor: FC<StandardEditorProps<FeatureStyleConfig, any, an
options={comparators}
onChange={onChangeComparison}
aria-label={'Comparison operator'}
width={6}
width={8}
/>
</InlineField>
<InlineField className={styles.inline} grow={true}>
@@ -18,6 +18,16 @@ describe('check if feature matches style rule', () => {
feature
)
).toEqual(true);
expect(
checkFeatureMatchesStyleRule(
{
operation: ComparisonOperation.EQ,
property: 'number',
value: '3',
},
feature
)
).toEqual(true);
expect(
checkFeatureMatchesStyleRule(
{
@@ -11,7 +11,7 @@ export const checkFeatureMatchesStyleRule = (rule: FeatureRuleConfig, feature: F
const val = feature.get(rule.property);
switch (rule.operation) {
case ComparisonOperation.EQ:
return val === rule.value;
return `${val}` === `${rule.value}`;
case ComparisonOperation.NEQ:
return val !== rule.value;
case ComparisonOperation.GT: