Fixe .data assigning to UITextView and UITextField in SDK 8.0 (I think it's just 8)

This commit is contained in:
Todd Werth
2014-09-20 17:55:24 -07:00
parent 71859740f4
commit a1e362deb0
2 changed files with 16 additions and 3 deletions

View File

@@ -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]

View File

@@ -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