Skip to content

Commit 9ec7054

Browse files
authored
feat: support 'select' in HXLocation (#12)
- adds support for 'select' param of HXLocation - extends the HXLocation tests for 'select' - fixes a typo in CONTRIBUTING.md resolves issue #11
1 parent 1be9b70 commit 9ec7054

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Workflow
1818
2. Clone your fork locally with git
1919
3. `Set up the environment <#setting-up-the-environment>`_
2020
4. Make your changes
21-
5. Run ``male lint`` to run linters and formatters. This step is optional and will be executed
21+
5. Run ``make lint`` to run linters and formatters. This step is optional and will be executed
2222
automatically by git before you make a commit, but you may want to run it manually in order to apply fixes
2323
6. Commit your changes to git
2424
7. Push the changes to your fork

litestar_htmx/response.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def __init__(
135135
source: str | None = None,
136136
event: str | None = None,
137137
target: str | None = None,
138+
select: str | None = None,
138139
swap: ReSwapMethod | None = None,
139140
hx_headers: dict[str, Any] | None = None,
140141
values: dict[str, str] | None = None,
@@ -155,6 +156,7 @@ def __init__(
155156
source=source,
156157
event=event,
157158
target=target,
159+
select=select,
158160
swap=swap,
159161
values=values,
160162
hx_headers=hx_headers,

litestar_htmx/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class LocationType(TypedDict):
2424
source: str | None
2525
event: str | None
2626
target: str | None
27+
select: str | None
2728
swap: ReSwapMethod | None
2829
values: dict[str, str] | None
2930
hx_headers: dict[str, Any] | None

tests/test_htmx_response.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def handler() -> HXLocation:
219219
source="#button",
220220
event="click",
221221
target="#content",
222+
select="#content",
222223
swap="innerHTML",
223224
hx_headers={"attribute": "value"},
224225
values={"action": "true"},
@@ -230,7 +231,7 @@ def handler() -> HXLocation:
230231
assert response.status_code == HTTP_200_OK
231232
assert "Location" not in response.headers
232233
assert spec == (
233-
'{"path":"/contact-us","source":"#button","event":"click","target":"#content","swap":"innerHTML",'
234+
'{"path":"/contact-us","source":"#button","event":"click","target":"#content","select":"#content","swap":"innerHTML",'
234235
'"values":{"action":"true"},"hx_headers":{"attribute":"value"}}'
235236
)
236237

0 commit comments

Comments
 (0)