motion_bindable 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d4f78823ed3a1224388b7fc633d184c2b946722
4
- data.tar.gz: a480c9b6b1c83b6e02a6189155577d27e42057ab
3
+ metadata.gz: d5c897c0eb305bd4f7b5ffd32cf03c647c02f225
4
+ data.tar.gz: cd0bf8cc88ac483a0296e0fc0399cf157dd77e32
5
5
  SHA512:
6
- metadata.gz: be68505282ce2472d12ab56f3d0eb82591ede10e86e0b0e7f2684f1a11858fd115ea23b3751ab5a1aef089828e15b1bfa2c40eb275f6929e8c22484addb541bc
7
- data.tar.gz: 85eb9ab70b26840aec2ee26fb627a87ab1904c914fbe596dde9f29d78893399b5dc56fca6da3fe7697bcff51c494a010934e31c4aa674f73ce86e89f3c3970cd
6
+ metadata.gz: be96fcb5c62954e620367ebf7318eaa3aa2ea5fc9367d375aa6a472ada78e5f2e3d4b7de5c7f753837f741acfa350a604fe177c60f6e9f53e8b8f6dc57ad44b1
7
+ data.tar.gz: 523280e1eb706f1b561e9e81f52512537a49e3e824487ef2ec896eeaf41f739f3bd6f3267fbf2266bf85b07ccc4a51df32ddf44e34961b4fac17ecaab09bbc7b
@@ -1,3 +1,3 @@
1
1
  module MotionBindable
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -3,7 +3,7 @@ module MotionBindable::Strategies
3
3
  class UITextField < ::MotionBindable::Strategy
4
4
 
5
5
  def start_observing_bound
6
- NSNotificationCenter.defaultCenter.addObserverForName(
6
+ @bound_observer = NSNotificationCenter.defaultCenter.addObserverForName(
7
7
  UITextFieldTextDidChangeNotification,
8
8
  object: bound,
9
9
  queue: nil,
@@ -30,8 +30,8 @@ module MotionBindable::Strategies
30
30
  end
31
31
 
32
32
  def unbind
33
- App.notification_center.unobserve(@bound_observer)
34
- unobserve(object, @attr_name)
33
+ NSNotificationCenter.defaultCenter.removeObserver(@bound_observer)
34
+ object.removeObserver(self, forKeyPath: @attr_name)
35
35
  super
36
36
  end
37
37
 
@@ -74,6 +74,12 @@ describe 'MotionBindable::Strategy' do
74
74
  it 'should respond' do
75
75
  @strategy.respond_to?(:unbind).should.equal true
76
76
  end
77
+
78
+ it 'should clear the watcher' do
79
+ wait(0.5) do
80
+ @strategy.instance_variable_get(:@watching).should.equal nil
81
+ end
82
+ end
77
83
  end
78
84
 
79
85
  end
@@ -73,6 +73,17 @@ describe 'MotionBindable::Strategies::UITextField' do
73
73
  end
74
74
  end
75
75
 
76
+ context 'unbind is called' do
77
+ before do
78
+ @object.unbind_all
79
+ end
80
+
81
+ it 'should no longer update when the text field changed' do
82
+ @text_field.text = 'ch-changed'
83
+ @object.attribute.should.not.equal 'ch-changed'
84
+ end
85
+ end
86
+
76
87
  end
77
88
 
78
89
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion_bindable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Kot