Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions panel/template/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from ..theme.base import (
THEMES, DefaultTheme, Design, Theme,
)
from ..theme.native import Native
from ..util import isurl
from ..viewable import (
MimeRenderMixin, Renderable, ServableMixin, Viewable,
Expand Down Expand Up @@ -119,6 +120,8 @@ def __init__(
}
self._render_items: dict[str, tuple[Renderable, list[str]]] = {}
self._render_variables: dict[str, Any] = {}
if 'design' not in params and self.param.design.default in (None, Design, Native):
Comment thread
philippjfr marked this conversation as resolved.
Outdated
params['design'] = config.design
super().__init__(**{
p: v for p, v in params.items() if p not in _base_config.param or p == 'name'
})
Expand Down
8 changes: 8 additions & 0 deletions panel/tests/template/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from panel.io.notifications import NotificationArea
from panel.io.state import set_curdoc, state
from panel.template import VanillaTemplate
from panel.theme import Material
from panel.widgets import Button


def test_notification_instantiate_on_config(document):
with config.set(notifications=True):
tmpl = VanillaTemplate()

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-bokeh37:ubuntu-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:ubuntu-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:macos-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:macos-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

Check failure on line 13 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:ubuntu-latest

test_notification_instantiate_on_config TypeError: issubclass() arg 1 must be a class

assert isinstance(tmpl.notifications, NotificationArea)

Expand All @@ -22,7 +23,7 @@


def test_notification_explicit(document):
tmpl = VanillaTemplate(notifications=NotificationArea())

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-bokeh37:ubuntu-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:ubuntu-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:macos-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:macos-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

Check failure on line 26 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:ubuntu-latest

test_notification_explicit TypeError: issubclass() arg 1 must be a class

assert isinstance(tmpl.notifications, NotificationArea)

Expand All @@ -34,6 +35,13 @@
assert state.notifications is tmpl.notifications


def test_template_inherits_configured_design():
with config.set(design=Material):
tmpl = VanillaTemplate()

assert tmpl.design is Material


def test_template_pass_config_params_constructor(document):
custom_config = {
'raw_css': ['html { background-color: purple; }'],
Expand All @@ -41,14 +49,14 @@
'js_files': {'foo': 'foo.js'},
'js_modules': {'bar': 'bar.js'},
}
tmpl = VanillaTemplate(**custom_config)

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-bokeh37:ubuntu-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:ubuntu-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:macos-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:macos-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class

Check failure on line 52 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:ubuntu-latest

test_template_pass_config_params_constructor TypeError: issubclass() arg 1 must be a class
config = tmpl.config.param.values()
del config['name']
assert config == custom_config


def test_template_multi_refs():
tmpl = VanillaTemplate()

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-bokeh37:ubuntu-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:ubuntu-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:macos-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-313:macos-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class

Check failure on line 59 in panel/tests/template/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-314:ubuntu-latest

test_template_multi_refs TypeError: issubclass() arg 1 must be a class
button = Button(name="Click me", button_type="primary")
tmpl.sidebar.append(button)
tmpl.main.append(button)
Expand Down
Loading