@@ -85,18 +85,18 @@ async def test_navigate_with_link(display: DisplayFixture):
8585 def sample ():
8686 render_count .current += 1
8787 return browser_router (
88- route ("/" , link ("Root" , to = "/a" , id = " root" )),
89- route ("/a" , link ("A" , to = "/b" , id = "a " )),
90- route ("/b" , link ("B" , to = "/c" , id = "b " )),
91- route ("/c" , link ("C" , to = "/default" , id = "c " )),
88+ route ("/" , link ({ "to" : "/a" , "id" : " root" }, "Root " )),
89+ route ("/a" , link ({ "to" : "/b" , "id" : "a" }, "A " )),
90+ route ("/b" , link ({ "to" : "/c" , "id" : "b" }, "B " )),
91+ route ("/c" , link ({ "to" : "/default" , "id" : "c" }, "C " )),
9292 route ("{default:any}" , html .h1 ({"id" : "default" }, "Default" )),
9393 )
9494
9595 await display .show (sample )
9696
9797 for link_selector in ["#root" , "#a" , "#b" , "#c" ]:
98- lnk = await display .page .wait_for_selector (link_selector )
99- await lnk .click (delay = CLICK_DELAY )
98+ _link = await display .page .wait_for_selector (link_selector )
99+ await _link .click (delay = CLICK_DELAY )
100100
101101 await display .page .wait_for_selector ("#default" )
102102
@@ -164,18 +164,18 @@ async def test_browser_popstate(display: DisplayFixture):
164164 @component
165165 def sample ():
166166 return browser_router (
167- route ("/" , link ("Root" , to = "/a" , id = " root" )),
168- route ("/a" , link ("A" , to = "/b" , id = "a " )),
169- route ("/b" , link ("B" , to = "/c" , id = "b " )),
170- route ("/c" , link ("C" , to = "/default" , id = "c " )),
167+ route ("/" , link ({ "to" : "/a" , "id" : " root" }, "Root " )),
168+ route ("/a" , link ({ "to" : "/b" , "id" : "a" }, "A " )),
169+ route ("/b" , link ({ "to" : "/c" , "id" : "b" }, "B " )),
170+ route ("/c" , link ({ "to" : "/default" , "id" : "c" }, "C " )),
171171 route ("{default:any}" , html .h1 ({"id" : "default" }, "Default" )),
172172 )
173173
174174 await display .show (sample )
175175
176176 for link_selector in ["#root" , "#a" , "#b" , "#c" ]:
177- lnk = await display .page .wait_for_selector (link_selector )
178- await lnk .click (delay = CLICK_DELAY )
177+ _link = await display .page .wait_for_selector (link_selector )
178+ await _link .click (delay = CLICK_DELAY )
179179
180180 await display .page .wait_for_selector ("#default" )
181181
@@ -196,21 +196,21 @@ async def test_relative_links(display: DisplayFixture):
196196 @component
197197 def sample ():
198198 return browser_router (
199- route ("/" , link ("Root" , to = "/ a" , id = " root" )),
200- route ("/a" , link ("A" , to = "/ a/a/../b" , id = "a " )),
201- route ("/a/b" , link ("B" , to = "../a/b/c" , id = "b " )),
202- route ("/a/b/c" , link ("C" , to = "../d" , id = "c " )),
203- route ("/a/d" , link ("D" , to = "e" , id = "d " )),
204- route ("/a/e" , link ("E" , to = "/a/./f" , id = "e " )),
205- route ("/a/f" , link ("F" , to = "../default" , id = "f " )),
199+ route ("/" , link ({ "to" : " a" , "id" : " root" }, "Root " )),
200+ route ("/a" , link ({ "to" : " a/a/../b" , "id" : "a" }, "A " )),
201+ route ("/a/b" , link ({ "to" : "../a/b/c" , "id" : "b" }, "B " )),
202+ route ("/a/b/c" , link ({ "to" : "../d" , "id" : "c" }, "C " )),
203+ route ("/a/d" , link ({ "to" : "e" , "id" : "d" }, "D " )),
204+ route ("/a/e" , link ({ "to" : "/a/./f" , "id" : "e" }, "E " )),
205+ route ("/a/f" , link ({ "to" : "../default" , "id" : "f" }, "F " )),
206206 route ("{default:any}" , html .h1 ({"id" : "default" }, "Default" )),
207207 )
208208
209209 await display .show (sample )
210210
211211 for link_selector in ["#root" , "#a" , "#b" , "#c" , "#d" , "#e" , "#f" ]:
212- lnk = await display .page .wait_for_selector (link_selector )
213- await lnk .click (delay = CLICK_DELAY )
212+ _link = await display .page .wait_for_selector (link_selector )
213+ await _link .click (delay = CLICK_DELAY )
214214
215215 await display .page .wait_for_selector ("#default" )
216216
@@ -246,23 +246,34 @@ def check_search_params():
246246 @component
247247 def sample ():
248248 return browser_router (
249- route ("/" , link ("Root" , to = "/a?a=1&b=2" , id = " root" )),
249+ route ("/" , link ({ "to" : "/a?a=1&b=2" , "id" : " root" }, "Root " )),
250250 route ("/a" , check_search_params ()),
251251 )
252252
253253 await display .show (sample )
254254 await display .page .wait_for_selector ("#root" )
255- lnk = await display .page .wait_for_selector ("#root" )
256- await lnk .click (delay = CLICK_DELAY )
255+ _link = await display .page .wait_for_selector ("#root" )
256+ await _link .click (delay = CLICK_DELAY )
257257 await display .page .wait_for_selector ("#success" )
258258
259259
260260async def test_link_class_name (display : DisplayFixture ):
261261 @component
262262 def sample ():
263- return browser_router (route ("/" , link ("Root" , to = "/a" , id = " root" , className = " class1" )))
263+ return browser_router (route ("/" , link ({ "to" : "/a" , "id" : " root" , " className" : " class1" }, "Root " )))
264264
265265 await display .show (sample )
266266
267- lnk = await display .page .wait_for_selector ("#root" )
268- assert "class1" in await lnk .get_attribute ("class" )
267+ _link = await display .page .wait_for_selector ("#root" )
268+ assert "class1" in await _link .get_attribute ("class" )
269+
270+
271+ async def test_link_href (display : DisplayFixture ):
272+ @component
273+ def sample ():
274+ return browser_router (route ("/" , link ({"href" : "/a" , "id" : "root" }, "Root" )))
275+
276+ await display .show (sample )
277+
278+ _link = await display .page .wait_for_selector ("#root" )
279+ assert "/a" in await _link .get_attribute ("href" )
0 commit comments