@@ -868,3 +868,36 @@ def test_clsd020_clientside_callback_context_triggered_id(dash_duo):
868
868
dash_duo .find_element ("button[id*='btn1\" :2']" ).click ()
869
869
870
870
dash_duo .wait_for_text_to_equal ("#output-clientside" , "2" )
871
+
872
+
873
+ def test_clsd021_simple_clientside_module_serverside_callback (dash_duo ):
874
+ app = Dash (__name__ , assets_folder = "assets" )
875
+
876
+ app .layout = html .Div (
877
+ [
878
+ dcc .Input (id = "input" ),
879
+ html .Div (id = "output-clientside" ),
880
+ html .Div (id = "output-serverside" ),
881
+ ]
882
+ )
883
+
884
+ @app .callback (Output ("output-serverside" , "children" ), [Input ("input" , "value" )])
885
+ def update_output (value ):
886
+ return 'Server says "{}"' .format (value )
887
+
888
+ app .clientside_callback (
889
+ ClientsideFunction (namespace = "clientside_module" , function_name = "display" ),
890
+ Output ("output-clientside" , "children" ),
891
+ [Input ("input" , "value" )],
892
+ )
893
+
894
+ dash_duo .start_server (app )
895
+
896
+ assert dash_duo .find_element ("body > footer > script[type=module]" )
897
+
898
+ dash_duo .wait_for_text_to_equal ("#output-serverside" , 'Server says "None"' )
899
+ dash_duo .wait_for_text_to_equal ("#output-clientside" , 'Client says "undefined"' )
900
+
901
+ dash_duo .find_element ("#input" ).send_keys ("hello world" )
902
+ dash_duo .wait_for_text_to_equal ("#output-serverside" , 'Server says "hello world"' )
903
+ dash_duo .wait_for_text_to_equal ("#output-clientside" , 'Client says "hello world"' )
0 commit comments