Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 2c07198

Browse files
committed
Change CHANGELOG, add empty graph test.
1 parent 67e0064 commit 2c07198

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [0.28.1]
5+
## [0.28.1] - 2018-08-29
6+
### Changed
7+
- `candlestick` and `OHLC` charts are now plotted using the `Plotly.react` method instead of the `Plotly.newPlot` method.
68
### Fixed
79
- Fix bug where front-end error was thrown when setting `Graph.figure = {}` (fixes [#260]).
810

test/IntegrationTests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from selenium import webdriver
1313
from selenium.webdriver.chrome.options import Options
14+
from selenium.webdriver.support.ui import WebDriverWait
1415

1516

1617
class IntegrationTests(unittest.TestCase):
@@ -25,6 +26,7 @@ def setUpClass(cls):
2526
options.binary_location = os.environ['DASH_TEST_CHROMEPATH']
2627

2728
cls.driver = webdriver.Chrome(chrome_options=options)
29+
cls.wait = WebDriverWait(cls.driver, 20)
2830
loader = percy.ResourceLoader(webdriver=cls.driver)
2931
cls.percy_runner = percy.Runner(loader=loader)
3032
cls.percy_runner.initialize_build()

test/test_integration.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
import dash_html_components as html
1313
import dash_core_components as dcc
1414
import dash_table_experiments as dt
15-
from selenium import webdriver
15+
from selenium.webdriver.common.by import By
1616
from selenium.webdriver.common.keys import Keys
17+
from selenium.webdriver.support import expected_conditions as EC
1718
from selenium.common.exceptions import InvalidElementStateException
1819

1920
from textwrap import dedent
@@ -851,3 +852,30 @@ def on_click(n_clicks):
851852
time.sleep(2)
852853

853854
self.driver.switch_to.alert.accept()
855+
856+
def test_empty_graph(self):
857+
app = dash.Dash(__name__)
858+
859+
app.layout = html.Div([
860+
html.Button(id='click', children='Click me'),
861+
dcc.Graph(
862+
id='graph',
863+
figure={
864+
'data': dict(x=[1, 2, 3], y=[1, 2, 3])
865+
}
866+
)
867+
])
868+
869+
@app.callback(dash.dependencies.Output('graph', 'figure'),
870+
[dash.dependencies.Input('click', 'n_clicks')],
871+
[dash.dependencies.State('graph', 'figure')])
872+
def render_content(click, prev_graph):
873+
if click:
874+
return {}
875+
return prev_graph
876+
877+
self.startServer(app=app)
878+
self.wait.until(EC.element_to_be_clickable((By.ID, 'click')))
879+
self.driver.find_element_by_css_selector('#click').click()
880+
time.sleep(2) # Wait for graph to re-render
881+
self.snapshot('render-empty-graph')

0 commit comments

Comments
 (0)