Skip to content

Commit 4a64590

Browse files
authored
Fix SpEL import not_between (#1050)
* Fix SpEL import not_between * chlog, test
1 parent 2e1c925 commit 4a64590

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22
- 6.5.1
33
- Fix missing config file in antd moment date widgets (PR #1046) (issue #1048)
4+
- Fix SpEL import not_between (PR #1050) (issue #1047)
45
- 6.5.0
56
- Breaking: `Utils.validateTree` returns array of errors (PR #1034)
67
- Breaking: `removeIncompleteRulesOnLoad` by default is false

packages/core/modules/import/spel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ const convertOp = (spel, conv, config, meta, parentSpel = null) => {
495495
left,
496496
from,
497497
to
498-
]
498+
],
499+
not: isBetweenRev,
499500
};
500501
return convertOp(oneSpel, conv, config, meta, parentSpel);
501502
}

packages/tests/specs/Basic.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,25 @@ describe("basic query", () => {
106106
}, []);
107107
});
108108

109+
describe("should work with not_between op in SpEL format", () => {
110+
export_checks(configs.simple_with_number, inits.spel_with_not_between, "SpEL", {
111+
logic: {
112+
"and": [
113+
{
114+
"!": {
115+
"<=": [
116+
1,
117+
{ "var": "num" },
118+
2
119+
]
120+
}
121+
}
122+
]
123+
},
124+
spel: "(num < 1 || num > 2)"
125+
}, []);
126+
});
127+
109128
describe("should work with simple value in JsonLogic format not in group", () => {
110129
export_checks(configs.simple_with_number, inits.with_number_not_in_group, "JsonLogic", {
111130
query: "num == 2",

packages/tests/support/inits.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,7 @@ export const with_groupVarKey = {
14761476

14771477
export const spel_with_number = "num == 2";
14781478
export const spel_with_between = "num >= 1 && num <= 2";
1479+
export const spel_with_not_between = "(num < 1 || num > 2)";
14791480
export const spel_with_not = "!(num == 2)";
14801481
export const spel_with_not_not = "!(num == 2 || !(num == 3))";
14811482
export const spel_with_cases = "(str == '222' ? is_string : (num == 4 ? is_number : unknown))";

0 commit comments

Comments
 (0)