Sha256: 16650fd1f325b0647419867da7e4c65377a29d8a05ff18d9d14aab8039c336fe

Contents?: true

Size: 1.26 KB

Versions: 55

Compression:

Stored size: 1.26 KB

Contents

require 'volt/models'

describe ReactiveValue do
  it "should concat reactive strings" do
    a = ReactiveValue.new('cool')
    b = ReactiveValue.new('beans')
    
    c = a + b
    expect(c.cur).to eq('coolbeans')
    expect(c.reactive?).to eq(true)
  end
  
  it "should concat reactive and non-reactive" do
    a = ReactiveValue.new('cool')
    b = 'beans'
    
    c = a + b
    expect(c.cur).to eq('coolbeans')
    expect(c.reactive?).to eq(true)    
  end
  
  it "should concat non-reactive and reactive" do
    a = 'cool'
    b = ReactiveValue.new('beans')
    
    c = a + b
    expect(c.cur).to eq('coolbeans')
    expect(c.reactive?).to eq(true)    
  end
  
  if RUBY_PLATFORM != 'opal'
    it "should append reactive to reactive" do
      a = ReactiveValue.new('cool')
      b = ReactiveValue.new('beans')
    
      a << b
      expect(a.cur).to eq('coolbeans')
      expect(a.reactive?).to eq(true)
    end
  end
  
  it "should raise an exception when appending  non-reactive and reactive" do
    a = 'cool'
    b = ReactiveValue.new('beans')
    
    exception_count = 0
    begin
      a << b
    rescue => e
      expect(e.message[/Cannot append a reactive/].cur.true?).to eq(true)
      exception_count += 1
    end
    
    expect(exception_count).to eq(1)
  end

end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
volt-0.6.5 spec/models/string_extensions_spec.rb
volt-0.6.4 spec/models/string_extensions_spec.rb
volt-0.6.3 spec/models/string_extensions_spec.rb
volt-0.6.2 spec/models/string_extensions_spec.rb
volt-0.6.1 spec/models/string_extensions_spec.rb
volt-0.6.0 spec/models/string_extensions_spec.rb
volt-0.5.18 spec/models/string_extensions_spec.rb
volt-0.5.17 spec/models/string_extensions_spec.rb
volt-0.5.16 spec/models/string_extensions_spec.rb
volt-0.5.15 spec/models/string_extensions_spec.rb
volt-0.5.14 spec/models/string_extensions_spec.rb
volt-0.5.13 spec/models/string_extensions_spec.rb
volt-0.5.12 spec/models/string_extensions_spec.rb
volt-0.5.11 spec/models/string_extensions_spec.rb
volt-0.5.10 spec/models/string_extensions_spec.rb
volt-0.5.9 spec/models/string_extensions_spec.rb
volt-0.5.8 spec/models/string_extensions_spec.rb
volt-0.5.7 spec/models/string_extensions_spec.rb
volt-0.5.6 spec/models/string_extensions_spec.rb
volt-0.5.4 spec/models/string_extensions_spec.rb