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 @@ -94,7 +94,7 @@ def find_name_and_parent(component)
9494 private
9595
9696 def find_component ( name )
97- scopes = self . class . name . split ( '::' ) . inject ( [ Module ] ) do |nesting , next_const |
97+ scopes = " #{ self . class . name } " . split ( '::' ) . inject ( [ Module ] ) do |nesting , next_const |
9898 nesting + [ nesting . last . const_get ( next_const ) ]
9999 end . reverse
100100 scope = scopes . detect { |s | s . const_defined? ( name ) } || return
Original file line number Diff line number Diff line change 66 React ::API . clear_component_class_cache
77 end
88
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
1023 test_div = Element . new ( :div )
1124 test_div . render ( :span , id : :render_test_span ) { 'hello' }
1225 expect ( Element [ test_div ] . find ( '#render_test_span' ) . html ) . to eq ( 'hello' )
You can’t perform that action at this time.
0 commit comments