Skip to content

Commit

Permalink
2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ukrbublik committed Jun 19, 2024
1 parent 282dd3a commit a884aa6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Fixed import of negative number in SpEL (PR #1054) (issue #1055)
- Fixed validation error message for min/max (PR #1058) (issue #1057)
- (Ternary mode) Added to `config.settings`: `caseValueField`, `renderBeforeCaseValue`, `renderAfterCaseValue`, `renderSwitchPrefix`, `defaultCaseLabel`, `addCaseLabel`, `addDefaultCaseLabel` (PR #1062)
- Use icon button label as the aria-label to improve accessibility (PR #1066) (issue #1038)
- 6.5.2
- Updated dependencies. `@babel/runtime` is now dep for core package (PR #1051) (issue #964)
- 6.5.1
Expand Down
8 changes: 8 additions & 0 deletions packages/tests/specs/SwitchCase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ describe("query with switch-case", () => {
]}
]}
});

export_checks([configs.with_all_types, configs.with_cases], inits.with_cases, undefined, {
"spel": "(str == '222' ? 'is_string' : (num == 4 ? 'is_number' : 'unknown'))",
});
});

describe("1 case and 1 default", () => {
Expand All @@ -32,6 +36,10 @@ describe("query with switch-case", () => {
]
}
});

export_checks([configs.with_all_types, configs.with_cases], inits.with_cases_simple, undefined, {
spel: "(str == '222' ? 'foo' : 'bar')"
});
});

describe("with concat in value", () => {
Expand Down
18 changes: 18 additions & 0 deletions packages/tests/support/inits.js
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,24 @@ export const spel_with_cases = "(str == '222' ? is_string : (num == 4 ? is_numbe
export const spel_with_cases_simple = "(str == '222' ? foo : bar)";
export const spel_with_cases_and_concat = "(str == '222' ? foo : foo + bar)";

export const with_cases = {"if": [
{"==":[{"var":"str"},"222"]},
"is_string",
{"if": [
{"==":[{"var":"num"},4]},
"is_number",
"unknown"
]}
]};

export const with_cases_simple = {
"if": [
{"==": [{"var": "str"}, "222"]},
"foo",
"bar"
]
};

export const spel_with_lhs_toLowerCase = "str.toLowerCase().startsWith('aaa')";
export const spel_with_lhs_toLowerCase_toUpperCase = "str.toLowerCase().toUpperCase() == str.toUpperCase()";
//export const spel_with_new_Date = "datetime == new java.util.Date()";
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/support/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface MockedConsole extends Console {
__origConsole: Console;
__consoleData: ConsoleData;
}
type TreeValueFormat = "JsonLogic" | "default" | "SpEL" | null;
type TreeValueFormat = "JsonLogic" | "default" | "SpEL" | null | undefined;
type TreeValue = JsonLogicTree | JsonTree | string | undefined;
type ConfigFn = (_: Config) => Config;
type ConfigFns = ConfigFn | ConfigFn[];
Expand Down

0 comments on commit a884aa6

Please sign in to comment.