diff --git a/src/handler/handlers.jl b/src/handler/handlers.jl index 4d76433..55779a5 100644 --- a/src/handler/handlers.jl +++ b/src/handler/handlers.jl @@ -12,7 +12,7 @@ end function process_dependencies(request::HTTP.Request, state::HandlerState) return HTTP.Response( 200, - ["Content-Type", "application/json"], + ["Content-Type" => "application/json"], body = state.cache.dependencies_json ) end @@ -20,7 +20,7 @@ end function process_index(request::HTTP.Request, state::HandlerState) return HTTP.Response( 200, - ["Content-Type", "text/html"], + ["Content-Type" => "text/html"], body = state.cache.index_string ) end @@ -28,10 +28,9 @@ end layout_data(layout::Component) = layout layout_data(layout::Function) = layout() function process_layout(request::HTTP.Request, state::HandlerState) - body = return HTTP.Response( 200, - ["Content-Type", "application/json"], + ["Content-Type" => "application/json"], body = JSON2.write(layout_data(state.app.layout)) ) end diff --git a/test/integration/components/jl_default_children/jlcmdc001_default_children.jl b/test/integration/components/jl_default_children/jlcmdc001_default_children.jl new file mode 100644 index 0000000..4e65a7a --- /dev/null +++ b/test/integration/components/jl_default_children/jlcmdc001_default_children.jl @@ -0,0 +1,12 @@ +using Dash +using DashHtmlComponents +using DashCoreComponents + +app = dash() +app.layout = html_div(id="outer-div") do + html_div("A div", id="first-inner-div"), + html_br(), + html_div("Another div", id="second-inner-div") +end + +run_server(app) diff --git a/test/integration/components/test_default_children.py b/test/integration/components/test_default_children.py new file mode 100644 index 0000000..3952fb3 --- /dev/null +++ b/test/integration/components/test_default_children.py @@ -0,0 +1,15 @@ +import pathlib +import os.path +import logging +logger = logging.getLogger(__name__) + +curr_path = pathlib.Path(__file__).parent.absolute() +def jl_test_file_path(filename): + return os.path.join(curr_path, "jl_default_children", filename) + +def test_jlcmdc001_default_children(dashjl): + fp = jl_test_file_path("jlcmdc001_default_children.jl") + dashjl.start_server(fp) + dashjl.wait_for_element_by_css_selector( + "#first-inner-div", timeout=2 + ) \ No newline at end of file