fix: judge evidence alt text with asset metadata, not syntax
The parser has no asset catalogue, so it cannot know whether an evidence figure is decorative. Move the empty-alt rejection from parse-time (a syntax error) to publish validation, where the mock treats static evidence assets as decorative: false since the static registry predates the Asset capability. The real rule is that the server judges alt against Asset.decorative.
This commit is contained in:
@@ -138,6 +138,32 @@ describe("Content Format v1", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("parses a decorative evidence figure with an empty alt", () => {
|
||||
const source =
|
||||
':::evidence key="fetch-strategy-boundary" alt="" caption="" zoom="false"\n:::';
|
||||
const [block] = parseCaseContent(source);
|
||||
|
||||
expect(block?.type).toBe("EVIDENCE_FIGURE");
|
||||
if (block?.type !== "EVIDENCE_FIGURE") return;
|
||||
expect(block.alt).toBe("");
|
||||
});
|
||||
|
||||
it("round-trips an empty alt without reintroducing it as a parse error", () => {
|
||||
const source =
|
||||
':::evidence key="fetch-strategy-boundary" alt="" caption="" zoom="false"\n:::';
|
||||
const parsed = parseCaseContent(source);
|
||||
|
||||
expect(() => parseCaseContent(serializeCaseContent(parsed))).not.toThrow();
|
||||
});
|
||||
|
||||
it("still rejects an unsafe evidence key", () => {
|
||||
expect(() =>
|
||||
parseCaseContent(
|
||||
':::evidence key="../etc" alt="x" caption="" zoom="false"\n:::',
|
||||
),
|
||||
).toThrow(/CONTENT_FORMAT_INVALID/);
|
||||
});
|
||||
|
||||
it("derives stable table column and row IDs", () => {
|
||||
const [table] = parseCaseContent(`:::table id="metrics" caption="측정" rowHeaderColumn="none"
|
||||
| 이름 | 수치 |
|
||||
|
||||
Reference in New Issue
Block a user