quirk-ui 0.1.94 → 0.1.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index66.css CHANGED
@@ -1 +1 @@
1
- ._markdownBlock_1ls6v_6{width:100%;padding-top:var(--spacing-xl);padding-bottom:var(--spacing-xl)}._container_1ls6v_12{width:100%;margin:0 auto;padding-left:var(--spacing-md);padding-right:var(--spacing-md)}._container_1ls6v_12>*+*{margin-top:var(--spacing-lg)}._maxWidthSm_1ls6v_26{max-width:640px}._maxWidthMd_1ls6v_29{max-width:800px}._maxWidthLg_1ls6v_32{max-width:1000px}._maxWidthFull_1ls6v_35{max-width:100%}._h1_1ls6v_41{font-size:var(--font-size-4xl, 2.25rem);font-weight:var(--font-weight-bold);color:var(--color-text-primary);line-height:var(--line-height-tight, 1.2);margin-bottom:var(--spacing-lg);padding-bottom:var(--spacing-md);border-bottom:2px solid var(--color-border)}._h2_1ls6v_51{font-size:var(--font-size-3xl, 1.75rem);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);line-height:var(--line-height-tight, 1.25);margin-top:var(--spacing-2xl, 3rem);margin-bottom:var(--spacing-md);padding-bottom:var(--spacing-sm);border-bottom:1px solid var(--color-border)}._h3_1ls6v_62{font-size:var(--font-size-2xl, 1.375rem);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);margin-top:var(--spacing-xl);margin-bottom:var(--spacing-sm)}._h4_1ls6v_70{font-size:var(--font-size-xl, 1.125rem);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);margin-top:var(--spacing-lg);margin-bottom:var(--spacing-xs)}._p_1ls6v_80{font-size:var(--font-size-md);line-height:var(--line-height-relaxed, 1.75);color:var(--color-text-secondary)}._ul_1ls6v_88,._ol_1ls6v_89{padding-left:var(--spacing-xl);display:flex;flex-direction:column;gap:var(--spacing-xs)}._ul_1ls6v_88{list-style:disc}._ol_1ls6v_89{list-style:decimal}._li_1ls6v_104{font-size:var(--font-size-md);line-height:var(--line-height-relaxed, 1.75);color:var(--color-text-secondary)}._inlineCode_1ls6v_112{font-family:var(--font-family-mono, "Fira Code", "Courier New", monospace);font-size:.875em;background-color:var(--color-secondary-10);color:var(--color-primary-100);padding:.1em .4em;border-radius:var(--radius-sm);border:1px solid var(--color-border)}._codeBlock_1ls6v_124{position:relative;border-radius:var(--radius-md);border:1px solid var(--color-border);overflow:hidden;background-color:var(--color-secondary-10)}._codeLanguage_1ls6v_132{padding:var(--spacing-xs) var(--spacing-md);font-size:var(--font-size-xs, .75rem);font-weight:var(--font-weight-semibold);color:var(--color-text-secondary);background-color:var(--color-secondary-10);border-bottom:1px solid var(--color-border);text-transform:uppercase;letter-spacing:.05em}._pre_1ls6v_143{margin:0;padding:var(--spacing-lg);overflow-x:auto;-webkit-overflow-scrolling:touch}._code_1ls6v_124{font-family:var(--font-family-mono, "Fira Code", "Courier New", monospace);font-size:var(--font-size-sm);line-height:1.6;color:var(--color-text-primary);white-space:pre}._blockquote_1ls6v_160{border-left:4px solid var(--color-primary-100);padding:var(--spacing-md) var(--spacing-lg);background-color:var(--color-primary-10);border-radius:0 var(--radius-md) var(--radius-md) 0;color:var(--color-text-secondary);font-style:italic}._blockquote_1ls6v_160 p{margin:0;color:inherit}._tableWrapper_1ls6v_176{overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:var(--radius-md);border:1px solid var(--color-border)}._table_1ls6v_176{width:100%;border-collapse:collapse;font-size:var(--font-size-sm)}._thead_1ls6v_189{background-color:var(--color-secondary-10)}._th_1ls6v_189{padding:var(--spacing-sm) var(--spacing-md);text-align:left;font-weight:var(--font-weight-semibold);color:var(--color-text-primary);border-bottom:2px solid var(--color-border);white-space:nowrap}._td_1ls6v_202{padding:var(--spacing-sm) var(--spacing-md);color:var(--color-text-secondary);border-bottom:1px solid var(--color-border);vertical-align:top}tr:last-child ._td_1ls6v_202{border-bottom:none}._hr_1ls6v_215{border:none;border-top:1px solid var(--color-border);margin:var(--spacing-xl) 0}._a_1ls6v_223{color:var(--color-primary-100);text-decoration:underline;text-underline-offset:2px;transition:color .2s ease}._a_1ls6v_223:hover{color:var(--color-primary-75)}._img_1ls6v_236{max-width:100%;height:auto;border-radius:var(--radius-md);border:1px solid var(--color-border)}
1
+ ._markdownBlock_udiov_8{width:100%;padding-top:var(--spacing-xl);padding-bottom:var(--spacing-xl)}._maxWidthSm_udiov_16{max-width:640px}._maxWidthMd_udiov_19{max-width:800px}._maxWidthLg_udiov_22{max-width:1000px}._maxWidthFull_udiov_25{max-width:100%}._container_udiov_4{width:100%;margin:0 auto;padding-left:var(--spacing-md);padding-right:var(--spacing-md)}._container_udiov_4>*+*{margin-top:var(--spacing-lg)}._container_udiov_4 h1{font-size:var(--font-size-4xl, 2.25rem);font-weight:var(--font-weight-bold);color:var(--color-text-primary);line-height:var(--line-height-tight, 1.2);padding-bottom:var(--spacing-md);border-bottom:2px solid var(--color-border)}._container_udiov_4 h2{font-size:var(--font-size-3xl, 1.75rem);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);line-height:var(--line-height-tight, 1.25);margin-top:var(--spacing-2xl, 3rem);padding-bottom:var(--spacing-sm);border-bottom:1px solid var(--color-border)}._container_udiov_4 h3{font-size:var(--font-size-2xl, 1.375rem);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);margin-top:var(--spacing-xl)}._container_udiov_4 h4{font-size:var(--font-size-xl, 1.125rem);font-weight:var(--font-weight-semibold);color:var(--color-text-primary);margin-top:var(--spacing-lg)}._container_udiov_4 p{font-size:var(--font-size-md);line-height:var(--line-height-relaxed, 1.75);color:var(--color-text-secondary)}._container_udiov_4 ul,._container_udiov_4 ol{padding-left:var(--spacing-xl);display:flex;flex-direction:column;gap:var(--spacing-xs)}._container_udiov_4 ul{list-style:disc}._container_udiov_4 ol{list-style:decimal}._container_udiov_4 li{font-size:var(--font-size-md);line-height:var(--line-height-relaxed, 1.75);color:var(--color-text-secondary)}._container_udiov_4 :not(pre)>code{font-family:var(--font-family-mono, "Fira Code", "Courier New", monospace);font-size:.875em;background-color:var(--color-secondary-10);color:var(--color-primary-100);padding:.1em .4em;border-radius:var(--radius-sm)}._container_udiov_4 pre{border-radius:var(--radius-md);border:1px solid var(--color-border);overflow:hidden;background-color:var(--color-secondary-10)}._container_udiov_4 pre code{display:block;padding:var(--spacing-lg);overflow-x:auto;-webkit-overflow-scrolling:touch;font-family:var( --font-family-mono, "Fira Code", "Courier New", monospace );font-size:var(--font-size-sm);line-height:1.6;color:var(--color-text-primary);white-space:pre;background:none;border:none;border-radius:0;padding-top:var(--spacing-lg)}._container_udiov_4 blockquote{border-left:4px solid var(--color-primary-100);padding:var(--spacing-md) var(--spacing-lg);background-color:var(--color-primary-10);border-radius:0 var(--radius-md) var(--radius-md) 0;font-style:italic}._container_udiov_4 blockquote p{margin:0;color:var(--color-text-secondary)}._container_udiov_4 table{width:100%;border-collapse:collapse;font-size:var(--font-size-sm);border:1px solid var(--color-border);border-radius:var(--radius-md);overflow:hidden;display:block;overflow-x:auto;-webkit-overflow-scrolling:touch}._container_udiov_4 thead{background-color:var(--color-secondary-10)}._container_udiov_4 th{padding:var(--spacing-sm) var(--spacing-md);text-align:left;font-weight:var(--font-weight-semibold);color:var(--color-text-primary);border-bottom:2px solid var(--color-border);white-space:nowrap}._container_udiov_4 td{padding:var(--spacing-sm) var(--spacing-md);color:var(--color-text-secondary);border-bottom:1px solid var(--color-border);vertical-align:top}._container_udiov_4 tr:last-child td{border-bottom:none}._container_udiov_4 hr{border:none;border-top:1px solid var(--color-border);margin:var(--spacing-xl) 0}._container_udiov_4 a{color:var(--color-primary-100);text-decoration:underline;text-underline-offset:2px;transition:color .2s ease}._container_udiov_4 a:hover{color:var(--color-primary-75)}._container_udiov_4 img{max-width:100%;height:auto;border-radius:var(--radius-md);border:1px solid var(--color-border)}._container_udiov_4 input[type=checkbox]{margin-right:var(--spacing-xs);accent-color:var(--color-primary-100)}
@@ -1,32 +1,10 @@
1
1
  declare const styles: {
2
- readonly "_a_1ls6v_223": string;
3
- readonly "_blockquote_1ls6v_160": string;
4
- readonly "_codeBlock_1ls6v_124": string;
5
- readonly "_codeLanguage_1ls6v_132": string;
6
- readonly "_code_1ls6v_124": string;
7
- readonly "_container_1ls6v_12": string;
8
- readonly "_h1_1ls6v_41": string;
9
- readonly "_h2_1ls6v_51": string;
10
- readonly "_h3_1ls6v_62": string;
11
- readonly "_h4_1ls6v_70": string;
12
- readonly "_hr_1ls6v_215": string;
13
- readonly "_img_1ls6v_236": string;
14
- readonly "_inlineCode_1ls6v_112": string;
15
- readonly "_li_1ls6v_104": string;
16
- readonly "_markdownBlock_1ls6v_6": string;
17
- readonly "_maxWidthFull_1ls6v_35": string;
18
- readonly "_maxWidthLg_1ls6v_32": string;
19
- readonly "_maxWidthMd_1ls6v_29": string;
20
- readonly "_maxWidthSm_1ls6v_26": string;
21
- readonly "_ol_1ls6v_89": string;
22
- readonly "_p_1ls6v_80": string;
23
- readonly "_pre_1ls6v_143": string;
24
- readonly "_tableWrapper_1ls6v_176": string;
25
- readonly "_table_1ls6v_176": string;
26
- readonly "_td_1ls6v_202": string;
27
- readonly "_th_1ls6v_189": string;
28
- readonly "_thead_1ls6v_189": string;
29
- readonly "_ul_1ls6v_88": string;
2
+ readonly "_container_udiov_4": string;
3
+ readonly "_markdownBlock_udiov_8": string;
4
+ readonly "_maxWidthFull_udiov_25": string;
5
+ readonly "_maxWidthLg_udiov_22": string;
6
+ readonly "_maxWidthMd_udiov_19": string;
7
+ readonly "_maxWidthSm_udiov_16": string;
30
8
  };
