Skip to content

Commit 8054e25

Browse files
author
Andres Vargas
committed
features working
1 parent f13c03c commit 8054e25

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

core/views.py

+2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ class HelloworldLivewire(LivewireComponent):
4141

4242

4343
class HelloworldDatabindLivewire(LivewireComponent):
44+
template_name = "helloworld_databind.livewire.html"
4445
message = "Hellowwwww mundo!"
4546

4647

4748
class SearchPostsLivewire(LivewireComponent):
49+
template_name="search_posts.livewire.html"
4850
search = ""
4951
updates_query_string = ("search", )
5052
# TODO must recive the request

livewire/tests.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
from django.test import TestCase
2+
from django.template import Template, Context
23

3-
# Create your tests here.
4+
5+
class TestTT(TestCase):
6+
7+
def test_rendered(self):
8+
template_to_render = Template(
9+
"{% load livewire_tags %}"
10+
"{% livewire_scripts %}"
11+
)
12+
rendered_template = template_to_render.render(Context())
13+
self.assertTrue("window.livewire" in rendered_template)

livewire/views.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ def get_context_data(self):
109109
mount_result[property] = getattr(self, property)
110110
return mount_result
111111

112-
def get_dom(self):
112+
def get_dom(self, template_name):
113113
context = self.get_context_data()
114-
template_name = self.get_template_name()
115114
return self.render_component(template_name, context)
116115

117116
def render(self, context={}):
@@ -123,7 +122,7 @@ def render(self, context={}):
123122
return self.view(template_name, context)
124123

125124
def view(self, template_name, context):
126-
dom = self.get_dom()
125+
dom = self.get_dom(template_name)
127126
return self.render_to_response(template_name, dom)
128127

129128
def render_component(self, component_template, context={}):

0 commit comments

Comments
 (0)