mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 15:39:08 +00:00
Merge b1cdbfe73c
into 8a6215b9cd
This commit is contained in:
commit
5f0af28e87
1 changed files with 41 additions and 0 deletions
|
@ -1075,3 +1075,44 @@ class TestExtendsCompat:
|
|||
<p data-djc-id-ca1bc40 data-djc-id-ca1bc42>This template extends another template.</p>
|
||||
""",
|
||||
)
|
||||
|
||||
@djc_test(parametrize=PARAMETRIZE_CONTEXT_BEHAVIOR)
|
||||
def test_double_include_template_with_extend(
|
||||
self,
|
||||
components_settings,
|
||||
):
|
||||
|
||||
@register("simple_component")
|
||||
class SimpleComponent(Component):
|
||||
template: types.django_html = """
|
||||
{% slot 'content' / %}
|
||||
"""
|
||||
|
||||
template: types.django_html = """
|
||||
{% extends 'block.html' %}
|
||||
{% load component_tags %}
|
||||
{% block body %}
|
||||
{% component "simple_component" %}
|
||||
{% fill "content" %}
|
||||
{% include 'included.html' with variable="INCLUDED 1" %}
|
||||
{% include 'included.html' with variable="INCLUDED 2" %}
|
||||
{% endfill %}
|
||||
{% endcomponent %}
|
||||
{% endblock %}
|
||||
"""
|
||||
rendered = Template(template).render(Context({"DJC_DEPS_STRATEGY": "ignore"}))
|
||||
|
||||
expected = """
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<main role="main">
|
||||
<div class='container main-container'>
|
||||
Variable: <strong data-djc-id-ca1bc40="">INCLUDED 1</strong>
|
||||
Variable: <strong data-djc-id-ca1bc40="">INCLUDED 2</strong>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
assertHTMLEqual(rendered, expected)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue