Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 7da34d5

Browse files
committed
Add integration test for resizing unmounted graphs
1 parent 0d7c47e commit 7da34d5

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

test/test_integration.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,3 +2407,68 @@ def on_click(n_clicks):
24072407
type_change
24082408
)
24092409
)
2410+
2411+
def test_unmounted_graph_resize(self):
2412+
app = dash.Dash(__name__)
2413+
2414+
app.layout = html.Div(children=[
2415+
dcc.Tabs(id="tabs", children=[
2416+
dcc.Tab(label='Tab one', children=[
2417+
html.Div([
2418+
dcc.Graph(
2419+
id='eg-graph-1',
2420+
figure={
2421+
'data': [
2422+
{'x': [1, 2, 3], 'y': [4, 1, 2],
2423+
'type': 'scattergl', 'name': 'SF'},
2424+
{'x': [1, 2, 3], 'y': [2, 4, 5],
2425+
'type': 'scattergl', 'name': u'Montréal'},
2426+
]
2427+
}
2428+
)
2429+
], id='graph-tab-1')
2430+
]),
2431+
dcc.Tab(label='Tab two', children=[
2432+
dcc.Graph(
2433+
id='eg-graph-2',
2434+
figure={
2435+
'data': [
2436+
{'x': [1, 2, 3], 'y': [1, 4, 1],
2437+
'type': 'scattergl', 'name': 'SF'},
2438+
{'x': [1, 2, 3], 'y': [1, 2, 3],
2439+
'type': 'scattergl', 'name': u'Montréal'},
2440+
]
2441+
}
2442+
)
2443+
], id='graph-tab-2'),
2444+
])
2445+
])
2446+
2447+
self.startServer(app)
2448+
2449+
try:
2450+
self.wait_for_element_by_css_selector('#eg-graph-1')
2451+
except Exception as e:
2452+
print(self.wait_for_element_by_css_selector(
2453+
'#_dash-app-content').get_attribute('innerHTML'))
2454+
raise e
2455+
2456+
WebDriverWait(self.driver, 10).until(
2457+
EC.element_to_be_clickable((By.ID, "graph-tab-2"))
2458+
)
2459+
2460+
tab_two = self.wait_for_element_by_css_selector('#graph-tab-2')
2461+
2462+
tab_two.click()
2463+
2464+
# save the current window size
2465+
window_size = self.driver.get_window_size()
2466+
2467+
# resize
2468+
self.driver.set_window_size(800, 600)
2469+
2470+
for entry in self.get_log():
2471+
raise Exception('browser error logged during test', entry)
2472+
2473+
# set back to original size
2474+
self.driver.set_window_size(window_size['width'], window_size['height'])

0 commit comments

Comments
 (0)