mirror of
https://github.com/django-components/django-components.git
synced 2025-10-17 01:07:12 +00:00
Caching templates to allow for dynamic template generation
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
This commit is contained in:
parent
3919943cbd
commit
07986c5216
9 changed files with 36 additions and 17 deletions
|
@ -2,11 +2,11 @@ from textwrap import dedent
|
|||
|
||||
from django.template import Context
|
||||
|
||||
from django_components import component
|
||||
|
||||
from .django_test_setup import * # NOQA
|
||||
from .testutils import Django111CompatibleSimpleTestCase as SimpleTestCase
|
||||
|
||||
from django_components import component
|
||||
|
||||
|
||||
class ComponentRegistryTest(SimpleTestCase):
|
||||
def test_empty_component(self):
|
||||
|
@ -32,7 +32,6 @@ class ComponentRegistryTest(SimpleTestCase):
|
|||
|
||||
comp = SimpleComponent("simple_component")
|
||||
context = Context(comp.context(variable="test"))
|
||||
comp.compile_instance_template({})
|
||||
|
||||
self.assertHTMLEqual(comp.render_dependencies(), dedent("""
|
||||
<link href="style.css" type="text/css" media="all" rel="stylesheet">
|
||||
|
@ -71,7 +70,6 @@ class ComponentRegistryTest(SimpleTestCase):
|
|||
|
||||
comp = FilteredComponent("filtered_component")
|
||||
context = Context(comp.context(var1="test1", var2="test2"))
|
||||
comp.compile_instance_template({})
|
||||
|
||||
self.assertHTMLEqual(comp.render(context), dedent("""
|
||||
Var1: <strong>test1</strong>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue