Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions schemas/richcaptionproperties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ RichCaptionFont:
The weight of the font. Can be a number (100-900) or a string ('normal', 'bold', etc.).
100 is lightest, 900 is heaviest (boldest).
default: "400"
style:
description: The font style.
type: string
enum:
- normal
- italic
default: "normal"
example: "italic"
color:
description: The text color using hexadecimal color notation.
type: string
Expand Down
8 changes: 8 additions & 0 deletions schemas/richtextproperties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ RichTextFont:
The weight of the font. Can be a number (100-900) or a string ('normal', 'bold', etc.).
100 is lightest, 900 is heaviest (boldest).
default: "400"
style:
description: The font style.
type: string
enum:
- normal
- italic
default: "normal"
example: "italic"
color:
description: The text color using hexadecimal color notation.
type: string
Expand Down
38 changes: 38 additions & 0 deletions tests/smoke.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,25 @@ async function run() {
});
});

check("Parse rich-text font style italic", () => {
const result = zodCjs.richTextAssetSchema.parse({
type: "rich-text",
text: "Hello world",
font: { style: "italic" },
});
assert.strictEqual(result.font.style, "italic");
});

check("Reject unsupported rich-text font style", () => {
assert.throws(() => {
zodCjs.richTextAssetSchema.parse({
type: "rich-text",
text: "Hello world",
font: { style: "oblique" },
});
});
});

check("Parse valid svg asset", () => {
const result = zodCjs.svgAssetSchema.parse({
type: "svg",
Expand Down Expand Up @@ -148,6 +167,25 @@ async function run() {
});
});

check("Parse rich-caption font style italic", () => {
const result = zodCjs.richCaptionAssetSchema.parse({
type: "rich-caption",
src: "https://example.com/captions.srt",
font: { style: "italic" },
});
assert.strictEqual(result.font.style, "italic");
});

check("Reject unsupported rich-caption font style", () => {
assert.throws(() => {
zodCjs.richCaptionAssetSchema.parse({
type: "rich-caption",
src: "https://example.com/captions.srt",
font: { style: "oblique" },
});
});
});

console.log("\n--- Unified asset schema: existing shape (regression guard) ---\n");

check("Parse imageAsset with src only (existing shape)", () => {
Expand Down
Loading