This repository was archived by the owner on Oct 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change 2
2
3
3
describe 'opal-jquery extensions' , js : true do
4
4
describe 'Element' do
5
- xit 'will reuse the wrapper componet class for the same Element' do
6
- # TODO how come a def component_will_unmount will not be received
7
- stub_const 'Foo' , Class . new ( React ::Component ::Base )
8
- Foo . class_eval do
9
- param :name
10
- def render
11
- "hello #{ params . name } "
12
- end
13
-
14
- def component_will_unmount
5
+ xit 'will reuse the wrapper component class for the same Element' do
6
+ evaluate_ruby do
7
+ class Foo < React ::Component ::Base
8
+ param :name
9
+ def render
10
+ "hello #{ params . name } "
11
+ end
15
12
13
+ def self . rec_cnt
14
+ @@rec_cnt ||= 0
15
+ end
16
+ before_unmount do
17
+ @@rec_cnt ||= 0
18
+ @@rec_cnt += 1
19
+ end
16
20
end
17
21
end
18
-
19
- expect_any_instance_of ( Foo ) . to_not receive ( :component_will_unmount )
20
-
21
- test_div = Element . new ( :div )
22
- test_div . render { Foo ( name : 'fred' ) }
23
- test_div . render { Foo ( name : 'freddy' ) }
24
- expect ( Element [ test_div ] . find ( 'span' ) . html ) . to eq ( 'hello freddy' )
22
+ expect_evaluate_ruby do
23
+ test_div = Element . new ( :div )
24
+ test_div . render { Foo ( name : 'fred' ) }
25
+ test_div . render { Foo ( name : 'freddy' ) }
26
+ [ Element [ test_div ] . find ( 'span' ) . html , Foo . rec_cnt ]
27
+ end . to eq ( [ 'hello freddy' , 0 ] )
25
28
end
26
29
27
30
it 'renders a top level component using render with a block' do
You can’t perform that action at this time.
0 commit comments