feat: expose _class_hash as class_id (#1094)

* feat: expose _class_hash as class_id

* refactor: fix linting
This commit is contained in:
Juro Oravec 2025-04-07 11:08:02 +02:00 committed by GitHub
parent a49f5e51dd
commit bb5de86b69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 141 additions and 82 deletions

View file

@ -16,7 +16,7 @@ from django.test import Client
from django.urls import path
from pytest_django.asserts import assertHTMLEqual, assertInHTML
from django_components import Component, ComponentView, all_components, register, types
from django_components import Component, ComponentView, all_components, get_component_by_class_id, register, types
from django_components.slots import SlotRef
from django_components.urls import urlpatterns as dc_urlpatterns
@ -356,6 +356,12 @@ class TestComponent:
):
Root.render()
def test_get_component_by_id(self):
class SimpleComponent(Component):
pass
assert get_component_by_class_id(SimpleComponent.class_id) == SimpleComponent
@djc_test
class TestComponentRender: