diff --git a/src/modeler/Eip4Panel.test.tsx b/src/modeler/Eip4Panel.test.tsx index 983c88d..2e9a8df 100644 --- a/src/modeler/Eip4Panel.test.tsx +++ b/src/modeler/Eip4Panel.test.tsx @@ -162,6 +162,24 @@ describe('Eip4Panel — 办理人(candidateUsers)', () => { const parsed = parseCandidateExpression(written)!; expect(parsed.items[0]).toMatchObject({ type: 'scriptUser', content: '${APPLYUSERS}' }); }); + + // codec build 对叶子值应用引擎 stringToJson 转义(' → ‘、" → “),防用户输入含撇号/双引号 + // 截断外层 JUEL 单引号字面量或内层 JSON。侧板消费 codec 即受保护——断言写回载荷的内容段 + // (剥离 JUEL 前后缀定界引号后)无裸 ASCII 撇号、有全角‘。 + it("content 含撇号 O'Brien:写回载荷转义为‘、内容段无裸单引号(防截断 JUEL 字面量)", async () => { + const { modeler, updateProperties, select } = makeModeler(); + render(); + await select(userTask({ 'activiti:candidateUsers': REAL_CANDIDATE })); + fireEvent.change(screen.getByTestId('eip4-candidate-content-0'), { + target: { value: "O'Brien" }, + }); + const written = lastPayload(updateProperties)['activiti:candidateUsers'] as string; + const PREFIX = "${candidateUsersHandler.getCandidateUsers(execution,'"; + const SUFFIX = "')}"; + const content = written.slice(PREFIX.length, written.length - SUFFIX.length); + expect(content).toContain('O‘Brien'); // U+2018 全角撇号 + expect(content.includes("'")).toBe(false); // 内容段完全无裸 ASCII 单引号 + }); }); describe('Eip4Panel — 会签(multiInstance)', () => {