This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ def find_name_and_parent(component)
83
83
private
84
84
85
85
def find_component ( name )
86
- scopes = self . class . name . split ( '::' ) . inject ( [ Module ] ) do |nesting , next_const |
86
+ scopes = " #{ self . class . name } " . split ( '::' ) . inject ( [ Module ] ) do |nesting , next_const |
87
87
nesting + [ nesting . last . const_get ( next_const ) ]
88
88
end . reverse
89
89
scope = scopes . detect { |s | s . const_defined? ( name ) } || return
Original file line number Diff line number Diff line change 6
6
React ::API . clear_component_class_cache
7
7
end
8
8
9
- it 'renders a top level component using render' do
9
+ it 'renders a top level component using render with a block' do
10
+ stub_const 'Foo' , Class . new ( React ::Component ::Base )
11
+ Foo . class_eval do
12
+ param :name
13
+ def render
14
+ "hello #{ params . name } "
15
+ end
16
+ end
17
+ test_div = Element . new ( :div )
18
+ test_div . render { Foo ( name : 'fred' ) }
19
+ expect ( Element [ test_div ] . find ( 'span' ) . html ) . to eq ( 'hello fred' )
20
+ end
21
+
22
+ it 'renders a top level component using render with a container and params ' do
10
23
test_div = Element . new ( :div )
11
24
test_div . render ( :span , id : :render_test_span ) { 'hello' }
12
25
expect ( Element [ test_div ] . find ( '#render_test_span' ) . html ) . to eq ( 'hello' )
You can’t perform that action at this time.
0 commit comments