|
1 | 1 | from multiprocessing import Value
|
2 | 2 | import dash_html_components as html
|
3 | 3 | import dash_core_components as dcc
|
| 4 | +import dash_flow_example |
4 | 5 | from dash import Dash
|
5 | 6 | from dash.dependencies import Input, Output
|
6 | 7 | from dash.exceptions import PreventUpdate
|
@@ -112,3 +113,37 @@ def callback2(value):
|
112 | 113 | self.assertEqual(output2.text, initial_output)
|
113 | 114 |
|
114 | 115 | assert_clean_console(self)
|
| 116 | + |
| 117 | + def test_flow_component(self): |
| 118 | + app.layout = html.Div([ |
| 119 | + dash_flow_example.ExampleReactComponent( |
| 120 | + id='react', |
| 121 | + value='my-value', |
| 122 | + label='react component' |
| 123 | + ), |
| 124 | + dash_flow_example.ExampleFlowComponent( |
| 125 | + id='flow', |
| 126 | + value='my-value', |
| 127 | + label='flow component' |
| 128 | + ), |
| 129 | + html.Hr(), |
| 130 | + html.Div(id='output') |
| 131 | + ]) |
| 132 | + |
| 133 | + @app.callback(Output('output', 'children'), |
| 134 | + [Input('react', 'value'), Input('flow', 'value')]) |
| 135 | + def display_output(react_value, flow_value): |
| 136 | + return html.Div([ |
| 137 | + 'You have entered {} and {}'.format(react_value, flow_value), |
| 138 | + html.Hr(), |
| 139 | + html.Label('Flow Component Docstring'), |
| 140 | + html.Pre(dash_flow_example.ExampleFlowComponent.__doc__), |
| 141 | + html.Hr(), |
| 142 | + html.Label('React PropTypes Component Docstring'), |
| 143 | + html.Pre(dash_flow_example.ExampleReactComponent.__doc__), |
| 144 | + html.Div(id='waitfor') |
| 145 | + ]) |
| 146 | + |
| 147 | + self.startServer(app) |
| 148 | + self.wait_for_element_by_id('waitfor') |
| 149 | + self.percy_snapshot(name='flowtype') |
0 commit comments