22
33if opal?
44describe 'the React DSL' do
5-
65 it "will turn the last string in a block into a element" do
76 stub_const 'Foo' , Class . new
87 Foo . class_eval do
@@ -12,7 +11,7 @@ def render
1211 end
1312 end
1413
15- expect ( render_to_html ( Foo ) ) . to eq ( '<div>hello</div>' )
14+ expect ( Foo ) . to render ( '<div>hello</div>' )
1615 end
1716
1817 it "has a .span short hand String method" do
@@ -24,7 +23,7 @@ def render
2423 end
2524 end
2625
27- expect ( render_to_html ( Foo ) ) . to eq ( '<div><span>hello</span><span>goodby</span></div>' )
26+ expect ( Foo ) . to render ( '<div><span>hello</span><span>goodby</span></div>' )
2827 end
2928
3029 it "has a .br short hand String method" do
@@ -36,7 +35,7 @@ def render
3635 end
3736 end
3837
39- expect ( render_to_html ( Foo ) ) . to eq ( '<div><span>hello<br></span></div>' )
38+ expect ( Foo ) . to render ( '<div><span>hello<br></span></div>' )
4039 end
4140
4241 it "has a .td short hand String method" do
@@ -48,7 +47,7 @@ def render
4847 end
4948 end
5049
51- expect ( render_to_html ( Foo ) ) . to eq ( '<table><tr><td>hello</td></tr></table>' )
50+ expect ( Foo ) . to render ( '<table><tr><td>hello</td></tr></table>' )
5251 end
5352
5453 it "has a .para short hand String method" do
@@ -60,7 +59,7 @@ def render
6059 end
6160 end
6261
63- expect ( render_to_html ( Foo ) ) . to eq ( '<div><p>hello</p></div>' )
62+ expect ( Foo ) . to render ( '<div><p>hello</p></div>' )
6463 end
6564
6665 it "will treat the component class name as a first class component name" do
@@ -78,7 +77,7 @@ def render
7877 end
7978 end
8079
81- expect ( render_to_html ( Foo ) ) . to eq ( '<span>a man walks into a bar</span>' )
80+ expect ( Foo ) . to render ( '<span>a man walks into a bar</span>' )
8281 end
8382
8483 it "will treat the component class name as a first class component name" do
@@ -96,7 +95,7 @@ def render
9695 end
9796 end
9897
99- expect ( render_to_html ( Foo ) ) . to eq ( '<span>a man walks into a bar</span>' )
98+ expect ( Foo ) . to render ( '<span>a man walks into a bar</span>' )
10099 end
101100
102101 it "can add class names by the haml .class notation" do
@@ -114,7 +113,7 @@ def render
114113 end
115114 end
116115
117- expect ( render_to_html ( Foo ) ) . to eq ( '<span class="the-class">a man walks into a bar</span>' )
116+ expect ( Foo ) . to render ( '<span class="the-class">a man walks into a bar</span>' )
118117 end
119118
120119 it "can use the 'class' keyword for classes" do
@@ -126,7 +125,7 @@ def render
126125 end
127126 end
128127
129- expect ( render_to_html ( Foo ) ) . to eq ( '<span class="the-class">hello</span>' )
128+ expect ( Foo ) . to render ( '<span class="the-class">hello</span>' )
130129 end
131130
132131 it "can generate a unrendered node using the .as_node method" do # div { "hello" }.as_node
@@ -138,7 +137,7 @@ def render
138137 end
139138 end
140139
141- expect ( render_to_html ( Foo ) ) . to eq ( '<span>React::Element</span>' )
140+ expect ( Foo ) . to render ( '<span>React::Element</span>' )
142141 end
143142
144143 it "can use the dangerously_set_inner_HTML param" do
@@ -150,7 +149,7 @@ def render
150149 end
151150 end
152151
153- expect ( render_to_html ( Foo ) ) . to eq ( '<div>Hello Goodby</div>' )
152+ expect ( Foo ) . to render ( '<div>Hello Goodby</div>' )
154153 end
155154
156155 it "will remove all elements passed as params from the rendering buffer" do
@@ -173,7 +172,7 @@ def render
173172 end
174173 end
175174
176- expect ( render_to_html ( Test ) ) . to eq ( '<div><b>hello</b><b>hello</b></div>' )
175+ expect ( Test ) . to render ( '<div><b>hello</b><b>hello</b></div>' )
177176 end
178177end
179178end
0 commit comments