Sha256: 407d62af9be153bc22b00f26d33c8e30f3b21766c317c4383ab5e99978860f84

Contents?: true

Size: 700 Bytes

Versions: 3

Compression:

Stored size: 700 Bytes

Contents

# Models automatically unload if no dependencies are listening and they have not been .keep (kept)

if RUBY_PLATFORM != 'opal'
  require 'spec_helper'

  describe Volt::Model do
    it 'should stay loaded while a computaiton is watching some data' do
      expect(store._items.loaded_state).to eq(:not_loaded)

      comp = -> { store._items.size }.watch!

      # On the server models do a blocking load
      expect(store._items.loaded_state).to eq(:loaded)

      comp.stop

      Volt::Timers.flush_next_tick_timers!

      # Computation stopped listening, so the collection should unload and be set to
      # a dirty state
      expect(store._items.loaded_state).to eq(:dirty)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
volt-0.8.27.beta6 spec/models/model_state_spec.rb
volt-0.8.27.beta5 spec/models/model_state_spec.rb
volt-0.8.27.beta4 spec/models/model_state_spec.rb