@@ -372,7 +372,7 @@ class Lorem; end
372372 optional :bar , type : String
373373 end
374374
375- def render ; DIV ; end
375+ def render ; DIV { } ; end
376376 end
377377 Hyperstack ::Component ::ReactTestUtils . render_component_into_document ( Foo , bar : 10 , lorem : Lorem . new )
378378 end
@@ -390,7 +390,7 @@ class Lorem; end
390390 optional :bar , type : String
391391 end
392392
393- def render ; DIV ; end
393+ def render ; DIV { } ; end
394394 end
395395 Hyperstack ::Component ::ReactTestUtils . render_component_into_document ( Foo , foo : 10 , bar : '10' , lorem : Lorem . new )
396396 end
@@ -587,67 +587,12 @@ class Foo
587587 include Hyperstack ::Component
588588
589589 def render
590- DIV ( ) # this fails but DIV {} passes. Why?
590+ DIV ( )
591591 end
592592 end
593593 end
594- binding . pry
595594 expect ( page . body ) . to include ( '<div data-react-class="Hyperstack.Internal.Component.TopLevelRailsComponent" data-react-props="{"render_params":{},"component_name":"Foo","controller":"HyperstackTest"}"><div></div></div>' )
596595 end
597-
598- it 'redefines `p` to make method missing work' do
599- mount 'Foo' do
600- class Foo
601- include Hyperstack ::Component
602-
603- def render
604- DIV {
605- p ( class_name : 'foo' )
606- p
607- DIV { 'lorem ipsum' }
608- p ( id : '10' )
609- }
610- end
611- end
612- end
613- expect ( page . body ) . to include ( '<div><p class="foo"></p><p></p><div>lorem ipsum</div><p id="10"></p></div>' )
614- end
615-
616- it 'only overrides `p` in render context' do
617- mount 'Foo' do
618- class Foo
619- include Hyperstack ::Component
620-
621- def self . result
622- @@result ||= 'ooopsy'
623- end
624-
625- def self . result_two
626- @@result_two ||= 'ooopsy'
627- end
628-
629- before_mount do
630- @@result = p 'first'
631- end
632-
633- after_mount do
634- @@result_two = p 'second'
635- end
636-
637- def render
638- p do
639- 'third'
640- end
641- end
642- end
643- end
644- expect_evaluate_ruby ( 'Kernel.p "first"' ) . to eq ( 'first' )
645- expect_evaluate_ruby ( 'p "second"' ) . to eq ( 'second' )
646- expect_evaluate_ruby ( 'Foo.result' ) . to eq ( 'first' )
647- expect_evaluate_ruby ( 'Foo.result_two' ) . to eq ( 'second' )
648- expect ( page . body [ -40 ..-10 ] ) . to include ( "<p>third</p>" )
649- expect ( page . body [ -40 ..-10 ] ) . not_to include ( "<p>first</p>" )
650- end
651596 end
652597
653598 describe 'new react 15/16 custom isMounted implementation' do
0 commit comments