Skip to content

Commit d9630a9

Browse files
committed
add test for #3077
1 parent 66e0f62 commit d9630a9

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from dash import Dash, html
2+
3+
4+
def test_api001_assets_path_ignore(dash_duo):
5+
app = Dash(
6+
__name__,
7+
assets_folder="test_assets_path_ignore_assets",
8+
assets_path_ignore=["should_be_ignored"],
9+
)
10+
app.index_string = """<!DOCTYPE html>
11+
<html>
12+
<head>
13+
{%metas%}
14+
<title>{%title%}</title>
15+
{%css%}
16+
</head>
17+
<body>
18+
<div id="normal-test-target"></div>
19+
<div id="ignored-test-target"></div>
20+
{%app_entry%}
21+
<footer>
22+
{%config%}
23+
{%scripts%}
24+
{%renderer%}
25+
</footer>
26+
</body>
27+
</html>"""
28+
29+
app.layout = html.Div()
30+
31+
dash_duo.start_server(app)
32+
33+
assert (
34+
dash_duo.find_element("#normal-test-target").value_of_css_property(
35+
"background-color"
36+
)
37+
== "rgba(255, 0, 0, 1)"
38+
)
39+
40+
assert (
41+
dash_duo.find_element("#ignored-test-target").value_of_css_property(
42+
"background-color"
43+
)
44+
!= "rgba(255, 0, 0, 1)"
45+
)
46+
47+
normal_target_content = dash_duo.find_element("#normal-test-target").text
48+
ignored_target_content = dash_duo.find_element("#ignored-test-target").text
49+
50+
assert normal_target_content == "loaded"
51+
assert ignored_target_content != "loaded"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#normal-test-target {
2+
background-color: rgba(255, 0, 0, 1);
3+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const normalTarget = document.getElementById('normal-test-target');
2+
normalTarget.innerHTML = 'loaded';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#ignored-test-target {
2+
background-color: rgba(255, 0, 0, 1);
3+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const ignoredTarget = document.getElementById('ignored-test-target');
2+
ignoredTarget.innerHTML = 'loaded';

0 commit comments

Comments
 (0)