@@ -13,7 +13,7 @@ def test_lipa001_path(dash_dcc):
13
13
]
14
14
)
15
15
16
- @app .callback (Output ("content" , "children" ), [ Input ("url" , "pathname" )] )
16
+ @app .callback (Output ("content" , "children" ), Input ("url" , "pathname" ))
17
17
def display_children (children ):
18
18
return children
19
19
@@ -29,12 +29,23 @@ def display_children(children):
29
29
@pytest .mark .DCC782
30
30
def test_lipa002_path (dash_dcc ):
31
31
app = Dash (__name__ )
32
+
33
+ def extras (t ):
34
+ return f"""<!DOCTYPE html>
35
+ <html><body>
36
+ { t [::- 1 ]}
37
+ </body></html>
38
+ """
39
+ app .server .add_url_rule (
40
+ "/extra/<string:t>" , view_func = extras , endpoint = "/extra/<string:t>" , methods = ["GET" ]
41
+ )
42
+
32
43
app .layout = html .Div (
33
44
[
34
45
dcc .Link (
35
46
children = "Absolute Path" ,
36
47
id = "link1" ,
37
- href = "https://google.com " ,
48
+ href = dash_dcc . server . url + "/extra/eseehc " ,
38
49
refresh = True ,
39
50
),
40
51
dcc .Location (id = "url" , refresh = False ),
@@ -44,12 +55,13 @@ def test_lipa002_path(dash_dcc):
44
55
45
56
dash_dcc .wait_for_element ("#link1" ).click ()
46
57
47
- location = dash_dcc .driver .execute_script (
58
+ location , text = dash_dcc .driver .execute_script (
48
59
"""
49
- return window.location.href
60
+ return [ window.location.href, document.body.textContent.trim()]
50
61
"""
51
62
)
52
63
53
- assert location == "https://www.google.com/"
64
+ assert location == dash_dcc .server .url + "/extra/eseehc"
65
+ assert text == "cheese"
54
66
55
67
assert dash_dcc .get_logs () == []
0 commit comments