Skip to content

Commit 773aab8

Browse files
committed
Update test_markdown assertions
1 parent 42b3be3 commit 773aab8

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

tests/units/components/markdown/test_markdown.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ def test_create_map_fn_var_subclass(cls, fn_body, fn_args, explicit_return, expe
146146
(
147147
"code",
148148
{},
149-
r"""(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return inline ? ( jsx(RadixThemesCode,{...props},children) ) : ( jsx(SyntaxHighlighter,{children:((Array.isArray(children)) ? children.join("\n") : children),css:({ ["marginTop"] : "1em", ["marginBottom"] : "1em" }),language:_language,style:((resolvedColorMode?.valueOf?.() === "light"?.valueOf?.()) ? oneLight : oneDark),wrapLongLines:true,...props},) ); })""",
149+
r"""(({node, children, ...props}) => (jsx(RadixThemesCode,{...props},children)))""",
150150
),
151151
(
152-
"code",
152+
"pre",
153153
{
154-
"codeblock": lambda value, **props: ShikiHighLevelCodeBlock.create(
154+
"pre": lambda value, **props: ShikiHighLevelCodeBlock.create(
155155
value, **props
156156
)
157157
},
158-
r"""(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return inline ? ( jsx(RadixThemesCode,{...props},children) ) : ( jsx(RadixThemesBox,{css:({ ["pre"] : ({ ["margin"] : "0", ["padding"] : "24px", ["background"] : "transparent", ["overflowX"] : "auto", ["borderRadius"] : "6px" }) }),...props},jsx(ShikiCode,{code:((Array.isArray(children)) ? children.join("\n") : children),decorations:[],language:_language,theme:((resolvedColorMode?.valueOf?.() === "light"?.valueOf?.()) ? "one-light" : "one-dark-pro"),transformers:[]},)) ); })""",
158+
r"""(({node, ...rest}) => { const {node: childNode, className, children: components, ...props} = rest.children.props; const children = String(Array.isArray(components) ? components.join('\n') : components).replace(/\n$/, ''); const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return jsx(RadixThemesBox,{css:({ ["pre"] : ({ ["margin"] : "0", ["padding"] : "24px", ["background"] : "transparent", ["overflowX"] : "auto", ["borderRadius"] : "6px" }) }),...props},jsx(ShikiCode,{code:children,decorations:[],language:_language,theme:((resolvedColorMode?.valueOf?.() === "light"?.valueOf?.()) ? "one-light" : "one-dark-pro"),transformers:[]},)); })""",
159159
),
160160
(
161161
"h1",
@@ -167,18 +167,14 @@ def test_create_map_fn_var_subclass(cls, fn_body, fn_args, explicit_return, expe
167167
"""(({custom_node, custom_children, custom_props}) => (jsx(CustomMarkdownComponent,{...props},jsx(RadixThemesHeading,{as:"h1",css:({ ["marginTop"] : "0.5em", ["marginBottom"] : "0.5em" }),size:"6"},children))))""",
168168
),
169169
(
170-
"code",
171-
{"codeblock": syntax_highlighter_memoized_component(CodeBlock)},
172-
r"""(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return inline ? ( jsx(RadixThemesCode,{...props},children) ) : ( jsx(CodeBlock,{code:((Array.isArray(children)) ? children.join("\n") : children),language:_language,...props},) ); })""",
170+
"pre",
171+
{"pre": syntax_highlighter_memoized_component(CodeBlock)},
172+
r"""(({node, ...rest}) => { const {node: childNode, className, children: components, ...props} = rest.children.props; const children = String(Array.isArray(components) ? components.join('\n') : components).replace(/\n$/, ''); const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return jsx(CodeBlock,{code:children,language:_language,...props},); })""",
173173
),
174174
(
175-
"code",
176-
{
177-
"codeblock": syntax_highlighter_memoized_component(
178-
ShikiHighLevelCodeBlock
179-
)
180-
},
181-
r"""(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return inline ? ( jsx(RadixThemesCode,{...props},children) ) : ( jsx(CodeBlock,{code:((Array.isArray(children)) ? children.join("\n") : children),language:_language,...props},) ); })""",
175+
"pre",
176+
{"pre": syntax_highlighter_memoized_component(ShikiHighLevelCodeBlock)},
177+
r"""(({node, ...rest}) => { const {node: childNode, className, children: components, ...props} = rest.children.props; const children = String(Array.isArray(components) ? components.join('\n') : components).replace(/\n$/, ''); const match = (className || '').match(/language-(?<lang>.*)/); let _language = match ? match[1] : ''; ; return jsx(CodeBlock,{code:children,language:_language,...props},); })""",
182178
),
183179
],
184180
)

0 commit comments

Comments
 (0)