Skip to content

Fix for #27 #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/handler/handlers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@ 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

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

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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 15 additions & 0 deletions test/integration/components/test_default_children.py
Original file line number Diff line number Diff line change
@@ -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
)