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 +12
-12
lines changed
Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if opal?
4+
15describe 'Refs callback' do
26 before do
37 stub_const 'Foo' , Class . new
@@ -15,36 +19,32 @@ def render
1519 end
1620 end
1721
18- stub_const 'MyBar' , nil
1922 Foo . class_eval do
20- def my_bar = ( bar )
21- MyBar = bar
22- end
23+ attr_accessor :my_bar
2324
2425 def render
2526 React . create_element ( Bar , ref : method ( :my_bar= ) . to_proc )
2627 end
2728 end
2829
2930 element = React . create_element ( Foo )
30- React ::Test ::Utils . render_into_document ( element )
31- expect ( MyBar ) . to be_a ( Bar )
31+ instance = React ::Test ::Utils . render_into_document ( element )
32+ expect ( instance . my_bar ) . to be_a ( Bar )
3233 end
3334
3435 it "is invoked with the actual DOM node" do
35- stub_const 'MyDiv' , nil
3636 Foo . class_eval do
37- def my_div = ( div )
38- MyDiv = div
39- end
37+ attr_accessor :my_div
4038
4139 def render
4240 React . create_element ( 'div' , ref : method ( :my_div= ) . to_proc )
4341 end
4442 end
4543
4644 element = React . create_element ( Foo )
47- React ::Test ::Utils . render_into_document ( element )
48- expect ( `#{ MyDiv } .nodeType` ) . to eq ( 1 )
45+ instance = React ::Test ::Utils . render_into_document ( element )
46+ expect ( `#{ instance . my_div } .nodeType` ) . to eq ( 1 )
4947 end
5048end
49+
50+ end
You can’t perform that action at this time.
0 commit comments