Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

do booleans work correctly #246

Open
catmando opened this issue Feb 10, 2018 · 1 comment
Open

do booleans work correctly #246

catmando opened this issue Feb 10, 2018 · 1 comment

Comments

@catmando
Copy link
Contributor

Not sure if this was a regression that got fixed or what, but we need to add a test case like this:

it "will preserve boolean values correctly" do    
   stub_const 'Foo', Class.new(React::Component::Base)
   Foo.class_eval do
     param :foo
     def render
       foo = params.foo
       if foo && true
         "fail"
       else
         "succeed"
       end
     end
   end
   expect(Foo).to render_static_html('<span>succeed</span>').with_params(foo: false)
 end
@catmando
Copy link
Contributor Author

  it "will preserve boolean values correctly" do
    mount 'Foo1', foo1: 'no'
      class Foo1 < React::Component::Base

        param :foo1
        def render
          Foo2(bool: foo1 == 'yes')
        end
      end
      class Foo2 < React::Component::Base
        param :bool
        render { (foo && true) ? 'fail' : 'succeed' }
      end
    end
    expect(page).to contain('succeed')
  end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant