mirror of
https://github.com/django-components/django-components.git
synced 2025-08-04 14:28:18 +00:00
refactor: add test for no template_rendered signal for component with no template
This commit is contained in:
parent
62da9e71a6
commit
a3c34b0925
1 changed files with 16 additions and 0 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