|
@@ -686,14 +686,14 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
"children": [
|
|
|
{
|
|
|
"name": "RadixThemesText",
|
|
|
- "props": ['as={"p"}'],
|
|
|
+ "props": ['as:"p"'],
|
|
|
"contents": "",
|
|
|
"special_props": [],
|
|
|
"children": [
|
|
|
{
|
|
|
"name": "",
|
|
|
"props": [],
|
|
|
- "contents": '{"first_text"}',
|
|
|
+ "contents": '"first_text"',
|
|
|
"special_props": [],
|
|
|
"children": [],
|
|
|
"autofocus": False,
|
|
@@ -716,7 +716,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
{
|
|
|
"autofocus": False,
|
|
|
"children": [],
|
|
|
- "contents": '{"first_text"}',
|
|
|
+ "contents": '"first_text"',
|
|
|
"name": "",
|
|
|
"props": [],
|
|
|
"special_props": [],
|
|
@@ -724,7 +724,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
],
|
|
|
"contents": "",
|
|
|
"name": "RadixThemesText",
|
|
|
- "props": ['as={"p"}'],
|
|
|
+ "props": ['as:"p"'],
|
|
|
"special_props": [],
|
|
|
},
|
|
|
{
|
|
@@ -733,7 +733,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
{
|
|
|
"autofocus": False,
|
|
|
"children": [],
|
|
|
- "contents": '{"second_text"}',
|
|
|
+ "contents": '"second_text"',
|
|
|
"name": "",
|
|
|
"props": [],
|
|
|
"special_props": [],
|
|
@@ -741,7 +741,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
],
|
|
|
"contents": "",
|
|
|
"name": "RadixThemesText",
|
|
|
- "props": ['as={"p"}'],
|
|
|
+ "props": ['as:"p"'],
|
|
|
"special_props": [],
|
|
|
},
|
|
|
],
|
|
@@ -762,7 +762,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
{
|
|
|
"autofocus": False,
|
|
|
"children": [],
|
|
|
- "contents": '{"first_text"}',
|
|
|
+ "contents": '"first_text"',
|
|
|
"name": "",
|
|
|
"props": [],
|
|
|
"special_props": [],
|
|
@@ -770,7 +770,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
],
|
|
|
"contents": "",
|
|
|
"name": "RadixThemesText",
|
|
|
- "props": ['as={"p"}'],
|
|
|
+ "props": ['as:"p"'],
|
|
|
"special_props": [],
|
|
|
},
|
|
|
{
|
|
@@ -785,7 +785,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
{
|
|
|
"autofocus": False,
|
|
|
"children": [],
|
|
|
- "contents": '{"second_text"}',
|
|
|
+ "contents": '"second_text"',
|
|
|
"name": "",
|
|
|
"props": [],
|
|
|
"special_props": [],
|
|
@@ -793,7 +793,7 @@ def test_component_create_unallowed_types(children, test_component):
|
|
|
],
|
|
|
"contents": "",
|
|
|
"name": "RadixThemesText",
|
|
|
- "props": ['as={"p"}'],
|
|
|
+ "props": ['as:"p"'],
|
|
|
"special_props": [],
|
|
|
}
|
|
|
],
|
|
@@ -1163,10 +1163,10 @@ def test_component_with_only_valid_children(fixture, request):
|
|
|
@pytest.mark.parametrize(
|
|
|
"component,rendered",
|
|
|
[
|
|
|
- (rx.text("hi"), '<RadixThemesText as={"p"}>\n\n{"hi"}\n</RadixThemesText>'),
|
|
|
+ (rx.text("hi"), 'jsx(\nRadixThemesText,\n{as:"p"},\n"hi"\n,)'),
|
|
|
(
|
|
|
rx.box(rx.heading("test", size="3")),
|
|
|
- '<RadixThemesBox>\n\n<RadixThemesHeading size={"3"}>\n\n{"test"}\n</RadixThemesHeading>\n</RadixThemesBox>',
|
|
|
+ 'jsx(\nRadixThemesBox,\n{},\njsx(\nRadixThemesHeading,\n{size:"3"},\n"test"\n,),)',
|
|
|
),
|
|
|
],
|
|
|
)
|
|
@@ -1789,14 +1789,14 @@ def test_rename_props():
|
|
|
|
|
|
c1 = C1.create(prop1="prop1_1", prop2="prop2_1")
|
|
|
rendered_c1 = c1.render()
|
|
|
- assert 'renamed_prop1={"prop1_1"}' in rendered_c1["props"]
|
|
|
- assert 'renamed_prop2={"prop2_1"}' in rendered_c1["props"]
|
|
|
+ assert 'renamed_prop1:"prop1_1"' in rendered_c1["props"]
|
|
|
+ assert 'renamed_prop2:"prop2_1"' in rendered_c1["props"]
|
|
|
|
|
|
c2 = C2.create(prop1="prop1_2", prop2="prop2_2", prop3="prop3_2")
|
|
|
rendered_c2 = c2.render()
|
|
|
- assert 'renamed_prop1={"prop1_2"}' in rendered_c2["props"]
|
|
|
- assert 'subclass_prop2={"prop2_2"}' in rendered_c2["props"]
|
|
|
- assert 'renamed_prop3={"prop3_2"}' in rendered_c2["props"]
|
|
|
+ assert 'renamed_prop1:"prop1_2"' in rendered_c2["props"]
|
|
|
+ assert 'subclass_prop2:"prop2_2"' in rendered_c2["props"]
|
|
|
+ assert 'renamed_prop3:"prop3_2"' in rendered_c2["props"]
|
|
|
|
|
|
|
|
|
def test_custom_component_get_imports():
|
|
@@ -2183,7 +2183,7 @@ def test_add_style_embedded_vars(test_state: BaseState):
|
|
|
assert "useParent" in page._get_all_hooks_internal()
|
|
|
assert (
|
|
|
str(page).count(
|
|
|
- f'css={{({{ ["fakeParent"] : "parent", ["color"] : "var(--plum-10)", ["fake"] : "text", ["margin"] : ({test_state.get_name()}.num+"%") }})}}'
|
|
|
+ f'css:({{ ["fakeParent"] : "parent", ["color"] : "var(--plum-10)", ["fake"] : "text", ["margin"] : ({test_state.get_name()}.num+"%") }})'
|
|
|
)
|
|
|
== 1
|
|
|
)
|
|
@@ -2204,10 +2204,10 @@ def test_add_style_foreach():
|
|
|
assert len(page.children[0].children) == 1
|
|
|
|
|
|
# Expect the style to be added to the child of the foreach
|
|
|
- assert 'css={({ ["color"] : "red" })}' in str(page.children[0].children[0])
|
|
|
+ assert 'css:({ ["color"] : "red" })' in str(page.children[0].children[0])
|
|
|
|
|
|
# Expect only one instance of this CSS dict in the rendered page
|
|
|
- assert str(page).count('css={({ ["color"] : "red" })}') == 1
|
|
|
+ assert str(page).count('css:({ ["color"] : "red" })') == 1
|
|
|
|
|
|
|
|
|
class TriggerState(rx.State):
|