def test_flow_component(self): app = Dash() app.layout = html.Div([ dash_flow_example.ExampleReactComponent(id='react', value='my-value', label='react component'), dash_flow_example.ExampleFlowComponent(id='flow', value='my-value', label='flow component'), html.Hr(), html.Div(id='output') ]) @app.callback(Output('output', 'children'), [Input('react', 'value'), Input('flow', 'value')]) def display_output(react_value, flow_value): return html.Div([ 'You have entered {} and {}'.format(react_value, flow_value), html.Hr(), html.Label('Flow Component Docstring'), html.Pre(dash_flow_example.ExampleFlowComponent.__doc__), html.Hr(), html.Label('React PropTypes Component Docstring'), html.Pre(dash_flow_example.ExampleReactComponent.__doc__), html.Div(id='waitfor') ]) self.startServer(app) self.wait_for_element_by_id('waitfor') self.percy_snapshot(name='flowtype')
def test_inin006_flow_component(dash_duo): app = Dash() app.layout = html.Div([ dash_flow_example.ExampleReactComponent(id="react", value="my-value", label="react component"), dash_flow_example.ExampleFlowComponent(id="flow", value="my-value", label="flow component"), html.Hr(), html.Div(id="output"), ]) @app.callback(Output("output", "children"), [Input("react", "value"), Input("flow", "value")]) def display_output(react_value, flow_value): return html.Div([ "You have entered {} and {}".format(react_value, flow_value), html.Hr(), html.Label("Flow Component Docstring"), html.Pre(dash_flow_example.ExampleFlowComponent.__doc__), html.Hr(), html.Label("React PropTypes Component Docstring"), html.Pre(dash_flow_example.ExampleReactComponent.__doc__), html.Div(id="waitfor"), ]) dash_duo.start_server(app) dash_duo.wait_for_element("#waitfor") dash_duo.percy_snapshot(name="flowtype")
class DashFlowComponent(DashView): dash_name = 'static_dash05' dash_components = {html.__name__, dash_flow_example.__name__} dash = Dash() dash.layout = html.Div([ dash_flow_example.ExampleReactComponent( id='react', value='my-value', label='react component' ), dash_flow_example.ExampleFlowComponent( id='flow', value='my-value', label='flow component' ), html.Hr(), html.Div(id='output') ]) @staticmethod @dash.callback(Output('output', 'children'), [Input('react', 'value'), Input('flow', 'value')]) def display_output(react_value, flow_value): return html.Div([ 'You have entered {} and {}'.format(react_value, flow_value), html.Hr(), html.Label('Flow Component Docstring'), html.Pre(dash_flow_example.ExampleFlowComponent.__doc__), html.Hr(), html.Label('React PropTypes Component Docstring'), html.Pre(dash_flow_example.ExampleReactComponent.__doc__), html.Div(id='waitfor') ])
def __init__(self, **kwargs): super(DashFlowComponent, self).__init__(**kwargs) self.dash.layout = html.Div([ dash_flow_example.ExampleReactComponent(id='react', value='my-value', label='react component'), dash_flow_example.ExampleFlowComponent(id='flow', value='my-value', label='flow component'), html.Hr(), html.Div(id='output') ]) self.dash.callback(Output('output', 'children'), [Input('react', 'value'), Input('flow', 'value')])(self.display_output)
import dash_flow_example import dash from dash.dependencies import Input, Output import dash_html_components as html app = dash.Dash('') app.scripts.config.serve_locally = True app.layout = html.Div([ dash_flow_example.ExampleReactComponent(id='react', value='my-value', label='react component'), dash_flow_example.ExampleFlowComponent(id='flow', value='my-value', label='flow component'), html.Hr(), html.Div(id='output') ]) @app.callback( Output('output', 'children'), [Input('react', 'value'), Input('flow', 'value')]) def display_output(react_value, flow_value): return html.Div([ 'You have entered {} and {}'.format(react_value, flow_value), html.Hr(), html.Label('Flow Component Docstring'), html.Pre(dash_flow_example.ExampleFlowComponent.__doc__), html.Hr(),