@@ -12,7 +12,7 @@ def render
1212 end
1313 end
1414
15- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<div>hello</div>' )
15+ expect ( render_to_html ( Foo ) ) . to eq ( '<div>hello</div>' )
1616 end
1717
1818 it "has a .span short hand String method" do
@@ -24,7 +24,7 @@ def render
2424 end
2525 end
2626
27- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<div><span>hello</span><span>goodby</span></div>' )
27+ expect ( render_to_html ( Foo ) ) . to eq ( '<div><span>hello</span><span>goodby</span></div>' )
2828 end
2929
3030 it "has a .br short hand String method" do
@@ -36,7 +36,7 @@ def render
3636 end
3737 end
3838
39- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<div><span>hello<br></span></div>' )
39+ expect ( render_to_html ( Foo ) ) . to eq ( '<div><span>hello<br></span></div>' )
4040 end
4141
4242 it "has a .td short hand String method" do
@@ -48,7 +48,7 @@ def render
4848 end
4949 end
5050
51- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<table><tr><td>hello</td></tr></table>' )
51+ expect ( render_to_html ( Foo ) ) . to eq ( '<table><tr><td>hello</td></tr></table>' )
5252 end
5353
5454 it "has a .para short hand String method" do
@@ -60,7 +60,25 @@ def render
6060 end
6161 end
6262
63- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<div><p>hello</p></div>' )
63+ expect ( render_to_html ( Foo ) ) . to eq ( '<div><p>hello</p></div>' )
64+ end
65+
66+ it "will treat the component class name as a first class component name" do
67+ stub_const 'Biz::Mod::Bar' , Class . new
68+ Biz ::Mod ::Bar . class_eval do
69+ include React ::Component
70+ def render
71+ "a man walks into a bar"
72+ end
73+ end
74+ stub_const 'Foo' , Class . new ( React ::Component ::Base )
75+ Foo . class_eval do
76+ def render
77+ Biz ::Mod ::Bar ( )
78+ end
79+ end
80+
81+ expect ( render_to_html ( Foo ) ) . to eq ( '<span>a man walks into a bar</span>' )
6482 end
6583
6684 it "will treat the component class name as a first class component name" do
@@ -78,7 +96,7 @@ def render
7896 end
7997 end
8098
81- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<span>a man walks into a bar</span>' )
99+ expect ( render_to_html ( Foo ) ) . to eq ( '<span>a man walks into a bar</span>' )
82100 end
83101
84102 it "can add class names by the haml .class notation" do
@@ -96,7 +114,7 @@ def render
96114 end
97115 end
98116
99- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<span class="the-class">a man walks into a bar</span>' )
117+ expect ( render_to_html ( Foo ) ) . to eq ( '<span class="the-class">a man walks into a bar</span>' )
100118 end
101119
102120 it "can use the 'class' keyword for classes" do
@@ -108,7 +126,7 @@ def render
108126 end
109127 end
110128
111- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<span class="the-class">hello</span>' )
129+ expect ( render_to_html ( Foo ) ) . to eq ( '<span class="the-class">hello</span>' )
112130 end
113131
114132 it "can generate a unrendered node using the .as_node method" do # div { "hello" }.as_node
@@ -120,7 +138,7 @@ def render
120138 end
121139 end
122140
123- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<span>React::Element</span>' )
141+ expect ( render_to_html ( Foo ) ) . to eq ( '<span>React::Element</span>' )
124142 end
125143
126144 it "can use the dangerously_set_inner_HTML param" do
@@ -132,7 +150,7 @@ def render
132150 end
133151 end
134152
135- expect ( React . render_to_static_markup ( React . create_element ( Foo ) ) ) . to eq ( '<div>Hello Goodby</div>' )
153+ expect ( render_to_html ( Foo ) ) . to eq ( '<div>Hello Goodby</div>' )
136154 end
137155
138156 it "will remove all elements passed as params from the rendering buffer" do
@@ -155,7 +173,7 @@ def render
155173 end
156174 end
157175
158- expect ( React . render_to_static_markup ( React . create_element ( Test ) ) ) . to eq ( '<div><b>hello</b><b>hello</b></div>' )
176+ expect ( render_to_html ( Test ) ) . to eq ( '<div><b>hello</b><b>hello</b></div>' )
159177 end
160178end
161179end
0 commit comments