mirror of
https://github.com/django-components/django-components.git
synced 2025-08-30 10:47:20 +00:00
feat: allow to set query and fragment on get_component_url (#1160)
This commit is contained in:
parent
bf7a204e92
commit
c69980493d
6 changed files with 102 additions and 5 deletions
|
@ -373,6 +373,16 @@ class TestComponent:
|
|||
with pytest.raises(KeyError):
|
||||
get_component_by_class_id("nonexistent")
|
||||
|
||||
def test_component_render_id(self):
|
||||
class SimpleComponent(Component):
|
||||
template = "render_id: {{ render_id }}"
|
||||
|
||||
def get_template_data(self, args, kwargs, slots, context):
|
||||
return {"render_id": self.id}
|
||||
|
||||
rendered = SimpleComponent.render()
|
||||
assert rendered == "render_id: ca1bc3e"
|
||||
|
||||
def test_get_context_data_returns_none(self):
|
||||
class SimpleComponent(Component):
|
||||
template = "Hello"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue