Add test for calling component with positional name.

This commit is contained in:
Emil Stenström 2021-02-20 23:57:46 +01:00
parent a87b6734f4
commit d48502c40b

View file

@ -104,6 +104,15 @@ class ComponentTemplateTagTest(SimpleTestCase):
rendered = template.render(Context({}))
self.assertHTMLEqual(rendered, "Variable: <strong>variable</strong>\n")
def test_single_component_positional_name(self):
component.registry.register(name="test", component=SimpleComponent)
template = Template(
'{% load component_tags %}{% component "test" variable="variable" %}'
)
rendered = template.render(Context({}))
self.assertHTMLEqual(rendered, "Variable: <strong>variable</strong>\n")
def test_call_component_with_two_variables(self):
component.registry.register(name="test", component=IffedComponent)