31
9
  export = styles;
32
10
 
package/dist/main.d.ts CHANGED
@@ -1197,7 +1197,7 @@ declare const marginClassMap: {
1197
1197
  readonly xl: string;
1198
1198
  };
1199
1199
 
1200
- export declare function MarkdownBlock({ content, styleOptions }: MarkdownBlockProps_2): JSX.Element | null;
1200
+ export declare function MarkdownBlock({ content, styleOptions, id, }: MarkdownBlockProps_2): Promise<JSX.Element | null>;
1201
1201
 
1202
1202
  export { MarkdownBlockProps }
1203
1203
 
@@ -1,10 +1,3 @@
1
- "use strict";const n=require("react/jsx-runtime"),e=require("../../../react.esm-C_9Ma9mj.cjs"),r=require("./index.cjs");e.vi.mock("./styles.module.css",()=>({default:new Proxy({},{get:(t,a)=>a})}));function l(o,t={}){return{_type:"markdownBlock",content:o,styleOptions:t}}e.describe("1. Empty / null rendering",()=>{e.it("renders null when content is undefined",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{_type:"markdownBlock",content:void 0}));e.globalExpect(o.firstChild).toBeNull()}),e.it("renders null when content is an empty string",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{_type:"markdownBlock",content:""}));e.globalExpect(o.firstChild).toBeNull()}),e.it("renders a section when content is present",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello")}));e.globalExpect(o.querySelector("section")).toBeInTheDocument()})});e.describe("2. Headings — h1–h4 rendered with CSS classes",()=>{e.it("renders an h1 with the h1 class",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("# Heading One")})),t=o.querySelector("h1");e.globalExpect(t).toBeInTheDocument(),e.globalExpect(t==null?void 0:t.className).toContain("h1"),e.globalExpect(t==null?void 0:t.textContent).toContain("Heading One")}),e.it("renders an h2 with the h2 class",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("## Heading Two")})),t=o.querySelector("h2");e.globalExpect(t).toBeInTheDocument(),e.globalExpect(t==null?void 0:t.className).toContain("h2")}),e.it("renders an h3 with the h3 class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("### Heading Three")}));e.globalExpect((t=o.querySelector("h3"))==null?void 0:t.className).toContain("h3")}),e.it("renders an h4 with the h4 class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("#### Heading Four")}));e.globalExpect((t=o.querySelector("h4"))==null?void 0:t.className).toContain("h4")})});e.describe("3. Paragraph — <p> with class",()=>{e.it("renders a paragraph element",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("This is a paragraph.")}));e.globalExpect(o.querySelector("p")).toBeInTheDocument()}),e.it("applies the p class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("This is a paragraph.")}));e.globalExpect((t=o.querySelector("p"))==null?void 0:t.className).toContain("p")}),e.it("renders the paragraph text",()=>{e.render(n.jsx(r.MarkdownBlock,{...l("Hello world paragraph.")})),e.globalExpect(e.screen.getByText("Hello world paragraph.")).toBeInTheDocument()})});e.describe("4. Unordered list — <ul> and <li> with classes",()=>{const o=`- Apple
2
- - Banana
3
- - Cherry`;e.it("renders a <ul> element with the ul class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelector("ul");e.globalExpect(a).toBeInTheDocument(),e.globalExpect(a==null?void 0:a.className).toContain("ul")}),e.it("renders an <li> for each item with the li class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelectorAll("li");e.globalExpect(a).toHaveLength(3),a.forEach(c=>e.globalExpect(c.className).toContain("li"))}),e.it("renders each list item's text",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByText("Apple")).toBeInTheDocument(),e.globalExpect(e.screen.getByText("Banana")).toBeInTheDocument(),e.globalExpect(e.screen.getByText("Cherry")).toBeInTheDocument()})});e.describe("5. Ordered list <ol> and <li> with classes",()=>{const o=`1. First
4
- 2. Second
5
- 3. Third`;e.it("renders an <ol> element with the ol class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelector("ol");e.globalExpect(a).toBeInTheDocument(),e.globalExpect(a==null?void 0:a.className).toContain("ol")}),e.it("renders three list items",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect(t.querySelectorAll("li")).toHaveLength(3)})});e.describe("6. Inline code — <code> with inlineCode class",()=>{e.it("renders inline code with the inlineCode class",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Use `console.log()` here.")})),t=o.querySelector("code");e.globalExpect(t).toBeInTheDocument(),e.globalExpect(t==null?void 0:t.className).toContain("inlineCode")}),e.it("does not wrap inline code in a codeBlock div",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Use `console.log()` here.")}));e.globalExpect(o.querySelector(".codeBlock")).toBeNull()}),e.it("renders the inline code text",()=>{e.render(n.jsx(r.MarkdownBlock,{...l("Use `myFunction()` here.")})),e.globalExpect(e.screen.getByText("myFunction()")).toBeInTheDocument()})});e.describe("7. Fenced code block — codeBlock wrapper, pre, code",()=>{const o="```\nconst x = 1;\n```";e.it("renders a codeBlock wrapper div",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect(t.querySelector(".codeBlock")).toBeInTheDocument()}),e.it("renders a <pre> inside the codeBlock",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect(t.querySelector(".codeBlock pre")).toBeInTheDocument()}),e.it("renders a <code> inside the pre with the code class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelector(".codeBlock pre code");e.globalExpect(a).toBeInTheDocument(),e.globalExpect(a==null?void 0:a.className).toContain("code")}),e.it("renders the code content",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByText(/const x = 1/)).toBeInTheDocument()})});e.describe("8. Code language label — shown when language specified; absent when not",()=>{e.it("renders the language label when a language is specified",()=>{const o="```tsx\nconst x = 1;\n```",{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelector(".codeLanguage");e.globalExpect(a).toBeInTheDocument(),e.globalExpect(a==null?void 0:a.textContent).toBe("tsx")}),e.it("does not render the language label when no language is specified",()=>{const o="```\nconst x = 1;\n```",{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect(t.querySelector(".codeLanguage")).toBeNull()}),e.it("correctly extracts 'javascript' from language-javascript className",()=>{var a;const o="```javascript\nconsole.log('hi');\n```",{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect((a=t.querySelector(".codeLanguage"))==null?void 0:a.textContent).toBe("javascript")})});e.describe("9. Blockquote — <blockquote> with class",()=>{e.it("renders a blockquote element",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("> This is a quote.")}));e.globalExpect(o.querySelector("blockquote")).toBeInTheDocument()}),e.it("applies the blockquote class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("> This is a quote.")}));e.globalExpect((t=o.querySelector("blockquote"))==null?void 0:t.className).toContain("blockquote")}),e.it("renders the blockquote text",()=>{e.render(n.jsx(r.MarkdownBlock,{...l("> Famous words.")})),e.globalExpect(e.screen.getByText("Famous words.")).toBeInTheDocument()})});e.describe("10. Table (GFM) — tableWrapper, table, thead, th, td rendered",()=>{const o=`
6
- | Name | Age |
7
- |-------|-----|
8
- | Alice | 30 |
9
- | Bob | 25 |
10
- `.trim();e.it("renders a tableWrapper div",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect(t.querySelector(".tableWrapper")).toBeInTheDocument()}),e.it("renders a table with the table class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelector("table");e.globalExpect(a).toBeInTheDocument(),e.globalExpect(a==null?void 0:a.className).toContain("table")}),e.it("renders a thead with the thead class",()=>{var a;const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)}));e.globalExpect((a=t.querySelector("thead"))==null?void 0:a.className).toContain("thead")}),e.it("renders th elements with the th class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelectorAll("th");e.globalExpect(a.length).toBeGreaterThan(0),a.forEach(c=>e.globalExpect(c.className).toContain("th"))}),e.it("renders td elements with the td class",()=>{const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l(o)})),a=t.querySelectorAll("td");e.globalExpect(a.length).toBeGreaterThan(0),a.forEach(c=>e.globalExpect(c.className).toContain("td"))}),e.it("renders the table header text",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByText("Name")).toBeInTheDocument(),e.globalExpect(e.screen.getByText("Age")).toBeInTheDocument()}),e.it("renders the table cell content",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByText("Alice")).toBeInTheDocument(),e.globalExpect(e.screen.getByText("Bob")).toBeInTheDocument()})});e.describe("11. Horizontal rule — <hr> with class",()=>{e.it("renders an hr element",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("---")}));e.globalExpect(o.querySelector("hr")).toBeInTheDocument()}),e.it("applies the hr class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("---")}));e.globalExpect((t=o.querySelector("hr"))==null?void 0:t.className).toContain("hr")})});e.describe("12. External link — target=_blank and rel=noopener noreferrer",()=>{const o="[Visit Example](https://example.com)";e.it("renders an anchor element",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link")).toBeInTheDocument()}),e.it("sets target=_blank on external links",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link").getAttribute("target")).toBe("_blank")}),e.it("sets rel=noopener noreferrer on external links",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link").getAttribute("rel")).toBe("noopener noreferrer")}),e.it("applies the a class",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link").className).toContain("a")})});e.describe("13. Internal link — no target or rel on relative links",()=>{const o="[About](/about)";e.it("renders an anchor without target",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link").getAttribute("target")).toBeNull()}),e.it("renders an anchor without rel",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link").getAttribute("rel")).toBeNull()}),e.it("sets the correct href",()=>{e.render(n.jsx(r.MarkdownBlock,{...l(o)})),e.globalExpect(e.screen.getByRole("link").getAttribute("href")).toBe("/about")})});e.describe("14. Image — <img> with class; alt defaults to empty string",()=>{e.it("renders an img element",()=>{const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("![Alt text](https://example.com/img.png)")}));e.globalExpect(o.querySelector("img")).toBeInTheDocument()}),e.it("applies the img class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("![Alt text](https://example.com/img.png)")}));e.globalExpect((t=o.querySelector("img"))==null?void 0:t.className).toContain("img")}),e.it("sets the alt text from the markdown",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("![My Alt](https://example.com/img.png)")}));e.globalExpect((t=o.querySelector("img"))==null?void 0:t.alt).toBe("My Alt")}),e.it("defaults alt to empty string when not provided",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("![](https://example.com/img.png)")}));e.globalExpect((t=o.querySelector("img"))==null?void 0:t.alt).toBe("")})});e.describe("15. maxWidth class — sm/md/lg/full applied; defaults to lg",()=>{const o=[["sm","maxWidthSm"],["md","maxWidthMd"],["lg","maxWidthLg"],["full","maxWidthFull"]];e.it.each(o)('maxWidth="%s" applies class "%s"',(t,a)=>{var s;const{container:c}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello",{maxWidth:t})}));e.globalExpect((s=c.querySelector(".container"))==null?void 0:s.className).toContain(a)}),e.it("defaults to maxWidthLg when maxWidth is not provided",()=>{var a;const{container:t}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello")}));e.globalExpect((a=t.querySelector(".container"))==null?void 0:a.className).toContain("maxWidthLg")})});e.describe("16. background class — capitalised and prefixed with 'background'",()=>{e.it("applies backgroundGray for background='gray'",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello",{background:"gray"})}));e.globalExpect((t=o.querySelector("section"))==null?void 0:t.className).toContain("backgroundGray")}),e.it("applies backgroundDark for background='dark'",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello",{background:"dark"})}));e.globalExpect((t=o.querySelector("section"))==null?void 0:t.className).toContain("backgroundDark")}),e.it("does not add a background class when background is not provided",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello")}));e.globalExpect((t=o.querySelector("section"))==null?void 0:t.className).not.toContain("background")})});e.describe("17. padding classes — array joined and applied to outer section",()=>{e.it("applies a single padding class",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello",{padding:["pt-8"]})}));e.globalExpect((t=o.querySelector("section"))==null?void 0:t.className).toContain("pt-8")}),e.it("applies multiple padding classes",()=>{var a;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello",{padding:["pt-8","pb-16"]})})),t=((a=o.querySelector("section"))==null?void 0:a.className)??"";e.globalExpect(t).toContain("pt-8"),e.globalExpect(t).toContain("pb-16")}),e.it("does not add extra classes when padding is not provided",()=>{var t;const{container:o}=e.render(n.jsx(r.MarkdownBlock,{...l("Hello")}));e.globalExpect((t=o.querySelector("section"))==null?void 0:t.className.trim()).toBe("markdownBlock")})});
1
+ "use strict";const t=require("../../../react.esm-C_9Ma9mj.cjs"),c=require("./index.cjs");require("../../../index-CW_Ehh1q.cjs");t.vi.mock("remark",()=>({remark:()=>({use:function(){return this},process:t.vi.fn(async n=>({toString:()=>`<p>${n}</p>`}))})}));t.vi.mock("remark-gfm",()=>({default:()=>{}}));t.vi.mock("remark-html",()=>({default:()=>{}}));async function a(n){const e=await c.MarkdownBlock(n);return e?t.render(e):{container:document.createElement("div")}}t.describe("MarkdownBlock",()=>{const n=`# Hello
2
+
3
+ This is **markdown** content.`;t.describe("Rendering",()=>{t.it("renders a section element",async()=>{const{container:e}=await a({content:n});t.globalExpect(e.querySelector("section")).toBeInTheDocument()}),t.it("renders nothing when content is undefined",async()=>{const e=await c.MarkdownBlock({});t.globalExpect(e).toBeNull()}),t.it("renders nothing when content is empty string",async()=>{const e=await c.MarkdownBlock({content:""});t.globalExpect(e).toBeNull()}),t.it("renders processed HTML via dangerouslySetInnerHTML",async()=>{const{container:e}=await a({content:n});t.globalExpect(e.querySelector("p")).toBeInTheDocument()}),t.it("renders with id prop",async()=>{var o;const{container:e}=await a({content:n,id:"markdown-section"});t.globalExpect((o=e.querySelector("section"))==null?void 0:o.id).toBe("markdown-section")}),t.it("accepts _key prop without error",async()=>{await t.globalExpect(a({content:n})).resolves.not.toThrow()})}),t.describe("Max width",()=>{t.it("applies large max width by default",async()=>{const{container:e}=await a({content:n});t.globalExpect(e.querySelector("[class*=maxWidthLg]")).toBeInTheDocument()}),t.it("applies small max width",async()=>{const{container:e}=await a({content:n,styleOptions:{maxWidth:"sm"}});t.globalExpect(e.querySelector("[class*=maxWidthSm]")).toBeInTheDocument()}),t.it("applies medium max width",async()=>{const{container:e}=await a({content:n,styleOptions:{maxWidth:"md"}});t.globalExpect(e.querySelector("[class*=maxWidthMd]")).toBeInTheDocument()}),t.it("applies full max width",async()=>{const{container:e}=await a({content:n,styleOptions:{maxWidth:"full"}});t.globalExpect(e.querySelector("[class*=maxWidthFull]")).toBeInTheDocument()})}),t.describe("Style options",()=>{t.it("applies padding classes to section",async()=>{const{container:e}=await a({content:n,styleOptions:{padding:["paddingTop4","paddingBottom4"]}}),o=e.querySelector("section");t.globalExpect(o==null?void 0:o.className).toContain("paddingTop4"),t.globalExpect(o==null?void 0:o.className).toContain("paddingBottom4")}),t.it("applies capitalised background class to section",async()=>{const{container:e}=await a({content:n,styleOptions:{background:"primary"}}),o=e.querySelector("section");t.globalExpect(o==null?void 0:o.className).toContain("backgroundPrimary")}),t.it("renders without styleOptions",async()=>{const{container:e}=await a({content:n});t.globalExpect(e.querySelector("section")).toBeInTheDocument()}),t.it("accepts all styleOptions props without error",async()=>{await t.globalExpect(a({content:n,styleOptions:{padding:["paddingTop2","paddingBottom2"],background:"white",maxWidth:"md"}})).resolves.not.toThrow()})})});
@@ -1,333 +1,123 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { v as m, d, i as a, r, g as n, s as i } from "../../../react.esm-DjxyacK8.js";
1
+ import { v as r, d as i, i as o, g as n, r as d } from "../../../react.esm-DjxyacK8.js";
3
2
  import { MarkdownBlock as c } from "./index.mjs";
4
- m.mock("./styles.module.css", () => ({ default: new Proxy({}, { get: (e, l) => l }) }));
5
- function s(t, e = {}) {
6
- return {
7
- _type: "markdownBlock",
8
- content: t,
9
- styleOptions: e
10
- };
3
+ import "../../../index-DPGXWTtt.js";
4
+ r.mock("remark", () => ({
5
+ remark: () => ({
6
+ use: function() {
7
+ return this;
8
+ },
9
+ process: r.fn(async (e) => ({
10
+ toString: () => `<p>${e}</p>`
11
+ }))
12
+ })
13
+ }));
14
+ r.mock("remark-gfm", () => ({ default: () => {
15
+ } }));
16
+ r.mock("remark-html", () => ({ default: () => {
17
+ } }));
18
+ async function s(e) {
19
+ const t = await c(e);
20
+ return t ? d(t) : { container: document.createElement("div") };
11
21
  }
12
- d("1. Empty / null rendering", () => {
13
- a("renders null when content is undefined", () => {
14
- const { container: t } = r(
15
- /* @__PURE__ */ o(c, { _type: "markdownBlock", content: void 0 })
16
- );
17
- n(t.firstChild).toBeNull();
18
- }), a("renders null when content is an empty string", () => {
19
- const { container: t } = r(
20
- /* @__PURE__ */ o(c, { _type: "markdownBlock", content: "" })
21
- );
22
- n(t.firstChild).toBeNull();
23
- }), a("renders a section when content is present", () => {
24
- const { container: t } = r(/* @__PURE__ */ o(c, { ...s("Hello") }));
25
- n(t.querySelector("section")).toBeInTheDocument();
26
- });
27
- });
28
- d("2. Headings — h1–h4 rendered with CSS classes", () => {
29
- a("renders an h1 with the h1 class", () => {
30
- const { container: t } = r(
31
- /* @__PURE__ */ o(c, { ...s("# Heading One") })
32
- ), e = t.querySelector("h1");
33
- n(e).toBeInTheDocument(), n(e == null ? void 0 : e.className).toContain("h1"), n(e == null ? void 0 : e.textContent).toContain("Heading One");
34
- }), a("renders an h2 with the h2 class", () => {
35
- const { container: t } = r(
36
- /* @__PURE__ */ o(c, { ...s("## Heading Two") })
37
- ), e = t.querySelector("h2");
38
- n(e).toBeInTheDocument(), n(e == null ? void 0 : e.className).toContain("h2");
39
- }), a("renders an h3 with the h3 class", () => {
40
- var e;
41
- const { container: t } = r(
42
- /* @__PURE__ */ o(c, { ...s("### Heading Three") })
43
- );
44
- n((e = t.querySelector("h3")) == null ? void 0 : e.className).toContain("h3");
45
- }), a("renders an h4 with the h4 class", () => {
46
- var e;
47
- const { container: t } = r(
48
- /* @__PURE__ */ o(c, { ...s("#### Heading Four") })
49
- );
50
- n((e = t.querySelector("h4")) == null ? void 0 : e.className).toContain("h4");
51
- });
52
- });
53
- d("3. Paragraph — <p> with class", () => {
54
- a("renders a paragraph element", () => {
55
- const { container: t } = r(
56
- /* @__PURE__ */ o(c, { ...s("This is a paragraph.") })
57
- );
58
- n(t.querySelector("p")).toBeInTheDocument();
59
- }), a("applies the p class", () => {
60
- var e;
61
- const { container: t } = r(
62
- /* @__PURE__ */ o(c, { ...s("This is a paragraph.") })
63
- );
64
- n((e = t.querySelector("p")) == null ? void 0 : e.className).toContain("p");
65
- }), a("renders the paragraph text", () => {
66
- r(/* @__PURE__ */ o(c, { ...s("Hello world paragraph.") })), n(i.getByText("Hello world paragraph.")).toBeInTheDocument();
67
- });
68
- });
69
- d("4. Unordered list — <ul> and <li> with classes", () => {
70
- const t = `- Apple
71
- - Banana
72
- - Cherry`;
73
- a("renders a <ul> element with the ul class", () => {
74
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelector("ul");
75
- n(l).toBeInTheDocument(), n(l == null ? void 0 : l.className).toContain("ul");
76
- }), a("renders an <li> for each item with the li class", () => {
77
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelectorAll("li");
78
- n(l).toHaveLength(3), l.forEach((h) => n(h.className).toContain("li"));
79
- }), a("renders each list item's text", () => {
80
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByText("Apple")).toBeInTheDocument(), n(i.getByText("Banana")).toBeInTheDocument(), n(i.getByText("Cherry")).toBeInTheDocument();
81
- });
82
- });
83
- d("5. Ordered list <ol> and <li> with classes", () => {
84
- const t = `1. First
85
- 2. Second
86
- 3. Third`;
87
- a("renders an <ol> element with the ol class", () => {
88
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelector("ol");
89
- n(l).toBeInTheDocument(), n(l == null ? void 0 : l.className).toContain("ol");
90
- }), a("renders three list items", () => {
91
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
92
- n(e.querySelectorAll("li")).toHaveLength(3);
93
- });
94
- });
95
- d("6. Inline code — <code> with inlineCode class", () => {
96
- a("renders inline code with the inlineCode class", () => {
97
- const { container: t } = r(
98
- /* @__PURE__ */ o(c, { ...s("Use `console.log()` here.") })
99
- ), e = t.querySelector("code");
100
- n(e).toBeInTheDocument(), n(e == null ? void 0 : e.className).toContain("inlineCode");
101
- }), a("does not wrap inline code in a codeBlock div", () => {
102
- const { container: t } = r(
103
- /* @__PURE__ */ o(c, { ...s("Use `console.log()` here.") })
104
- );
105
- n(t.querySelector(".codeBlock")).toBeNull();
106
- }), a("renders the inline code text", () => {
107
- r(/* @__PURE__ */ o(c, { ...s("Use `myFunction()` here.") })), n(i.getByText("myFunction()")).toBeInTheDocument();
108
- });
109
- });
110
- d("7. Fenced code block — codeBlock wrapper, pre, code", () => {
111
- const t = "```\nconst x = 1;\n```";
112
- a("renders a codeBlock wrapper div", () => {
113
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
114
- n(e.querySelector(".codeBlock")).toBeInTheDocument();
115
- }), a("renders a <pre> inside the codeBlock", () => {
116
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
117
- n(e.querySelector(".codeBlock pre")).toBeInTheDocument();
118
- }), a("renders a <code> inside the pre with the code class", () => {
119
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelector(".codeBlock pre code");
120
- n(l).toBeInTheDocument(), n(l == null ? void 0 : l.className).toContain("code");
121
- }), a("renders the code content", () => {
122
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByText(/const x = 1/)).toBeInTheDocument();
123
- });
124
- });
125
- d("8. Code language label — shown when language specified; absent when not", () => {
126
- a("renders the language label when a language is specified", () => {
127
- const t = "```tsx\nconst x = 1;\n```", { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelector(".codeLanguage");
128
- n(l).toBeInTheDocument(), n(l == null ? void 0 : l.textContent).toBe("tsx");
129
- }), a("does not render the language label when no language is specified", () => {
130
- const t = "```\nconst x = 1;\n```", { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
131
- n(e.querySelector(".codeLanguage")).toBeNull();
132
- }), a("correctly extracts 'javascript' from language-javascript className", () => {
133
- var l;
134
- const t = "```javascript\nconsole.log('hi');\n```", { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
135
- n((l = e.querySelector(".codeLanguage")) == null ? void 0 : l.textContent).toBe(
136
- "javascript"
137
- );
138
- });
139
- });
140
- d("9. Blockquote — <blockquote> with class", () => {
141
- a("renders a blockquote element", () => {
142
- const { container: t } = r(
143
- /* @__PURE__ */ o(c, { ...s("> This is a quote.") })
144
- );
145
- n(t.querySelector("blockquote")).toBeInTheDocument();
146
- }), a("applies the blockquote class", () => {
147
- var e;
148
- const { container: t } = r(
149
- /* @__PURE__ */ o(c, { ...s("> This is a quote.") })
150
- );
151
- n((e = t.querySelector("blockquote")) == null ? void 0 : e.className).toContain(
152
- "blockquote"
153
- );
154
- }), a("renders the blockquote text", () => {
155
- r(/* @__PURE__ */ o(c, { ...s("> Famous words.") })), n(i.getByText("Famous words.")).toBeInTheDocument();
156
- });
157
- });
158
- d("10. Table (GFM) — tableWrapper, table, thead, th, td rendered", () => {
159
- const t = `
160
- | Name | Age |
161
- |-------|-----|
162
- | Alice | 30 |
163
- | Bob | 25 |
164
- `.trim();
165
- a("renders a tableWrapper div", () => {
166
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
167
- n(e.querySelector(".tableWrapper")).toBeInTheDocument();
168
- }), a("renders a table with the table class", () => {
169
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelector("table");
170
- n(l).toBeInTheDocument(), n(l == null ? void 0 : l.className).toContain("table");
171
- }), a("renders a thead with the thead class", () => {
172
- var l;
173
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) }));
174
- n((l = e.querySelector("thead")) == null ? void 0 : l.className).toContain("thead");
175
- }), a("renders th elements with the th class", () => {
176
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelectorAll("th");
177
- n(l.length).toBeGreaterThan(0), l.forEach((h) => n(h.className).toContain("th"));
178
- }), a("renders td elements with the td class", () => {
179
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s(t) })), l = e.querySelectorAll("td");
180
- n(l.length).toBeGreaterThan(0), l.forEach((h) => n(h.className).toContain("td"));
181
- }), a("renders the table header text", () => {
182
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByText("Name")).toBeInTheDocument(), n(i.getByText("Age")).toBeInTheDocument();
183
- }), a("renders the table cell content", () => {
184
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByText("Alice")).toBeInTheDocument(), n(i.getByText("Bob")).toBeInTheDocument();
185
- });
186
- });
187
- d("11. Horizontal rule — <hr> with class", () => {
188
- a("renders an hr element", () => {
189
- const { container: t } = r(/* @__PURE__ */ o(c, { ...s("---") }));
190
- n(t.querySelector("hr")).toBeInTheDocument();
191
- }), a("applies the hr class", () => {
192
- var e;
193
- const { container: t } = r(/* @__PURE__ */ o(c, { ...s("---") }));
194
- n((e = t.querySelector("hr")) == null ? void 0 : e.className).toContain("hr");
195
- });
196
- });
197
- d("12. External link — target=_blank and rel=noopener noreferrer", () => {
198
- const t = "[Visit Example](https://example.com)";
199
- a("renders an anchor element", () => {
200
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link")).toBeInTheDocument();
201
- }), a("sets target=_blank on external links", () => {
202
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link").getAttribute("target")).toBe("_blank");
203
- }), a("sets rel=noopener noreferrer on external links", () => {
204
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link").getAttribute("rel")).toBe(
205
- "noopener noreferrer"
206
- );
207
- }), a("applies the a class", () => {
208
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link").className).toContain("a");
209
- });
210
- });
211
- d("13. Internal link — no target or rel on relative links", () => {
212
- const t = "[About](/about)";
213
- a("renders an anchor without target", () => {
214
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link").getAttribute("target")).toBeNull();
215
- }), a("renders an anchor without rel", () => {
216
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link").getAttribute("rel")).toBeNull();
217
- }), a("sets the correct href", () => {
218
- r(/* @__PURE__ */ o(c, { ...s(t) })), n(i.getByRole("link").getAttribute("href")).toBe("/about");
219
- });
220
- });
221
- d("14. Image — <img> with class; alt defaults to empty string", () => {
222
- a("renders an img element", () => {
223
- const { container: t } = r(
224
- /* @__PURE__ */ o(
225
- c,
226
- {
227
- ...s("![Alt text](https://example.com/img.png)")
228
- }
229
- )
230
- );
231
- n(t.querySelector("img")).toBeInTheDocument();
232
- }), a("applies the img class", () => {
233
- var e;
234
- const { container: t } = r(
235
- /* @__PURE__ */ o(
236
- c,
237
- {
238
- ...s("![Alt text](https://example.com/img.png)")
239
- }
240
- )
241
- );
242
- n((e = t.querySelector("img")) == null ? void 0 : e.className).toContain("img");
243
- }), a("sets the alt text from the markdown", () => {
244
- var e;
245
- const { container: t } = r(
246
- /* @__PURE__ */ o(
247
- c,
248
- {
249
- ...s("![My Alt](https://example.com/img.png)")
250
- }
251
- )
252
- );
253
- n((e = t.querySelector("img")) == null ? void 0 : e.alt).toBe("My Alt");
254
- }), a("defaults alt to empty string when not provided", () => {
255
- var e;
256
- const { container: t } = r(
257
- /* @__PURE__ */ o(c, { ...s("![](https://example.com/img.png)") })
258
- );
259
- n((e = t.querySelector("img")) == null ? void 0 : e.alt).toBe("");
260
- });
261
- });
262
- d("15. maxWidth class — sm/md/lg/full applied; defaults to lg", () => {
263
- const t = [
264
- ["sm", "maxWidthSm"],
265
- ["md", "maxWidthMd"],
266
- ["lg", "maxWidthLg"],
267
- ["full", "maxWidthFull"]
268
- ];
269
- a.each(t)(
270
- 'maxWidth="%s" applies class "%s"',
271
- (e, l) => {
272
- var u;
273
- const { container: h } = r(
274
- /* @__PURE__ */ o(c, { ...s("Hello", { maxWidth: e }) })
275
- );
276
- n((u = h.querySelector(".container")) == null ? void 0 : u.className).toContain(
277
- l
278
- );
279
- }
280
- ), a("defaults to maxWidthLg when maxWidth is not provided", () => {
281
- var l;
282
- const { container: e } = r(/* @__PURE__ */ o(c, { ...s("Hello") }));
283
- n((l = e.querySelector(".container")) == null ? void 0 : l.className).toContain(
284
- "maxWidthLg"
285
- );
286
- });
287
- });
288
- d("16. background class — capitalised and prefixed with 'background'", () => {
289
- a("applies backgroundGray for background='gray'", () => {
290
- var e;
291
- const { container: t } = r(
292
- /* @__PURE__ */ o(c, { ...s("Hello", { background: "gray" }) })
293
- );
294
- n((e = t.querySelector("section")) == null ? void 0 : e.className).toContain(
295
- "backgroundGray"
296
- );
297
- }), a("applies backgroundDark for background='dark'", () => {
298
- var e;
299
- const { container: t } = r(
300
- /* @__PURE__ */ o(c, { ...s("Hello", { background: "dark" }) })
301
- );
302
- n((e = t.querySelector("section")) == null ? void 0 : e.className).toContain(
303
- "backgroundDark"
304
- );
305
- }), a("does not add a background class when background is not provided", () => {
306
- var e;
307
- const { container: t } = r(/* @__PURE__ */ o(c, { ...s("Hello") }));
308
- n((e = t.querySelector("section")) == null ? void 0 : e.className).not.toContain(
309
- "background"
310
- );
311
- });
312
- });
313
- d("17. padding classes — array joined and applied to outer section", () => {
314
- a("applies a single padding class", () => {
315
- var e;
316
- const { container: t } = r(
317
- /* @__PURE__ */ o(c, { ...s("Hello", { padding: ["pt-8"] }) })
318
- );
319
- n((e = t.querySelector("section")) == null ? void 0 : e.className).toContain("pt-8");
320
- }), a("applies multiple padding classes", () => {
321
- var l;
322
- const { container: t } = r(
323
- /* @__PURE__ */ o(c, { ...s("Hello", { padding: ["pt-8", "pb-16"] }) })
324
- ), e = ((l = t.querySelector("section")) == null ? void 0 : l.className) ?? "";
325
- n(e).toContain("pt-8"), n(e).toContain("pb-16");
326
- }), a("does not add extra classes when padding is not provided", () => {
327
- var e;
328
- const { container: t } = r(/* @__PURE__ */ o(c, { ...s("Hello") }));
329
- n((e = t.querySelector("section")) == null ? void 0 : e.className.trim()).toBe(
330
- "markdownBlock"
331
- );
22
+ i("MarkdownBlock", () => {
23
+ const e = `# Hello
24
+
25
+ This is **markdown** content.`;
26
+ i("Rendering", () => {
27
+ o("renders a section element", async () => {
28
+ const { container: t } = await s({
29
+ content: e
30
+ });
31
+ n(t.querySelector("section")).toBeInTheDocument();
32
+ }), o("renders nothing when content is undefined", async () => {
33
+ const t = await c({});
34
+ n(t).toBeNull();
35
+ }), o("renders nothing when content is empty string", async () => {
36
+ const t = await c({
37
+ content: ""
38
+ });
39
+ n(t).toBeNull();
40
+ }), o("renders processed HTML via dangerouslySetInnerHTML", async () => {
41
+ const { container: t } = await s({
42
+ content: e
43
+ });
44
+ n(t.querySelector("p")).toBeInTheDocument();
45
+ }), o("renders with id prop", async () => {
46
+ var a;
47
+ const { container: t } = await s({
48
+ content: e,
49
+ id: "markdown-section"
50
+ });
51
+ n((a = t.querySelector("section")) == null ? void 0 : a.id).toBe("markdown-section");
52
+ }), o("accepts _key prop without error", async () => {
53
+ await n(
54
+ s({
55
+ content: e
56
+ })
57
+ ).resolves.not.toThrow();
58
+ });
59
+ }), i("Max width", () => {
60
+ o("applies large max width by default", async () => {
61
+ const { container: t } = await s({
62
+ content: e
63
+ });
64
+ n(
65
+ t.querySelector("[class*=maxWidthLg]")
66
+ ).toBeInTheDocument();
67
+ }), o("applies small max width", async () => {
68
+ const { container: t } = await s({
69
+ content: e,
70
+ styleOptions: { maxWidth: "sm" }
71
+ });
72
+ n(
73
+ t.querySelector("[class*=maxWidthSm]")
74
+ ).toBeInTheDocument();
75
+ }), o("applies medium max width", async () => {
76
+ const { container: t } = await s({
77
+ content: e,
78
+ styleOptions: { maxWidth: "md" }
79
+ });
80
+ n(
81
+ t.querySelector("[class*=maxWidthMd]")
82
+ ).toBeInTheDocument();
83
+ }), o("applies full max width", async () => {
84
+ const { container: t } = await s({
85
+ content: e,
86
+ styleOptions: { maxWidth: "full" }
87
+ });
88
+ n(
89
+ t.querySelector("[class*=maxWidthFull]")
90
+ ).toBeInTheDocument();
91
+ });
92
+ }), i("Style options", () => {
93
+ o("applies padding classes to section", async () => {
94
+ const { container: t } = await s({
95
+ content: e,
96
+ styleOptions: { padding: ["paddingTop4", "paddingBottom4"] }
97
+ }), a = t.querySelector("section");
98
+ n(a == null ? void 0 : a.className).toContain("paddingTop4"), n(a == null ? void 0 : a.className).toContain("paddingBottom4");
99
+ }), o("applies capitalised background class to section", async () => {
100
+ const { container: t } = await s({
101
+ content: e,
102
+ styleOptions: { background: "primary" }
103
+ }), a = t.querySelector("section");
104
+ n(a == null ? void 0 : a.className).toContain("backgroundPrimary");
105
+ }), o("renders without styleOptions", async () => {
106
+ const { container: t } = await s({
107
+ content: e
108
+ });
109
+ n(t.querySelector("section")).toBeInTheDocument();
110
+ }), o("accepts all styleOptions props without error", async () => {
111
+ await n(
112
+ s({
113
+ content: e,
114
+ styleOptions: {
115
+ padding: ["paddingTop2", "paddingBottom2"],
116
+ background: "white",
117
+ maxWidth: "md"
118
+ }
119
+ })
120
+ ).resolves.not.toThrow();
121
+ });
332
122
  });
333
123
  });