2
2
3
3
from reactpy import Ref , component , html , use_location
4
4
from reactpy .testing import DisplayFixture
5
- from reactpy_router import link , route , routers , use_params , use_search_params
5
+ from reactpy_router import browser_router , link , route , use_params , use_search_params
6
6
7
7
8
8
async def test_simple_router (display : DisplayFixture ):
@@ -18,7 +18,7 @@ def check_location():
18
18
19
19
@component
20
20
def sample ():
21
- return routers . browser_router (
21
+ return browser_router (
22
22
make_location_check ("/a" ),
23
23
make_location_check ("/b" ),
24
24
make_location_check ("/c" ),
@@ -40,8 +40,8 @@ def sample():
40
40
root_element = await display .root_element ()
41
41
except AttributeError :
42
42
root_element = await display .page .wait_for_selector (
43
- f"#display-{ display ._next_view_id } " ,
44
- state = "attached" , # type: ignore
43
+ f"#display-{ display ._next_view_id } " , # type: ignore
44
+ state = "attached" ,
45
45
)
46
46
47
47
assert not await root_element .inner_html ()
@@ -50,7 +50,7 @@ def sample():
50
50
async def test_nested_routes (display : DisplayFixture ):
51
51
@component
52
52
def sample ():
53
- return routers . browser_router (
53
+ return browser_router (
54
54
route (
55
55
"/a" ,
56
56
html .h1 ({"id" : "a" }, "A" ),
@@ -79,7 +79,7 @@ async def test_navigate_with_link(display: DisplayFixture):
79
79
@component
80
80
def sample ():
81
81
render_count .current += 1
82
- return routers . browser_router (
82
+ return browser_router (
83
83
route ("/" , link ("Root" , to = "/a" , id = "root" )),
84
84
route ("/a" , link ("A" , to = "/b" , id = "a" )),
85
85
route ("/b" , link ("B" , to = "/c" , id = "b" )),
@@ -110,7 +110,7 @@ def check_params():
110
110
111
111
@component
112
112
def sample ():
113
- return routers . browser_router (
113
+ return browser_router (
114
114
route (
115
115
"/first/{first:str}" ,
116
116
check_params (),
@@ -146,7 +146,7 @@ def check_query():
146
146
147
147
@component
148
148
def sample ():
149
- return routers . browser_router (route ("/" , check_query ()))
149
+ return browser_router (route ("/" , check_query ()))
150
150
151
151
await display .show (sample )
152
152
@@ -158,7 +158,7 @@ def sample():
158
158
async def test_browser_popstate (display : DisplayFixture ):
159
159
@component
160
160
def sample ():
161
- return routers . browser_router (
161
+ return browser_router (
162
162
route ("/" , link ("Root" , to = "/a" , id = "root" )),
163
163
route ("/a" , link ("A" , to = "/b" , id = "a" )),
164
164
route ("/b" , link ("B" , to = "/c" , id = "b" )),
@@ -190,7 +190,7 @@ def sample():
190
190
async def test_relative_links (display : DisplayFixture ):
191
191
@component
192
192
def sample ():
193
- return routers . browser_router (
193
+ return browser_router (
194
194
route ("/" , link ("Root" , to = "/a" , id = "root" )),
195
195
route ("/a" , link ("A" , to = "/a/b" , id = "a" )),
196
196
route ("/a/b" , link ("B" , to = "../a/b/c" , id = "b" )),
0 commit comments