diff --git a/motion/ruby_motion_query/actions.rb b/motion/ruby_motion_query/actions.rb index b46d197..bff0392 100644 --- a/motion/ruby_motion_query/actions.rb +++ b/motion/ruby_motion_query/actions.rb @@ -33,8 +33,8 @@ module RubyMotionQuery #when UIStepper then #when UITabBar then #when UITableViewCell then - when UITextView then view.setText new_data - when UITextField then view.setText new_data + when UITextView then view.text = new_data + when UITextField then view.text = new_data #when UINavigationBar then #when UIScrollView then @@ -80,7 +80,7 @@ module RubyMotionQuery # @example # rmq(my_view).data = 'some data' def data=(new_data) - data(new_data) + self.data(new_data) end # @return [RMQ] diff --git a/spec/actions.rb b/spec/actions.rb index 43a9711..dd29f05 100644 --- a/spec/actions.rb +++ b/spec/actions.rb @@ -169,4 +169,17 @@ describe 'actions' do # Again, chained q = rmq.create(UILabel).data(nil).get.text.should == nil end + + it 'should allow the user to set data to nil using data =' do + q = rmq.create(UITextView) + q.data('hi') + q.get.text.should == 'hi' + + q.data = nil + q.get.text.should == "" + + q = rmq.create(UITextField) + q.data('there') + q.get.text.should == 'there' + end end