Sha256: 70121cca6000a000846c107d04636c571d80d13fcb8f363b76ee4dec9618a189

Contents?: true

Size: 811 Bytes

Versions: 5

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

if opal?

describe 'React::State' do
  # class Foo; export_state :foo; end # accessible as Foo.foo outside
  it "can created static exported states" do
    stub_const 'Foo', Class.new
    Foo.class_eval do
      include React::Component
      export_state(:foo) { 'bar' }
    end

    expect(Foo.foo).to eq('bar')
  end

  # these will all require async operations and testing to see if things get re-rendered see spec_helper the "render" test method
  it "sets up observers when exported states are read"                      # if Foo.foo is used during rendering then when Foo.foo changes we will rerender
  it "can be accessed outside of react using get/set_state"                 # React::State.set_state(object, attribute, value) + React::State.get_state(object, attribute)
end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reactive-ruby-0.7.33 spec/react/react_state_spec.rb
reactive-ruby-0.7.32 spec/react/react_state_spec.rb
reactive-ruby-0.7.31 spec/react/react_state_spec.rb
reactive-ruby-0.7.30 spec/react/react_state_spec.rb
reactive-ruby-0.7.29 spec/react/react_state_spec.rb