feat : update
CI / Verify (push) Successful in 1m28s
CI / Build immutable images and deploy (push) Successful in 2m5s

This commit is contained in:
2026-09-05 18:15:06 +07:00 Unverified
parent e66b5a3a0d
commit 5aa0ae80c1
42 changed files with 4613 additions and 67 deletions
+15
View File
@@ -11,6 +11,8 @@ import {
matrixToExtraSheet,
moveExtraSheetColumn,
moveExtraSheetRow,
normalizeExtraSheetRichText,
updateExtraSheetCell,
} from "@/lib/guides/extra-sheet";
function idFactory() {
@@ -87,4 +89,17 @@ describe("Extra sheet", () => {
expect(result.error.issues.map((issue) => issue.message)).toContain("ไม่พบคอลัมน์ของเซลล์นี้");
}
});
it("updates and sanitizes rich-text cells while preserving legacy text", () => {
const initial = createExtraSheet(idFactory());
const updated = updateExtraSheetCell(initial, 0, 0, "legacy\ntext");
const columnId = updated.columns[0].id;
expect(normalizeExtraSheetRichText(updated).rows[0].cells[columnId]).toBe(
"<p>legacy<br>text</p>",
);
const unsafe = updateExtraSheetCell(updated, 0, 0, "<p><strong>safe</strong><script>bad()</script></p>");
expect(normalizeExtraSheetRichText(unsafe).rows[0].cells[columnId]).toBe(
"<p><strong>safe</strong></p>",
);
});
});