diff --git a/schemas/richcaptionproperties.yaml b/schemas/richcaptionproperties.yaml index 4122efd..0a5a7d7 100644 --- a/schemas/richcaptionproperties.yaml +++ b/schemas/richcaptionproperties.yaml @@ -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 diff --git a/schemas/richtextproperties.yaml b/schemas/richtextproperties.yaml index caa8773..8562f5d 100644 --- a/schemas/richtextproperties.yaml +++ b/schemas/richtextproperties.yaml @@ -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 diff --git a/tests/smoke.cjs b/tests/smoke.cjs index 118a02c..160c823 100644 --- a/tests/smoke.cjs +++ b/tests/smoke.cjs @@ -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", @@ -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)", () => {