reactive-ruby 0.7.33 → 0.7.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/Gemfile +0 -6
- data/README.md +7 -4
- data/lib/generators/reactive_ruby/test_app/templates/application.rb.erb +10 -12
- data/lib/react/component.rb +60 -63
- data/lib/react/component/base.rb +1 -3
- data/lib/react/component/class_methods.rb +13 -13
- data/lib/react/component/props_wrapper.rb +4 -4
- data/lib/react/state.rb +7 -10
- data/lib/reactive-ruby.rb +1 -2
- data/lib/reactive-ruby/server_rendering/contextual_renderer.rb +13 -4
- data/lib/reactive-ruby/version.rb +1 -1
- data/reactive-ruby.gemspec +17 -5
- data/spec/react/{component_base_spec.rb → component/base_spec.rb} +5 -2
- data/spec/react/param_declaration_spec.rb +14 -0
- data/spec/react/state_spec.rb +26 -0
- data/spec/reactive-ruby/component_loader_spec.rb +1 -1
- data/spec/reactive-ruby/isomorphic_helpers_spec.rb +1 -1
- metadata +82 -27
- data/Gemfile.lock +0 -193
- data/spec/react/react_state_spec.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c55ecaccf2f1aa02991631d35faff6457449212
|
4
|
+
data.tar.gz: 4c28f571ca9a7fdae271866f13b6f7e310c7b6a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08a20f1549e946d19ea82dc3785f72ecfa8e249ad031728ae7e672d8a40f102b53c9138c69e285ae09eed5ba2bef372a71c701c720b80d4ef7a36e41769531dc
|
7
|
+
data.tar.gz: 40638518e753f5a03e1f20848d4aa2586fb5f02dcdce3e8eab500c68e48d2099e92b3b12295bf36c6ea696910af122ede99b41ae08d47d1c4ff8337fbd5d1dfc
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -58,9 +58,12 @@ In your Gemfile:
|
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
gem 'reactive-ruby'
|
61
|
-
gem 'react-rails'
|
61
|
+
gem 'react-rails', '~> 1.3.2'
|
62
62
|
gem 'opal-rails'
|
63
63
|
gem 'therubyracer', platforms: :ruby # Required for prerendering
|
64
|
+
# for JRuby you need the below line instead
|
65
|
+
# gem 'therubyrhino, platforms: :jruby
|
66
|
+
|
64
67
|
```
|
65
68
|
|
66
69
|
Run `bundle install` and restart your rails server.
|
@@ -136,7 +139,7 @@ props), to render the component:
|
|
136
139
|
class HomeController < ApplicationController
|
137
140
|
def show
|
138
141
|
# render_component uses the controller name to find the 'show' component.
|
139
|
-
render_component say_hello_to: params[:say_hello_to]
|
142
|
+
render_component say_hello_to: params[:say_hello_to]
|
140
143
|
end
|
141
144
|
end
|
142
145
|
```
|
@@ -161,11 +164,11 @@ regardless of the name of the controller method.
|
|
161
164
|
|
162
165
|
Searching for components works like this: Given a controller named
|
163
166
|
"Foo" then react.rb will search for a module named `Foo` containing the component.
|
164
|
-
If this fails all modules will be searched (i.e. the name of the controller will be
|
167
|
+
If this fails all modules will be searched (i.e. the name of the controller will be
|
165
168
|
ignored.) In either case the search begins at the outer most scope until a match is made.
|
166
169
|
|
167
170
|
Thus for example given a controller named `Foo`, components could be found in the `Foo` module,
|
168
|
-
the `Components::Foo` module, in the outer most scope, or in any nested module.
|
171
|
+
the `Components::Foo` module, in the outer most scope, or in any nested module.
|
169
172
|
The way the search works allows for small projects that do not need a lot
|
170
173
|
of name spacing, and also allows components to be shared across several controllers.
|
171
174
|
|
@@ -1,15 +1,13 @@
|
|
1
|
-
<% if defined? application_definition
|
1
|
+
<% if defined? application_definition -%>
|
2
|
+
require File.expand_path('../boot', __FILE__)
|
3
|
+
require 'rails/all'
|
2
4
|
|
3
|
-
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(*Rails.groups(assets: %w(development test)))
|
4
8
|
|
5
|
-
|
9
|
+
require 'opal-rails'
|
10
|
+
require 'reactive-ruby'
|
6
11
|
|
7
|
-
|
8
|
-
|
9
|
-
Bundler.require(*Rails.groups(assets: %w(development test)))
|
10
|
-
|
11
|
-
require 'reactive-ruby'
|
12
|
-
|
13
|
-
<%= application_definition %>
|
14
|
-
|
15
|
-
<% end %>
|
12
|
+
<%= application_definition %>
|
13
|
+
<% end -%>
|
data/lib/react/component.rb
CHANGED
@@ -7,13 +7,14 @@ require 'react/observable'
|
|
7
7
|
require 'react/state'
|
8
8
|
require 'react/component/api'
|
9
9
|
require 'react/component/class_methods'
|
10
|
+
require 'react/component/props_wrapper'
|
10
11
|
require 'native'
|
11
12
|
|
12
13
|
module React
|
13
14
|
module Component
|
14
15
|
def self.included(base)
|
15
16
|
base.include(API)
|
16
|
-
base.include(
|
17
|
+
base.include(Callbacks)
|
17
18
|
base.class_eval do
|
18
19
|
class_attribute :initial_state
|
19
20
|
define_callback :before_mount
|
@@ -22,48 +23,6 @@ module React
|
|
22
23
|
define_callback :before_update
|
23
24
|
define_callback :after_update
|
24
25
|
define_callback :before_unmount
|
25
|
-
|
26
|
-
def deprecated_params_method(name, *args, &block)
|
27
|
-
self.class.deprecation_warning "Direct access to param `#{name}`. Use `params.#{name}` instead."
|
28
|
-
params.send(name, *args, &block)
|
29
|
-
end
|
30
|
-
|
31
|
-
def render
|
32
|
-
raise "no render defined"
|
33
|
-
end unless method_defined?(:render)
|
34
|
-
|
35
|
-
def children
|
36
|
-
nodes = [`#{@native}.props.children`].flatten
|
37
|
-
class << nodes
|
38
|
-
include Enumerable
|
39
|
-
|
40
|
-
def to_n
|
41
|
-
self
|
42
|
-
end
|
43
|
-
|
44
|
-
def each(&block)
|
45
|
-
if block_given?
|
46
|
-
%x{
|
47
|
-
React.Children.forEach(#{self.to_n}, function(context){
|
48
|
-
#{block.call(React::Element.new(`context`))}
|
49
|
-
})
|
50
|
-
}
|
51
|
-
nil
|
52
|
-
else
|
53
|
-
Enumerator.new(`React.Children.count(#{self.to_n})`) do |y|
|
54
|
-
%x{
|
55
|
-
React.Children.forEach(#{self.to_n}, function(context){
|
56
|
-
#{y << React::Element.new(`context`)}
|
57
|
-
})
|
58
|
-
}
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
nodes
|
65
|
-
end
|
66
|
-
|
67
26
|
end
|
68
27
|
base.extend(ClassMethods)
|
69
28
|
|
@@ -71,7 +30,6 @@ module React
|
|
71
30
|
parent = base.name.split("::").inject([Module]) { |nesting, next_const| nesting + [nesting.last.const_get(next_const)] }[-2]
|
72
31
|
|
73
32
|
class << parent
|
74
|
-
|
75
33
|
def method_missing(n, *args, &block)
|
76
34
|
name = n
|
77
35
|
if name =~ /_as_node$/
|
@@ -86,9 +44,8 @@ module React
|
|
86
44
|
unless name && name.method_defined?(:render)
|
87
45
|
return super
|
88
46
|
end
|
89
|
-
|
47
|
+
RenderingContext.build_or_render(node_only, name, *args, &block)
|
90
48
|
end
|
91
|
-
|
92
49
|
end
|
93
50
|
end
|
94
51
|
end
|
@@ -97,9 +54,49 @@ module React
|
|
97
54
|
@native = native_element
|
98
55
|
end
|
99
56
|
|
57
|
+
def render
|
58
|
+
raise "no render defined"
|
59
|
+
end unless method_defined?(:render)
|
60
|
+
|
61
|
+
def deprecated_params_method(name, *args, &block)
|
62
|
+
self.class.deprecation_warning "Direct access to param `#{name}`. Use `params.#{name}` instead."
|
63
|
+
params.send(name, *args, &block)
|
64
|
+
end
|
65
|
+
|
66
|
+
def children
|
67
|
+
nodes = [`#{@native}.props.children`].flatten
|
68
|
+
class << nodes
|
69
|
+
include Enumerable
|
70
|
+
|
71
|
+
def to_n
|
72
|
+
self
|
73
|
+
end
|
74
|
+
|
75
|
+
def each(&block)
|
76
|
+
if block_given?
|
77
|
+
%x{
|
78
|
+
React.Children.forEach(#{self.to_n}, function(context){
|
79
|
+
#{block.call(React::Element.new(`context`))}
|
80
|
+
})
|
81
|
+
}
|
82
|
+
nil
|
83
|
+
else
|
84
|
+
Enumerator.new(`React.Children.count(#{self.to_n})`) do |y|
|
85
|
+
%x{
|
86
|
+
React.Children.forEach(#{self.to_n}, function(context){
|
87
|
+
#{y << React::Element.new(`context`)}
|
88
|
+
})
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
nodes
|
96
|
+
end
|
97
|
+
|
100
98
|
def params
|
101
99
|
@props_wrapper
|
102
|
-
#Hash.new(`#{@native}.props`)
|
103
100
|
end
|
104
101
|
|
105
102
|
def props
|
@@ -131,16 +128,16 @@ module React
|
|
131
128
|
IsomorphicHelpers.load_context(true) if IsomorphicHelpers.on_opal_client?
|
132
129
|
@props_wrapper = self.class.props_wrapper.new(Hash.new(`#{@native}.props`))
|
133
130
|
set_state! initial_state if initial_state
|
134
|
-
|
135
|
-
|
131
|
+
State.initialize_states(self, initial_state)
|
132
|
+
State.set_state_context_to(self) { self.run_callback(:before_mount) }
|
136
133
|
rescue Exception => e
|
137
134
|
self.class.process_exception(e, self)
|
138
135
|
end
|
139
136
|
|
140
137
|
def component_did_mount
|
141
|
-
|
138
|
+
State.set_state_context_to(self) do
|
142
139
|
self.run_callback(:after_mount)
|
143
|
-
|
140
|
+
State.update_states_to_observe
|
144
141
|
end
|
145
142
|
rescue Exception => e
|
146
143
|
self.class.process_exception(e, self)
|
@@ -149,7 +146,7 @@ module React
|
|
149
146
|
def component_will_receive_props(next_props)
|
150
147
|
# need to rethink how this works in opal-react, or if its actually that useful within the react.rb environment
|
151
148
|
# for now we are just using it to clear processed_params
|
152
|
-
|
149
|
+
State.set_state_context_to(self) { self.run_callback(:before_receive_props, Hash.new(next_props)) }
|
153
150
|
rescue Exception => e
|
154
151
|
self.class.process_exception(e, self)
|
155
152
|
end
|
@@ -160,7 +157,7 @@ module React
|
|
160
157
|
end
|
161
158
|
|
162
159
|
def should_component_update?(next_props, next_state)
|
163
|
-
|
160
|
+
State.set_state_context_to(self) do
|
164
161
|
next_props = Hash.new(next_props)
|
165
162
|
if self.respond_to?(:needs_update?)
|
166
163
|
!!self.needs_update?(next_props, Hash.new(next_state))
|
@@ -181,25 +178,25 @@ module React
|
|
181
178
|
end
|
182
179
|
|
183
180
|
def component_will_update(next_props, next_state)
|
184
|
-
|
181
|
+
State.set_state_context_to(self) { self.run_callback(:before_update, Hash.new(next_props), Hash.new(next_state)) }
|
185
182
|
@props_wrapper = self.class.props_wrapper.new(Hash.new(next_props))
|
186
183
|
rescue Exception => e
|
187
184
|
self.class.process_exception(e, self)
|
188
185
|
end
|
189
186
|
|
190
187
|
def component_did_update(prev_props, prev_state)
|
191
|
-
|
188
|
+
State.set_state_context_to(self) do
|
192
189
|
self.run_callback(:after_update, Hash.new(prev_props), Hash.new(prev_state))
|
193
|
-
|
190
|
+
State.update_states_to_observe
|
194
191
|
end
|
195
192
|
rescue Exception => e
|
196
193
|
self.class.process_exception(e, self)
|
197
194
|
end
|
198
195
|
|
199
196
|
def component_will_unmount
|
200
|
-
|
197
|
+
State.set_state_context_to(self) do
|
201
198
|
self.run_callback(:before_unmount)
|
202
|
-
|
199
|
+
State.remove
|
203
200
|
end
|
204
201
|
rescue Exception => e
|
205
202
|
self.class.process_exception(e, self)
|
@@ -232,7 +229,7 @@ module React
|
|
232
229
|
node_only = true
|
233
230
|
name = name.gsub(/_as_node$/, "")
|
234
231
|
end
|
235
|
-
unless (
|
232
|
+
unless (HTML_TAGS.include?(name) || name == 'present' || name == '_p_tag' || (name = component?(name, self)))
|
236
233
|
return super
|
237
234
|
end
|
238
235
|
|
@@ -244,21 +241,21 @@ module React
|
|
244
241
|
name = "p"
|
245
242
|
end
|
246
243
|
|
247
|
-
|
244
|
+
RenderingContext.build_or_render(node_only, name, *args, &block)
|
248
245
|
end
|
249
246
|
|
250
247
|
def watch(value, &on_change)
|
251
|
-
|
248
|
+
Observable.new(value, on_change)
|
252
249
|
end
|
253
250
|
|
254
251
|
def define_state(*args, &block)
|
255
|
-
|
252
|
+
State.initialize_states(self, self.class.define_state(*args, &block))
|
256
253
|
end
|
257
254
|
|
258
255
|
attr_reader :waiting_on_resources
|
259
256
|
|
260
257
|
def _render_wrapper
|
261
|
-
|
258
|
+
State.set_state_context_to(self) do
|
262
259
|
RenderingContext.render(nil) {render || ""}.tap { |element| @waiting_on_resources = element.waiting_on_resources if element.respond_to? :waiting_on_resources }
|
263
260
|
end
|
264
261
|
rescue Exception => e
|
data/lib/react/component/base.rb
CHANGED
@@ -114,7 +114,7 @@ module React
|
|
114
114
|
default_initial_value = (block && block.arity == 0) ? yield : nil
|
115
115
|
states_hash = (states.last.is_a?(Hash)) ? states.pop : {}
|
116
116
|
states.each { |name| states_hash[name] = default_initial_value }
|
117
|
-
|
117
|
+
State.initialize_states(self, states_hash)
|
118
118
|
states_hash.each do |name, initial_value|
|
119
119
|
define_state_methods(self, name, self, &block)
|
120
120
|
define_state_methods(singleton_class, name, self, &block)
|
@@ -124,27 +124,27 @@ module React
|
|
124
124
|
def define_state_methods(this, name, from = nil, &block)
|
125
125
|
this.define_method("#{name}") do
|
126
126
|
self.class.deprecation_warning "Direct access to state `#{name}`. Use `state.#{name}` instead." if from.nil? || from == this
|
127
|
-
|
127
|
+
State.get_state(from || self, name)
|
128
128
|
end
|
129
129
|
this.define_method("#{name}=") do |new_state|
|
130
130
|
self.class.deprecation_warning "Direct assignment to state `#{name}`. Use `#{(from && from != this) ? from : 'state'}.#{name}!` instead."
|
131
|
-
yield name,
|
132
|
-
|
131
|
+
yield name, State.get_state(from || self, name), new_state if block && block.arity > 0
|
132
|
+
State.set_state(from || self, name, new_state)
|
133
133
|
end
|
134
134
|
this.define_method("#{name}!") do |*args|
|
135
135
|
self.class.deprecation_warning "Direct access to state `#{name}`. Use `state.#{name}` instead." if from.nil? or from == this
|
136
136
|
if args.count > 0
|
137
|
-
yield name,
|
138
|
-
current_value =
|
139
|
-
|
137
|
+
yield name, State.get_state(from || self, name), args[0] if block && block.arity > 0
|
138
|
+
current_value = State.get_state(from || self, name)
|
139
|
+
State.set_state(from || self, name, args[0])
|
140
140
|
current_value
|
141
141
|
else
|
142
|
-
current_state =
|
143
|
-
yield name,
|
144
|
-
|
145
|
-
|
146
|
-
yield name,
|
147
|
-
|
142
|
+
current_state = State.get_state(from || self, name)
|
143
|
+
yield name, State.get_state(from || self, name), current_state if block && block.arity > 0
|
144
|
+
State.set_state(from || self, name, current_state)
|
145
|
+
Observable.new(current_state) do |update|
|
146
|
+
yield name, State.get_state(from || self, name), update if block && block.arity > 0
|
147
|
+
State.set_state(from || self, name, update)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module React
|
2
2
|
module Component
|
3
|
-
class PropsWrapper
|
3
|
+
class PropsWrapper
|
4
4
|
attr_reader :props
|
5
5
|
|
6
6
|
def self.define_param(name, param_type, owner)
|
7
|
-
owner.define_method("#{name}") do
|
7
|
+
owner.define_method("#{name}") do |*args, &block|
|
8
8
|
deprecated_params_method("#{name}", *args, &block)
|
9
9
|
end
|
10
|
-
if param_type ==
|
10
|
+
if param_type == Observable
|
11
11
|
owner.define_method("#{name}!") do |*args|
|
12
12
|
deprecated_params_method("#{name}!", *args)
|
13
13
|
end
|
@@ -48,7 +48,7 @@ module React
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def initialize(props)
|
51
|
-
@props= props|| {}
|
51
|
+
@props = props || {}
|
52
52
|
end
|
53
53
|
|
54
54
|
def [](prop)
|
data/lib/react/state.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module React
|
2
|
-
|
3
2
|
class StateWrapper < BasicObject
|
4
|
-
|
5
3
|
def initialize(native, from)
|
6
4
|
@state_hash = Hash.new(`#{native}.state`)
|
7
5
|
@from = from
|
@@ -18,23 +16,22 @@ module React
|
|
18
16
|
def method_missing(method, *args)
|
19
17
|
if match = method.match(/^(.+)\!$/)
|
20
18
|
if args.count > 0
|
21
|
-
current_value =
|
22
|
-
|
19
|
+
current_value = State.get_state(@from, match[1])
|
20
|
+
State.set_state(@from, $1, args[0])
|
23
21
|
current_value
|
24
22
|
else
|
25
|
-
current_state =
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
current_state = State.get_state(@from, match[1])
|
24
|
+
State.set_state(@from, $1, current_state)
|
25
|
+
Observable.new(current_state) do |update|
|
26
|
+
State.set_state(@from, $1, update)
|
29
27
|
end
|
30
28
|
end
|
31
29
|
else
|
32
|
-
|
30
|
+
State.get_state(@from, method)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
|
-
|
38
35
|
class State
|
39
36
|
class << self
|
40
37
|
attr_reader :current_observer
|
data/lib/reactive-ruby.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
if RUBY_ENGINE == 'opal'
|
2
2
|
require 'sources/react.js'
|
3
3
|
require 'react/top_level'
|
4
|
+
require 'react/observable'
|
4
5
|
require 'react/component'
|
5
|
-
require 'react/component/props_wrapper'
|
6
6
|
require 'react/component/base'
|
7
7
|
require 'react/element'
|
8
8
|
require 'react/event'
|
9
9
|
require 'react/api'
|
10
10
|
require 'react/validator'
|
11
|
-
require 'react/observable'
|
12
11
|
require 'react/rendering_context'
|
13
12
|
require 'react/state'
|
14
13
|
require 'reactive-ruby/isomorphic_helpers'
|
@@ -1,5 +1,14 @@
|
|
1
1
|
module ReactiveRuby
|
2
2
|
module ServerRendering
|
3
|
+
def self.context_instance_name
|
4
|
+
return '@rhino_context' if RUBY_PLATFORM == 'java'
|
5
|
+
'@v8_context'
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.context_instance_for(context)
|
9
|
+
context.instance_variable_get(context_instance_name)
|
10
|
+
end
|
11
|
+
|
3
12
|
class ContextualRenderer < React::ServerRendering::SprocketsRenderer
|
4
13
|
def initialize(options = {})
|
5
14
|
super(options)
|
@@ -7,9 +16,9 @@ module ReactiveRuby
|
|
7
16
|
end
|
8
17
|
|
9
18
|
def render(component_name, props, prerender_options)
|
10
|
-
if prerender_options.is_a?
|
19
|
+
if prerender_options.is_a?(Hash)
|
11
20
|
if v8_runtime? && prerender_options[:context_initializer]
|
12
|
-
raise
|
21
|
+
raise PrerenderError.new(component_name, props, "you must use 'therubyracer' with the prerender[:context] option") unless v8_runtime?
|
13
22
|
else
|
14
23
|
prerender_options[:context_initializer].call v8_context
|
15
24
|
prerender_options = prerender_options[:static] ? :static : true
|
@@ -22,11 +31,11 @@ module ReactiveRuby
|
|
22
31
|
private
|
23
32
|
|
24
33
|
def v8_runtime?
|
25
|
-
ExecJS.runtime.name
|
34
|
+
["(V8)", "therubyrhino (Rhino)"].include?(ExecJS.runtime.name)
|
26
35
|
end
|
27
36
|
|
28
37
|
def v8_context
|
29
|
-
@v8_context ||=
|
38
|
+
@v8_context ||= ReactiveRuby::ServerRendering.context_instance_for(@context)
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
data/reactive-ruby.gemspec
CHANGED
@@ -20,13 +20,25 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
s.add_dependency 'opal'
|
23
|
+
s.add_dependency 'opal', '0.8.0'
|
24
24
|
s.add_dependency 'opal-activesupport', '>= 0.2.0'
|
25
|
-
s.add_dependency 'opal-browser'
|
25
|
+
s.add_dependency 'opal-browser', '0.2.0'
|
26
26
|
s.add_development_dependency 'rake'
|
27
|
-
s.add_development_dependency 'rspec-rails'
|
27
|
+
s.add_development_dependency 'rspec-rails', '3.3.3'
|
28
28
|
s.add_development_dependency 'timecop'
|
29
|
-
s.add_development_dependency 'opal-rspec'
|
29
|
+
s.add_development_dependency 'opal-rspec', '0.4.3'
|
30
30
|
s.add_development_dependency 'sinatra'
|
31
|
-
|
31
|
+
|
32
|
+
# For Test Rails App
|
33
|
+
s.add_development_dependency 'rails', '4.2.4'
|
34
|
+
s.add_development_dependency 'react-rails', '1.3.1'
|
35
|
+
s.add_development_dependency 'opal-rails', '0.8.0'
|
36
|
+
if RUBY_PLATFORM == 'java'
|
37
|
+
s.add_development_dependency 'jdbc-sqlite3'
|
38
|
+
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter'
|
39
|
+
s.add_development_dependency 'therubyrhino'
|
40
|
+
else
|
41
|
+
s.add_development_dependency 'sqlite3', '1.3.10'
|
42
|
+
s.add_development_dependency 'therubyracer', '0.12.2'
|
43
|
+
end
|
32
44
|
end
|
@@ -25,9 +25,12 @@ describe React::Component::Base do
|
|
25
25
|
@instance_data.join(" ")
|
26
26
|
end
|
27
27
|
end
|
28
|
-
expect(
|
29
|
-
expect(
|
28
|
+
expect(rendered_component(Foo)).to eq("<span>working</span>")
|
29
|
+
expect(rendered_component(Bar)).to eq("<span>working well</span>")
|
30
30
|
end
|
31
31
|
|
32
|
+
def rendered_component(component)
|
33
|
+
React.render_to_static_markup(React.create_element(component))
|
34
|
+
end
|
32
35
|
end
|
33
36
|
end
|
@@ -2,6 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
if opal?
|
4
4
|
describe 'the param macro' do
|
5
|
+
it 'still defines deprecated param accessor method' do
|
6
|
+
stub_const 'Foo', Class.new(React::Component::Base)
|
7
|
+
Foo.class_eval do
|
8
|
+
param :foo
|
9
|
+
|
10
|
+
def render
|
11
|
+
div { foo }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
html = React.render_to_static_markup(React.create_element(Foo, {foo: :bar}))
|
16
|
+
expect(html).to eq('<div>bar</div>')
|
17
|
+
end
|
18
|
+
|
5
19
|
it "can create and access a required param" do
|
6
20
|
stub_const 'Foo', Class.new(React::Component::Base)
|
7
21
|
Foo.class_eval do
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if opal?
|
4
|
+
describe 'React::State' do
|
5
|
+
it "can created static exported states" do
|
6
|
+
stub_const 'Foo', Class.new
|
7
|
+
Foo.class_eval do
|
8
|
+
include React::Component
|
9
|
+
export_state(:foo) { 'bar' }
|
10
|
+
end
|
11
|
+
|
12
|
+
expect(Foo.foo).to eq('bar')
|
13
|
+
end
|
14
|
+
|
15
|
+
# these will all require async operations and testing to see if things get
|
16
|
+
# re-rendered see spec_helper the "render" test method
|
17
|
+
|
18
|
+
# if Foo.foo is used during rendering then when Foo.foo changes we will
|
19
|
+
# rerender
|
20
|
+
it "sets up observers when exported states are read"
|
21
|
+
|
22
|
+
# React::State.set_state(object, attribute, value) +
|
23
|
+
# React::State.get_state(object, attribute)
|
24
|
+
it "can be accessed outside of react using get/set_state"
|
25
|
+
end
|
26
|
+
end
|
@@ -10,7 +10,7 @@ RSpec.describe ReactiveRuby::ComponentLoader do
|
|
10
10
|
|
11
11
|
let(:js) { ::Rails.application.assets['components'].to_s }
|
12
12
|
let(:context) { ExecJS.compile(GLOBAL_WRAPPER + js) }
|
13
|
-
let(:v8_context) {
|
13
|
+
let(:v8_context) { ReactiveRuby::ServerRendering.context_instance_for(context) }
|
14
14
|
|
15
15
|
describe '.new' do
|
16
16
|
it 'raises a meaningful exception when initialized without a context' do
|
@@ -73,7 +73,7 @@ if ruby?
|
|
73
73
|
end
|
74
74
|
js = "#{React::ServerRendering::ExecJSRenderer::GLOBAL_WRAPPER}#{js}"
|
75
75
|
ctx = ExecJS.compile(js)
|
76
|
-
ctx =
|
76
|
+
ctx = ReactiveRuby::ServerRendering.context_instance_for(ctx)
|
77
77
|
end
|
78
78
|
|
79
79
|
def react_context
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reactive-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opal-activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: opal-browser
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rspec-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.3.3
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.3.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: timecop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: opal-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.4.3
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 0.4.3
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sinatra
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,20 +122,76 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 4.2.4
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 4.2.4
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: react-rails
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.3.1
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.3.1
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: opal-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.8.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.8.0
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
168
|
name: sqlite3
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
128
170
|
requirements:
|
129
|
-
- -
|
171
|
+
- - '='
|
130
172
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
173
|
+
version: 1.3.10
|
132
174
|
type: :development
|
133
175
|
prerelease: false
|
134
176
|
version_requirements: !ruby/object:Gem::Requirement
|
135
177
|
requirements:
|
136
|
-
- -
|
178
|
+
- - '='
|
137
179
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
180
|
+
version: 1.3.10
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: therubyracer
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - '='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.12.2
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - '='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.12.2
|
139
195
|
description: Write React UI components in pure Ruby.
|
140
196
|
email: zeta11235813@gmail.com
|
141
197
|
executables: []
|
@@ -146,7 +202,6 @@ files:
|
|
146
202
|
- ".gitignore"
|
147
203
|
- ".travis.yml"
|
148
204
|
- Gemfile
|
149
|
-
- Gemfile.lock
|
150
205
|
- LICENSE
|
151
206
|
- README.md
|
152
207
|
- Rakefile
|
@@ -293,7 +348,7 @@ files:
|
|
293
348
|
- spec/controller_helper_spec.rb
|
294
349
|
- spec/index.html.erb
|
295
350
|
- spec/react/callbacks_spec.rb
|
296
|
-
- spec/react/
|
351
|
+
- spec/react/component/base_spec.rb
|
297
352
|
- spec/react/component_spec.rb
|
298
353
|
- spec/react/dsl_spec.rb
|
299
354
|
- spec/react/element_spec.rb
|
@@ -302,7 +357,7 @@ files:
|
|
302
357
|
- spec/react/observable_spec.rb
|
303
358
|
- spec/react/param_declaration_spec.rb
|
304
359
|
- spec/react/react_spec.rb
|
305
|
-
- spec/react/
|
360
|
+
- spec/react/state_spec.rb
|
306
361
|
- spec/react/top_level_component_spec.rb
|
307
362
|
- spec/react/tutorial/tutorial_spec.rb
|
308
363
|
- spec/react/validator_spec.rb
|
@@ -341,7 +396,7 @@ test_files:
|
|
341
396
|
- spec/controller_helper_spec.rb
|
342
397
|
- spec/index.html.erb
|
343
398
|
- spec/react/callbacks_spec.rb
|
344
|
-
- spec/react/
|
399
|
+
- spec/react/component/base_spec.rb
|
345
400
|
- spec/react/component_spec.rb
|
346
401
|
- spec/react/dsl_spec.rb
|
347
402
|
- spec/react/element_spec.rb
|
@@ -350,7 +405,7 @@ test_files:
|
|
350
405
|
- spec/react/observable_spec.rb
|
351
406
|
- spec/react/param_declaration_spec.rb
|
352
407
|
- spec/react/react_spec.rb
|
353
|
-
- spec/react/
|
408
|
+
- spec/react/state_spec.rb
|
354
409
|
- spec/react/top_level_component_spec.rb
|
355
410
|
- spec/react/tutorial/tutorial_spec.rb
|
356
411
|
- spec/react/validator_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,193 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
reactive-ruby (0.7.33)
|
5
|
-
opal
|
6
|
-
opal-activesupport (>= 0.2.0)
|
7
|
-
opal-browser
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionmailer (4.2.4)
|
13
|
-
actionpack (= 4.2.4)
|
14
|
-
actionview (= 4.2.4)
|
15
|
-
activejob (= 4.2.4)
|
16
|
-
mail (~> 2.5, >= 2.5.4)
|
17
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
|
-
actionpack (4.2.4)
|
19
|
-
actionview (= 4.2.4)
|
20
|
-
activesupport (= 4.2.4)
|
21
|
-
rack (~> 1.6)
|
22
|
-
rack-test (~> 0.6.2)
|
23
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
25
|
-
actionview (4.2.4)
|
26
|
-
activesupport (= 4.2.4)
|
27
|
-
builder (~> 3.1)
|
28
|
-
erubis (~> 2.7.0)
|
29
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
31
|
-
activejob (4.2.4)
|
32
|
-
activesupport (= 4.2.4)
|
33
|
-
globalid (>= 0.3.0)
|
34
|
-
activemodel (4.2.4)
|
35
|
-
activesupport (= 4.2.4)
|
36
|
-
builder (~> 3.1)
|
37
|
-
activerecord (4.2.4)
|
38
|
-
activemodel (= 4.2.4)
|
39
|
-
activesupport (= 4.2.4)
|
40
|
-
arel (~> 6.0)
|
41
|
-
activesupport (4.2.4)
|
42
|
-
i18n (~> 0.7)
|
43
|
-
json (~> 1.7, >= 1.7.7)
|
44
|
-
minitest (~> 5.1)
|
45
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
46
|
-
tzinfo (~> 1.1)
|
47
|
-
arel (6.0.3)
|
48
|
-
babel-source (5.8.26)
|
49
|
-
babel-transpiler (0.7.0)
|
50
|
-
babel-source (>= 4.0, < 6)
|
51
|
-
execjs (~> 2.0)
|
52
|
-
builder (3.2.2)
|
53
|
-
coffee-script-source (1.9.1.1)
|
54
|
-
connection_pool (2.2.0)
|
55
|
-
diff-lcs (1.2.5)
|
56
|
-
erubis (2.7.0)
|
57
|
-
execjs (2.6.0)
|
58
|
-
globalid (0.3.6)
|
59
|
-
activesupport (>= 4.1.0)
|
60
|
-
hike (1.2.3)
|
61
|
-
i18n (0.7.0)
|
62
|
-
jquery-rails (4.0.5)
|
63
|
-
rails-dom-testing (~> 1.0)
|
64
|
-
railties (>= 4.2.0)
|
65
|
-
thor (>= 0.14, < 2.0)
|
66
|
-
json (1.8.3)
|
67
|
-
libv8 (3.16.14.11)
|
68
|
-
loofah (2.0.3)
|
69
|
-
nokogiri (>= 1.5.9)
|
70
|
-
mail (2.6.3)
|
71
|
-
mime-types (>= 1.16, < 3)
|
72
|
-
mime-types (2.6.2)
|
73
|
-
mini_portile (0.6.2)
|
74
|
-
minitest (5.8.1)
|
75
|
-
nokogiri (1.6.6.2)
|
76
|
-
mini_portile (~> 0.6.0)
|
77
|
-
opal (0.8.0)
|
78
|
-
hike (~> 1.2)
|
79
|
-
sourcemap (~> 0.1.0)
|
80
|
-
sprockets (~> 3.1)
|
81
|
-
tilt (>= 1.4)
|
82
|
-
opal-activesupport (0.2.0)
|
83
|
-
opal (>= 0.5.0, < 1.0.0)
|
84
|
-
opal-browser (0.2.0)
|
85
|
-
opal
|
86
|
-
paggio
|
87
|
-
opal-jquery (0.4.0)
|
88
|
-
opal (>= 0.7.0, < 0.9.0)
|
89
|
-
opal-rails (0.8.0)
|
90
|
-
jquery-rails
|
91
|
-
opal (~> 0.8.0)
|
92
|
-
opal-activesupport (>= 0.0.5)
|
93
|
-
opal-jquery (~> 0.4.0)
|
94
|
-
opal-rspec (~> 0.4.3)
|
95
|
-
rails (>= 3.2, < 5.0)
|
96
|
-
opal-rspec (0.4.3)
|
97
|
-
opal (>= 0.7.0, < 0.9)
|
98
|
-
paggio (0.2.5)
|
99
|
-
rack (1.6.4)
|
100
|
-
rack-protection (1.5.3)
|
101
|
-
rack
|
102
|
-
rack-test (0.6.3)
|
103
|
-
rack (>= 1.0)
|
104
|
-
rails (4.2.4)
|
105
|
-
actionmailer (= 4.2.4)
|
106
|
-
actionpack (= 4.2.4)
|
107
|
-
actionview (= 4.2.4)
|
108
|
-
activejob (= 4.2.4)
|
109
|
-
activemodel (= 4.2.4)
|
110
|
-
activerecord (= 4.2.4)
|
111
|
-
activesupport (= 4.2.4)
|
112
|
-
bundler (>= 1.3.0, < 2.0)
|
113
|
-
railties (= 4.2.4)
|
114
|
-
sprockets-rails
|
115
|
-
rails-deprecated_sanitizer (1.0.3)
|
116
|
-
activesupport (>= 4.2.0.alpha)
|
117
|
-
rails-dom-testing (1.0.7)
|
118
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
119
|
-
nokogiri (~> 1.6.0)
|
120
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
121
|
-
rails-html-sanitizer (1.0.2)
|
122
|
-
loofah (~> 2.0)
|
123
|
-
railties (4.2.4)
|
124
|
-
actionpack (= 4.2.4)
|
125
|
-
activesupport (= 4.2.4)
|
126
|
-
rake (>= 0.8.7)
|
127
|
-
thor (>= 0.18.1, < 2.0)
|
128
|
-
rake (10.4.2)
|
129
|
-
react-rails (1.3.1)
|
130
|
-
babel-transpiler (>= 0.7.0)
|
131
|
-
coffee-script-source (~> 1.8)
|
132
|
-
connection_pool
|
133
|
-
execjs
|
134
|
-
rails (>= 3.2)
|
135
|
-
tilt
|
136
|
-
ref (2.0.0)
|
137
|
-
rspec-core (3.3.2)
|
138
|
-
rspec-support (~> 3.3.0)
|
139
|
-
rspec-expectations (3.3.1)
|
140
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
141
|
-
rspec-support (~> 3.3.0)
|
142
|
-
rspec-mocks (3.3.2)
|
143
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
144
|
-
rspec-support (~> 3.3.0)
|
145
|
-
rspec-rails (3.3.3)
|
146
|
-
actionpack (>= 3.0, < 4.3)
|
147
|
-
activesupport (>= 3.0, < 4.3)
|
148
|
-
railties (>= 3.0, < 4.3)
|
149
|
-
rspec-core (~> 3.3.0)
|
150
|
-
rspec-expectations (~> 3.3.0)
|
151
|
-
rspec-mocks (~> 3.3.0)
|
152
|
-
rspec-support (~> 3.3.0)
|
153
|
-
rspec-support (3.3.0)
|
154
|
-
sinatra (1.4.6)
|
155
|
-
rack (~> 1.4)
|
156
|
-
rack-protection (~> 1.4)
|
157
|
-
tilt (>= 1.3, < 3)
|
158
|
-
sourcemap (0.1.1)
|
159
|
-
sprockets (3.4.0)
|
160
|
-
rack (> 1, < 3)
|
161
|
-
sprockets-rails (2.3.3)
|
162
|
-
actionpack (>= 3.0)
|
163
|
-
activesupport (>= 3.0)
|
164
|
-
sprockets (>= 2.8, < 4.0)
|
165
|
-
sqlite3 (1.3.10)
|
166
|
-
therubyracer (0.12.2)
|
167
|
-
libv8 (~> 3.16.14.0)
|
168
|
-
ref
|
169
|
-
thor (0.19.1)
|
170
|
-
thread_safe (0.3.5)
|
171
|
-
tilt (2.0.1)
|
172
|
-
timecop (0.7.1)
|
173
|
-
tzinfo (1.2.2)
|
174
|
-
thread_safe (~> 0.1)
|
175
|
-
|
176
|
-
PLATFORMS
|
177
|
-
ruby
|
178
|
-
|
179
|
-
DEPENDENCIES
|
180
|
-
opal-rails
|
181
|
-
opal-rspec
|
182
|
-
rails
|
183
|
-
rake
|
184
|
-
react-rails
|
185
|
-
reactive-ruby!
|
186
|
-
rspec-rails
|
187
|
-
sinatra
|
188
|
-
sqlite3
|
189
|
-
therubyracer
|
190
|
-
timecop
|
191
|
-
|
192
|
-
BUNDLED WITH
|
193
|
-
1.10.6
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
if opal?
|
4
|
-
|
5
|
-
describe 'React::State' do
|
6
|
-
# class Foo; export_state :foo; end # accessible as Foo.foo outside
|
7
|
-
it "can created static exported states" do
|
8
|
-
stub_const 'Foo', Class.new
|
9
|
-
Foo.class_eval do
|
10
|
-
include React::Component
|
11
|
-
export_state(:foo) { 'bar' }
|
12
|
-
end
|
13
|
-
|
14
|
-
expect(Foo.foo).to eq('bar')
|
15
|
-
end
|
16
|
-
|
17
|
-
# these will all require async operations and testing to see if things get re-rendered see spec_helper the "render" test method
|
18
|
-
it "sets up observers when exported states are read" # if Foo.foo is used during rendering then when Foo.foo changes we will rerender
|
19
|
-
it "can be accessed outside of react using get/set_state" # React::State.set_state(object, attribute, value) + React::State.get_state(object, attribute)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|