Skip to content

Commit b67101a

Browse files
committed
add test for link search params
1 parent 1723f8d commit b67101a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_core.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,24 @@ def sample():
226226

227227
await display.page.go_back()
228228
await display.page.wait_for_selector("#root")
229+
230+
231+
async def test_link_with_query_string(display: DisplayFixture):
232+
@component
233+
def check_search_params():
234+
query = use_search_params()
235+
assert query == {"a": ["1"], "b": ["2"]}
236+
return html.h1({"id": "success"}, "success")
237+
238+
@component
239+
def sample():
240+
return browser_router(
241+
route("/", link("Root", to="/a?a=1&b=2", id="root")),
242+
route("/a", check_search_params()),
243+
)
244+
245+
await display.show(sample)
246+
await display.page.wait_for_selector("#root")
247+
lnk = await display.page.wait_for_selector("#root")
248+
await lnk.click()
249+
await display.page.wait_for_selector("#success")

0 commit comments

Comments
 (0)