Commit 87e1877
authored
Fix replaceMessage function to handle escaped variables (#716)
* Fix replaceMessage function to handle escaped variables
Modify the `replaceMessage` function in `src/utils/validateUtil.ts` to handle escaped variables and add related test cases.
* **replaceMessage function**:
- Update the `replaceMessage` function to skip conversion when `\${xxx}` is passed and convert `${xxx}` correctly.
- Check for the presence of `\${xxx}` and skip conversion in such cases.
- Ensure the function correctly converts `${xxx}` to the corresponding value from the `kv` object.
* **validate.test.tsx**:
- Add test cases to verify the correct handling of `\${xxx}` and `${xxx}`.
- Ensure the test cases cover both scenarios: skipping conversion and converting correctly.
- Add a new test case to handle escaped and unescaped variables correctly.
---
For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/react-component/field-form?shareId=XXXX-XXXX-XXXX-XXXX).
* Update validateUtil.ts
* test: fix test case1 parent ca2f92c commit 87e1877
2 files changed
+28
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1081 | 1081 | | |
1082 | 1082 | | |
1083 | 1083 | | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1084 | 1108 | | |
0 commit comments