spec/models/reactive_value_spec.rb in volt-0.7.1 vs spec/models/reactive_value_spec.rb in volt-0.7.2

- old
+ new

@@ -348,6 +348,25 @@ it "should give you back the object without any ReactiveValue's if you call .deep_cur on it." do a = ReactiveValue.new({_names: [ReactiveValue.new('bob'), ReactiveValue.new('jim')]}) expect(a.deep_cur).to eq({_names: ['bob', 'jim']}) end + + it "should remove any event bindings bound through a reactive value when the value changes" do + a = ReactiveValue.new(Model.new) + + a._info = {_name: 'Test'} + info = a._info.cur + + expect(info.listeners.size).to eq(0) + + listener = a._info.on('changed') { } + + expect(info.listeners.size).to eq(1) + + # Listener should be moved to the new object + a._info = {} + + expect(info.listeners.size).to eq(0) + end + end