unified stylers with aliases and missing tests to close #217

This commit is contained in:
Gant
2015-03-18 22:27:56 -05:00
parent db516610b2
commit 215f8d05e4
4 changed files with 31 additions and 1 deletions

View File

@@ -56,6 +56,8 @@ module RubyMotionQuery
def adjusts_font_size
@view.adjustsFontSizeToFitWidth
end
alias :adjusts_font_size_to_fit_width= :adjusts_font_size=
alias :adjusts_font_size_to_fit_width :adjusts_font_size
def resize_height_to_fit
@view.lineBreakMode = UILineBreakModeWordWrap

View File

@@ -36,6 +36,8 @@ module RubyMotionQuery
# Sizing the Text Field's Text
def adjusts_font_size_to_fit_width ; view.adjustsFontSizeToFitWidth ; end
def adjusts_font_size_to_fit_width=(v) ; view.adjustsFontSizeToFitWidth = v ; end
alias :adjusts_font_size= :adjusts_font_size_to_fit_width=
alias :adjusts_font_size :adjusts_font_size_to_fit_width
def minimum_font_size ; view.minimumFontSize ; end
def minimum_font_size=(v) ; view.minimumFontSize = v ; end

View File

@@ -51,6 +51,18 @@ describe 'stylers/ui_label' do
end
it 'allows adjusts_font_size_to_fit_width alias' do
view = @vc.rmq.append(@view_klass, :ui_label_kitchen_sink)
view.style do |st|
st.adjusts_font_size.should == true
st.adjusts_font_size_to_fit_width = false
st.adjusts_font_size_to_fit_width.should == false
st.adjusts_font_size.should == false
end
end
it 'allows color set with `text_color`' do
view = @vc.rmq.append!(@view_klass, :ui_label_color)
view.textColor.should == rmq.color.blue

View File

@@ -13,6 +13,7 @@ describe 'stylers/ui_text_field' do
st.return_key_type = UIReturnKeyNext
st.spell_checking_type = UITextSpellCheckingTypeYes
st.right_view_mode = :always
st.adjusts_font_size_to_fit_width = true
end
def ui_text_field_color(st)
@@ -71,7 +72,20 @@ describe 'stylers/ui_text_field' do
v.keyboardAppearance.should == UIKeyboardAppearanceDark
v.returnKeyType.should == UIReturnKeyNext
v.spellCheckingType.should == UITextSpellCheckingTypeYes
v.rightViewMode == UITextFieldViewModeAlways
v.rightViewMode.should == UITextFieldViewModeAlways
v.adjustsFontSizeToFitWidth.should == true
end
end
it 'allows adjusts_font_size alias' do
view = @vc.rmq.append(@view_klass, :ui_text_field_kitchen_sink)
view.style do |st|
st.adjusts_font_size_to_fit_width.should == true
st.adjusts_font_size = false
st.adjusts_font_size.should == false
st.adjusts_font_size_to_fit_width.should == false
end
end