Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 0f930c6

Browse files
authored
Merge pull request #161 from reactrb/hotfix/0-8-stable
Hotfix for 0-8-stable
2 parents baf71b4 + 293e72d commit 0f930c6

26 files changed

+9
-55
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Whitespace conventions:
1818
- 1 spaces before normal text
1919
-->
2020

21-
## [0.8.9] - FILL-IN FILL-IN
21+
## [0.8.9] - Unreleased
2222

2323
### Fixed
2424

lib/react/api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def self.native_react_component?(name)
3737
end
3838

3939
def self.create_native_react_class(type)
40-
raise "Provided class should define `render` method" if !(type.respond_to? :render)
40+
raise "Provided class should define `render` method" if !(type.method_defined? :render)
4141
render_fn = (type.method_defined? :_render_wrapper) ? :_render_wrapper : :render
4242
# this was hashing type.to_s, not sure why but .to_s does not work as it Foo::Bar::View.to_s just returns "View"
4343
@@component_classes[type] ||= %x{

lib/react/component.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def update_react_js_state(object, name, value)
113113
end
114114
end
115115

116-
# def render
117-
# raise 'no render defined'
118-
# end unless respond_to?(:render)
116+
def render
117+
raise 'no render defined'
118+
end unless method_defined?(:render)
119119

120120
def _render_wrapper
121121
State.set_state_context_to(self, true) do

lib/react/component/class_methods.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module React
22
module Component
33
# class level methods (macros) for components
44
module ClassMethods
5+
56
def reactrb_component?
67
true
78
end

lib/reactive-ruby/server_rendering/contextual_renderer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def render(component_name, props, prerender_options)
2424
prerender_options = prerender_options[:static] ? :static : true
2525
end
2626
end
27+
2728
super(component_name, props, prerender_options)
2829
end
2930

reactrb.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
3030

3131
# For Test Rails App
3232
s.add_development_dependency 'rails', '4.2.4'
33+
s.add_development_dependency 'mime-types', '< 3'
3334
s.add_development_dependency 'react-rails'
3435
s.add_development_dependency 'opal-rails'
3536
s.add_development_dependency 'pry'
File renamed without changes.
File renamed without changes.

spec/dsl_spec.rb renamed to spec/react/dsl_spec.rb

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'spec_helper'
2-
require 'reactrb/auto-import'
32

43
if opal?
54

@@ -24,18 +23,6 @@ class Bar < React::Component::Base
2423
expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div class="foo">hello</div>')
2524
end
2625

27-
it "can accept the html tag class name rather than a symbol" do
28-
stub_const 'Foo', Class.new
29-
Foo.class_eval do
30-
include React::Component
31-
render(DIV, class: :foo) do
32-
"hello"
33-
end
34-
end
35-
36-
expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div class="foo">hello</div>')
37-
end
38-
3926
it "can define the render method with the render macro without a container" do
4027
stub_const 'Foo', Class.new
4128
Foo.class_eval do
@@ -232,49 +219,13 @@ def render
232219
stub_const 'Foo', Class.new(React::Component::Base)
233220
Foo.class_eval do
234221
def render
235-
TestMod123::Bar.the_class.other_class
222+
TestMod123::Bar().the_class.other_class
236223
end
237224
end
238225

239226
expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<span class="other-class the-class">a man walks into a bar</span>')
240227
end
241228

242-
it "can use haml class names with CAPCASED builtin tags" do
243-
stub_const 'Foo', Class.new
244-
Foo.class_eval do
245-
include React::Component
246-
def render
247-
DIV.the_class { 'hello' }
248-
end
249-
end
250-
251-
expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div class="the-class">hello</div>')
252-
end
253-
254-
it "can use haml class names after params in builtin tags" do
255-
stub_const 'Foo', Class.new
256-
Foo.class_eval do
257-
include React::Component
258-
def render
259-
p(data: { foo: :bar }).the_class
260-
end
261-
end
262-
263-
expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<p data-foo="bar" class="the-class"></p>')
264-
end
265-
266-
it "can use haml class names after params with CAPCASED builtin tags" do
267-
stub_const 'Foo', Class.new
268-
Foo.class_eval do
269-
include React::Component
270-
def render
271-
DIV(data: { foo: :bar }).the_class
272-
end
273-
end
274-
275-
expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div data-foo="bar" class="the-class"></div>')
276-
end
277-
278229
it "can use the 'class' keyword for classes" do
279230
stub_const 'Foo', Class.new
280231
Foo.class_eval do

0 commit comments

Comments
 (0)