refactor: simplify slot API (#1202)

Closes #1096
This commit is contained in:
Juro Oravec 2025-05-20 09:48:45 +02:00 committed by GitHub
parent 7a49a7806c
commit f069255b64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 404 additions and 72 deletions

View file

@ -76,7 +76,7 @@ class TestComponentTyping:
kwargs=Button.Kwargs(name="name", age=123),
slots=Button.Slots(
header="HEADER",
footer=Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
footer=Slot(lambda ctx: "FOOTER"),
),
)
@ -124,7 +124,7 @@ class TestComponentTyping:
kwargs={"name": "name", "age": 123},
slots={
"header": "HEADER",
"footer": Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
"footer": Slot(lambda ctx: "FOOTER"),
},
)
@ -206,7 +206,7 @@ class TestComponentTyping:
kwargs={"name": "name", "age": 123},
slots={
"header": "HEADER",
"footer": Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
"footer": Slot(lambda ctx: "FOOTER"),
},
)
@ -314,7 +314,7 @@ class TestComponentTyping:
kwargs={"name": "name", "age": 123},
slots={
"header": "HEADER",
"footer": Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
"footer": Slot(lambda ctx: "FOOTER"),
},
)
@ -397,7 +397,7 @@ class TestComponentTyping:
kwargs=Button.Kwargs(name="name", age=123),
slots=Button.Slots(
header="HEADER",
footer=Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
footer=Slot(lambda ctx: "FOOTER"),
),
)
@ -412,7 +412,7 @@ class TestComponentTyping:
kwargs=Button.Kwargs(name="name", age=123),
slots=Button.Slots(
header="HEADER",
footer=Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
footer=Slot(lambda ctx: "FOOTER"),
),
)
@ -427,7 +427,7 @@ class TestComponentTyping:
kwargs=Button.Kwargs(age=123), # type: ignore[call-arg]
slots=Button.Slots(
header="HEADER",
footer=Slot(lambda ctx, slot_data, slot_ref: "FOOTER"),
footer=Slot(lambda ctx: "FOOTER"),
),
)
@ -438,7 +438,7 @@ class TestComponentTyping:
args=Button.Args(arg1="arg1", arg2="arg2"),
kwargs=Button.Kwargs(name="name", age=123),
slots=Button.Slots( # type: ignore[typeddict-item]
footer=Slot(lambda ctx, slot_data, slot_ref: "FOOTER"), # Missing header
footer=Slot(lambda ctx: "FOOTER"), # Missing header
),
)