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

Commit 0ca07bd

Browse files
authored
Merge branch 'master' into 0.44.0-issue591
2 parents d3002a3 + 77d327f commit 0ca07bd

File tree

4 files changed

+51
-28
lines changed

4 files changed

+51
-28
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +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+
## [unreleased]
6+
### Fixed
7+
- Fix Vertical Slider regression [#479](https://github.com/plotly/dash/issues/479)
58

69
## [0.44.0] - 2019-03-04
710
### Added

src/components/Slider.react.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ export default class Slider extends Component {
1818
}
1919

2020
render() {
21-
const {id, setProps, updatemode, loading_state} = this.props;
21+
const {id, loading_state, setProps, updatemode, vertical} = this.props;
2222
const {value} = this.state;
2323
return (
2424
<div
2525
id={id}
2626
data-dash-is-loading={
2727
(loading_state && loading_state.is_loading) || undefined
2828
}
29+
style={vertical ? {height: '100%'} : {}}
2930
>
3031
<ReactSlider
3132
onChange={value => {

test/IntegrationTests.py

Lines changed: 18 additions & 27 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.common.desired_capabilities import DesiredCapabilities
1415

1516

1617
class IntegrationTests(unittest.TestCase):
@@ -20,11 +21,13 @@ def setUpClass(cls):
2021
super(IntegrationTests, cls).setUpClass()
2122

2223
options = Options()
24+
capabilities = DesiredCapabilities.CHROME
25+
capabilities['loggingPrefs'] = {'browser': 'SEVERE'}
2326

2427
if 'DASH_TEST_CHROMEPATH' in os.environ:
2528
options.binary_location = os.environ['DASH_TEST_CHROMEPATH']
2629

27-
cls.driver = webdriver.Chrome(chrome_options=options)
30+
cls.driver = webdriver.Chrome(options=options, desired_capabilities=capabilities)
2831
loader = percy.ResourceLoader(
2932
webdriver=cls.driver,
3033
base_url='/assets',
@@ -47,7 +50,8 @@ def tearDown(self):
4750
requests.get('http://localhost:8050/stop')
4851
else:
4952
self.server_process.terminate()
50-
self.driver.back()
53+
54+
self.clear_log()
5155
time.sleep(1)
5256

5357
def startServer(self, app):
@@ -103,28 +107,15 @@ def _stop_server_windows():
103107
# Visit the dash page
104108
self.driver.get('http://localhost:8050')
105109

106-
# Inject an error and warning logger
107-
logger = '''
108-
window.tests = {};
109-
window.tests.console = {error: [], warn: [], log: []};
110-
111-
var _log = console.log;
112-
var _warn = console.warn;
113-
var _error = console.error;
114-
115-
console.log = function() {
116-
window.tests.console.log.push({method: 'log', arguments: arguments});
117-
return _log.apply(console, arguments);
118-
};
119-
120-
console.warn = function() {
121-
window.tests.console.warn.push({method: 'warn', arguments: arguments});
122-
return _warn.apply(console, arguments);
123-
};
124-
125-
console.error = function() {
126-
window.tests.console.error.push({method: 'error', arguments: arguments});
127-
return _error.apply(console, arguments);
128-
};
129-
'''
130-
self.driver.execute_script(logger)
110+
def clear_log(self):
111+
entries = self.driver.get_log("browser")
112+
113+
if entries:
114+
self.last_timestamp = entries[-1]["timestamp"]
115+
116+
def get_log(self):
117+
entries = self.driver.get_log("browser")
118+
119+
return [entry for entry in entries if entry["timestamp"] > self.last_timestamp]
120+
121+
last_timestamp = 0

test/test_integration.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,34 @@ def test_upload_gallery(self):
217217

218218
self.snapshot('test_upload_gallery')
219219

220+
def test_vertical_slider(self):
221+
app = dash.Dash(__name__)
222+
223+
app.layout = html.Div([
224+
html.Label('Vertical Slider'),
225+
dcc.Slider(
226+
id='vertical-slider',
227+
min=0,
228+
max=9,
229+
marks={i: 'Label {}'.format(i) if i == 1 else str(i)
230+
for i in range(1, 6)},
231+
value=5,
232+
vertical=True,
233+
),
234+
], style={'height': '500px'})
235+
self.startServer(app)
236+
237+
self.wait_for_element_by_css_selector('#vertical-slider')
238+
self.snapshot('vertical slider')
239+
240+
v_slider = self.driver.find_element_by_css_selector(
241+
'#vertical-slider div[role="slider"]'
242+
)
243+
v_slider.click()
244+
245+
for entry in self.get_log():
246+
raise Exception('browser error logged during test', entry)
247+
220248
def test_gallery(self):
221249
app = dash.Dash(__name__)
222250

0 commit comments

Comments
 (0)