refactor(create): DRY rule export media + TextBlock row view
This commit is contained in:
@@ -95,6 +95,45 @@ describe("ruleExport", () => {
|
||||
expect(csv).toContain(",Title,,My Rule");
|
||||
});
|
||||
|
||||
it("sectionsToMarkdown, sectionsToCsv, and printable HTML include imageUrl and fileUrl blocks", () => {
|
||||
const sections: CommunityRuleSection[] = [
|
||||
{
|
||||
categoryName: "Values",
|
||||
entries: [
|
||||
{
|
||||
title: "Entry",
|
||||
body: "",
|
||||
blocks: [
|
||||
{
|
||||
label: "Photo",
|
||||
body: "Caption",
|
||||
imageUrl: "https://cdn.example.com/pic.jpg",
|
||||
},
|
||||
{
|
||||
label: "Handbook",
|
||||
body: "Download",
|
||||
fileUrl: "https://cdn.example.com/guidance.pdf",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
const md = sectionsToMarkdown("Rule", null, sections);
|
||||
expect(md).toContain("");
|
||||
expect(md).toContain("[Download](https://cdn.example.com/guidance.pdf)");
|
||||
|
||||
const csv = sectionsToCsv("Rule", null, sections);
|
||||
expect(csv).toContain("Caption\nhttps://cdn.example.com/pic.jpg");
|
||||
expect(csv).toContain("Download\nhttps://cdn.example.com/guidance.pdf");
|
||||
|
||||
const html = buildPrintableRuleHtmlDocument("Rule", null, sections);
|
||||
expect(html).toContain('src="https://cdn.example.com/pic.jpg"');
|
||||
expect(html).toContain("Caption");
|
||||
expect(html).toContain('href="https://cdn.example.com/guidance.pdf"');
|
||||
expect(html).toContain("Download");
|
||||
});
|
||||
|
||||
it("buildPrintableRuleHtmlDocument escapes HTML in user content", () => {
|
||||
const sections: CommunityRuleSection[] = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user