Ship file viewer, editor improvements, and private package releases
This commit is contained in:
1 parent
645914955c
commit
a4a31032b9
158 files changed
+10523
-137
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { renderRichText, richTextSchema } from "../src/rich-text.ts";
|
||||
|
||||
test("semantic text is escaped, bounded, and rejects arbitrary markup properties", () => {
|
||||
expect(renderRichText({text:"<hello>\nworld",richText:[{text:"<hello>",bold:true},{text:"\nworld",italic:true,underline:true}]})).toBe("<strong><hello></strong><em><u><br />world</u></em>");
|
||||
expect(richTextSchema.parse([{text:"hello",html:"<script>"}]).ok).toBe(false);
|
||||
expect(richTextSchema.parse([{text:"hello",bold:"yes"}]).ok).toBe(false);
|
||||
expect(richTextSchema.parse([{text:"a".repeat(200001)}]).ok).toBe(false);
|
||||
expect(renderRichText({text:"Changed",richText:[{text:"Old",bold:true}]})).toBe("Changed");
|
||||
});
|
||||
Reference in new issue
Block a user