From 1980f5ac0a4e020c32e1a3eb83338b1387f693c7 Mon Sep 17 00:00:00 2001 From: Mark Rickert Date: Sun, 1 Sep 2013 13:08:40 -0400 Subject: [PATCH] Add passing test for setting frames with x/y instead of left/top --- spec/unit/view_helper_spec.rb | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/spec/unit/view_helper_spec.rb b/spec/unit/view_helper_spec.rb index b104c0e..7b25e16 100644 --- a/spec/unit/view_helper_spec.rb +++ b/spec/unit/view_helper_spec.rb @@ -79,7 +79,7 @@ describe "view helpers" do before do @dummy = UIView.alloc.initWithFrame CGRectZero @dummy.extend ProMotion::Styling - + @parent = UIView.alloc.initWithFrame(CGRectMake(0, 0, 320, 480)) @child = UIView.alloc.initWithFrame(CGRectZero) end @@ -89,11 +89,11 @@ describe "view helpers" do resize: [:left, :right, :top, :bottom, :width, :height] } - mask = UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | - UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleWidth | + mask = UIViewAutoresizingFlexibleLeftMargin | + UIViewAutoresizingFlexibleRightMargin | + UIViewAutoresizingFlexibleTopMargin | + UIViewAutoresizingFlexibleBottomMargin | + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight @child.autoresizingMask.should == mask @@ -104,8 +104,8 @@ describe "view helpers" do resize: [:left, :right, :top] } - mask = UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | + mask = UIViewAutoresizingFlexibleLeftMargin | + UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin @child.autoresizingMask.should == mask @@ -116,8 +116,8 @@ describe "view helpers" do resize: [:bottom, :width, :height] } - mask = UIViewAutoresizingFlexibleBottomMargin | - UIViewAutoresizingFlexibleWidth | + mask = UIViewAutoresizingFlexibleBottomMargin | + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight @child.autoresizingMask.should == mask @@ -142,6 +142,17 @@ describe "view helpers" do @child.frame.should == CGRectMake(10, 20, 100, 50) end + it "Should create a frame with x & y" do + @dummy.set_easy_attributes @parent, @child, { + x: 10, + y: 20, + width: 100, + height: 50 + } + + @child.frame.should == CGRectMake(10, 20, 100, 50) + end + end end