File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ class HelloworldLivewire(LivewireComponent):
41
41
42
42
43
43
class HelloworldDatabindLivewire (LivewireComponent ):
44
+ template_name = "helloworld_databind.livewire.html"
44
45
message = "Hellowwwww mundo!"
45
46
46
47
47
48
class SearchPostsLivewire (LivewireComponent ):
49
+ template_name = "search_posts.livewire.html"
48
50
search = ""
49
51
updates_query_string = ("search" , )
50
52
# TODO must recive the request
Original file line number Diff line number Diff line change 1
1
from django .test import TestCase
2
+ from django .template import Template , Context
2
3
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 )
Original file line number Diff line number Diff line change @@ -109,9 +109,8 @@ def get_context_data(self):
109
109
mount_result [property ] = getattr (self , property )
110
110
return mount_result
111
111
112
- def get_dom (self ):
112
+ def get_dom (self , template_name ):
113
113
context = self .get_context_data ()
114
- template_name = self .get_template_name ()
115
114
return self .render_component (template_name , context )
116
115
117
116
def render (self , context = {}):
@@ -123,7 +122,7 @@ def render(self, context={}):
123
122
return self .view (template_name , context )
124
123
125
124
def view (self , template_name , context ):
126
- dom = self .get_dom ()
125
+ dom = self .get_dom (template_name )
127
126
return self .render_to_response (template_name , dom )
128
127
129
128
def render_component (self , component_template , context = {}):
You can’t perform that action at this time.
0 commit comments