Skip to content
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

Fix issue converting templated apps #6756

Merged
merged 1 commit into from
Apr 18, 2024
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
2 changes: 1 addition & 1 deletion panel/io/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def script_to_html(
loading_style = f'<style type="text/css">\n{loading_base}\n</style>'
else:
loading_style = f'<link rel="stylesheet" href="{CDN_DIST}css/loading.css" type="text/css" />'
css_resources.append(loading_style)
css_resources.append(loading_style)
spinner_css = loading_css(
config.loading_spinner, config.loading_color, config.loading_max_height
)
Expand Down
20 changes: 20 additions & 0 deletions panel/tests/ui/io/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
pn.Row(button, pn.bind(lambda c: c, button.param.clicks)).servable();
"""

template_button_app = """
import panel as pn
pn.extension(template='bootstrap')
button = pn.widgets.Button()
pn.Row(button, pn.bind(lambda c: c, button.param.clicks)).servable();
"""

slider_app = """
import panel as pn
slider = pn.widgets.FloatSlider()
Expand Down Expand Up @@ -180,6 +187,19 @@ def test_pyodide_test_convert_button_app(http_serve, page, runtime):
assert [msg for msg in msgs if msg.type == 'error' and 'favicon' not in msg.location['url']] == []


@pytest.mark.parametrize('runtime', ['pyodide', 'pyscript', 'pyodide-worker'])
def test_pyodide_test_convert_template_button_app(http_serve, page, runtime):
msgs = wait_for_app(http_serve, button_app, page, runtime)

expect(page.locator('pre:not([class])')).to_have_text('0')

page.click('.bk-btn')

expect(page.locator('pre:not([class])')).to_have_text('1')

assert [msg for msg in msgs if msg.type == 'error' and 'favicon' not in msg.location['url']] == []


@pytest.mark.parametrize('runtime', ['pyodide', 'pyscript', 'pyodide-worker'])
def test_pyodide_test_convert_slider_app(http_serve, page, runtime):
msgs = wait_for_app(http_serve, slider_app, page, runtime)
Expand Down
Loading