Skip to content

Commit 32ee461

Browse files
Added graph responsive test.
1 parent d7d9609 commit 32ee461

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

components/dash-core-components/tests/integration/graph/test_graph_responsive.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import numpy as np
2+
import plotly.graph_objects as go
13
import pytest
24

35
from dash import Dash, Input, Output, State, dcc, html
@@ -134,3 +136,33 @@ def resize(n_clicks, style):
134136
)
135137

136138
assert dash_dcc.get_logs() == []
139+
140+
141+
def test_grrs002_responsive_parent_height(dash_dcc):
142+
app = Dash(__name__, eager_loading=True)
143+
144+
x, y = np.random.uniform(size=50), np.random.uniform(size=50)
145+
146+
fig = go.Figure(
147+
data=[go.Scattergl(x=x, y=y, mode="markers")],
148+
layout=dict(margin=dict(l=0, r=0, t=0, b=0), height=600, width=600),
149+
)
150+
151+
app.layout = html.Div(
152+
dcc.Graph(
153+
id="graph",
154+
figure=fig,
155+
responsive=True,
156+
),
157+
style={"borderStyle": "solid", "height": 300, "width": 100},
158+
)
159+
160+
dash_dcc.start_server(app)
161+
162+
wait.until(
163+
lambda: dash_dcc.wait_for_element("#graph svg.main-svg").size.get("height", -1)
164+
== 300,
165+
3,
166+
)
167+
168+
assert dash_dcc.get_logs() == []

0 commit comments

Comments
 (0)