Merge branch 'master' into auto_set_content_size

* master:
  Allows you to specify right and bottom padding for resize_to_fit_subviews

Conflicts:
	spec/position.rb
This commit is contained in:
Mark Rickert
2015-02-20 11:50:26 -06:00
2 changed files with 31 additions and 2 deletions

View File

@@ -118,6 +118,35 @@ describe 'position' do
view.size.height.should == 500
end
it 'should resize to fit subviews with padding' do
view = @vc.rmq.append(UIView).layout(h: 100, w: 20).get
view.rmq.append(UIButton).layout(h: 50, w: 10)
view.rmq.append(UILabel).layout(h: 500, w: 70)
view.rmq.append(UIView).layout(h: 5, w: 1)
view.size.width.should == 20
view.size.height.should == 100
# Just right
view.rmq.resize_to_fit_subviews({right: 101})
view.size.width.should == 171
view.size.height.should == 500
# Just bottom
view.rmq.resize_to_fit_subviews({bottom: 13})
view.size.width.should == 70
view.size.height.should == 513
# Both right & bottom
view.rmq.resize_to_fit_subviews({right: 101, bottom: 13})
view.size.width.should == 171
view.size.height.should == 513
# Negative values
view.rmq.resize_to_fit_subviews({right: -1, bottom: -1})
view.size.width.should == 69
view.size.height.should == 499
end
it "should set a UIScrollView's contentSize property automatically" do
view = @vc.rmq.append(UIScrollView).layout(h: 100, w: 20).get
view.rmq.append(UIButton).layout(h: 50, w: 10)