mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 15:39:08 +00:00
* refactor: Cache components' JS and CSS scripts at class creation time * refactor: add test for no template_rendered signal for component with no template
This commit is contained in:
parent
007009a480
commit
c692b7a310
13 changed files with 138 additions and 58 deletions
|
@ -96,3 +96,19 @@ class TestTemplateSignal:
|
|||
templates_used = _get_templates_used_to_render(template)
|
||||
assert "slotted_template.html" in templates_used
|
||||
assert "simple_template.html" in templates_used
|
||||
|
||||
@djc_test(parametrize=PARAMETRIZE_CONTEXT_BEHAVIOR)
|
||||
@with_template_signal
|
||||
def test_template_rendered_skipped_when_no_template(self, components_settings):
|
||||
class EmptyComponent(Component):
|
||||
pass
|
||||
|
||||
registry.register("empty", EmptyComponent)
|
||||
|
||||
template_str: types.django_html = """
|
||||
{% load component_tags %}
|
||||
{% component 'empty' / %}
|
||||
"""
|
||||
template = Template(template_str, name="root")
|
||||
templates_used = _get_templates_used_to_render(template)
|
||||
assert templates_used == ["root"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue