mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 03:07:19 +00:00
refactor: Instantiate component when rendering, and remove metadata stack (#1212)
* refactor: Instantiate component when rendering, and remove metadata stack * refactor: update test * refactor: fix linter errors * docs: remove example from changelog
This commit is contained in:
parent
2e08af9a13
commit
bae0f28813
33 changed files with 1123 additions and 707 deletions
|
@ -195,11 +195,12 @@ class TestComponentAsView(SimpleTestCase):
|
|||
def get(self, request, *args, **kwargs) -> HttpResponse:
|
||||
return self.render_to_response(kwargs={"variable": self.name})
|
||||
|
||||
client = CustomClient(urlpatterns=[path("test/", MockComponentRequest("my_comp").as_view())])
|
||||
view = MockComponentRequest.as_view()
|
||||
client = CustomClient(urlpatterns=[path("test/", view)])
|
||||
response = client.get("/test/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertInHTML(
|
||||
'<input type="text" name="variable" value="my_comp">',
|
||||
'<input type="text" name="variable" value="MockComponentRequest">',
|
||||
response.content.decode(),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue