File tree Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Expand file tree Collapse file tree 1 file changed +21
-14
lines changed Original file line number Diff line number Diff line change 22
33class Example < Phlex ::HTML
44 def initialize
5- @name = "Joel"
5+ @text = "text"
6+ @html = safe "<div>html</div>"
67 end
78
89 erb :view_template , <<~ERB
910 <% card do %>
10- < h1 > Hello <%= @name %> </ h1 >
11- <%= greeting %>
11+ < h1 > <%= @text %> </ h1 >
12+ <%= @html %>
13+ <%= phlex_snippet %>
1214 <% end %>
1315 ERB
1416
15- erb :say_bye , <<~ERB , locals : %(name :)
16- < h2 > Goodbye <%= name %> </ h2 >
17+ erb :erb_snippet , <<~ERB , locals : %(text :)
18+ < h2 > Goodbye <%= text %> </ h2 >
1719 ERB
1820
19- def greeting
21+ def phlex_snippet
2022 p { "How do you do?" }
2123 end
2224
2325 def card
24- article do
25- yield
26+ section do
27+ article do
28+ yield
29+ end
30+ erb_snippet ( text : "Joel" )
2631 end
27- say_bye ( name : "Joel" )
2832 end
2933end
3034
3135test do
3236 output = Example . call
3337
3438 assert_equivalent_html output , <<~HTML
35- < article >
36- < h1 > Hello Joel</ h1 >
37- < p > How do you do?</ p >
38- </ article >
39- < h2 > Goodbye Joel</ h2 >
39+ < section >
40+ < article >
41+ < h1 > text</ h1 >
42+ < div > html</ div >
43+ < p > How do you do?</ p >
44+ </ article >
45+ < h2 > Goodbye Joel</ h2 >
46+ </ section >
4047 HTML
4148end
You can’t perform that action at this time.
0 commit comments