mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-04-28 12:45:35 +08:00
unified stylers with aliases and missing tests to close #217
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user